Compare commits

...
79 Commits
Author SHA1 Message Date
Nedelosk 386f0645a5 Fix #627 Make a simpler API interface for IFarmLogic and improve the farm api 2017-04-06 00:13:15 +02:00
Nedelosk 91d46d1331 Fix #1440 Chisel Blocks do not render when used as Camo for Forestry Greenhouse blocks 2017-04-05 20:57:19 +02:00
Nedelosk e1eb4d25fb Fix Biogas Engine not noticing its generated power is being used 2017-04-05 15:54:57 +02:00
Nedelosk 72234d9b5d Fix #1537 Peat Engine not noticing its generated power is being used 2017-04-05 15:52:39 +02:00
Nedelosk 97f21bfda8 Fix #1643 gave wrong comb and now world wont load 2017-04-05 13:58:41 +02:00
Nedelosk c8c30073a2 Fix #1647 Method canDrain always returns true 2017-04-05 13:48:49 +02:00
mezz dc27154c1f Update JEI integration 2017-04-03 17:20:38 -07:00
SirSengir 5b15e6f405 Allow short mead cans/capsules to be drunk. 2017-03-26 20:51:20 +02:00
SirSengir 2530a7fb15 Remove mead as well. 2017-03-26 16:18:48 +02:00
SirSengir 4ec1381fbe Merge branch 'mc-1.11' of https://github.com/ForestryMC/ForestryMC into mc-1.11 2017-03-26 16:10:26 +02:00
SirSengir d97f6f69b0 Remove the infuser and associated gui. Port recipes to potions. 2017-03-26 16:10:12 +02:00
mezz c8fcb292d4 Fix sided config options 2017-03-26 06:20:21 -07:00
Nedelosk e075fe8fbf Fix #1640 Clientside crash when trying to access Statistics "Items" screen 2017-03-26 14:26:23 +02:00
Nedelosk 5ce9b9f65b Fix #1639 Thermionic Fabricator & Glass Pane 2017-03-26 14:22:54 +02:00
Nedelosk 2c9a30db73 Fix #1639 Thermionic Fabricator & Glass Pane 2017-03-26 14:21:31 +02:00
Nedelosk 4a31215ce1 Fix #1624 Crashing 2017-03-17 21:15:52 +01:00
Nedelosk 4da5e86813 Remove butterfly hatch and add butterfly nursery 2017-03-17 20:26:43 +01:00
Nedelosk 66bdedd65b Fix #1621 Some Butterflies have missing textures 2017-03-10 23:37:08 +01:00
mezz 0149013579 Use TileUtil for getting tiles from the world 2017-03-10 00:16:44 -08:00
mezz bebf5b3aec Fix canNurse because butterflies cannot convert vanilla leaves 2017-03-09 23:26:37 -08:00
mezz 0356a3f479 Prevent butterflies from converting vanilla leaves to Forestry leaves 2017-03-09 22:32:43 -08:00
Nedelosk d29aa13377 Fix #1616 Smarter tree generation 2017-03-07 22:25:18 +01:00
Nedelosk c2313c7569 Fix cocoon 2017-03-07 21:19:37 +01:00
Nedelosk bb28a6db48 Fix #1592 Carpenter recipe for Portable Analyzer asks for Magenta Stained Glass Pane 2017-03-06 19:55:12 +01:00
Nedelosk f61f7a0aff Remove walnut and chestnut from the tree generation list 2017-03-06 17:53:36 +01:00
Nedelosk 84f01de7f9 Improve cocoon positions 2017-03-06 16:45:08 +01:00
Nedelosk ced6f3cbf2 Fix #872 Clean Up and add tree generaton 2017-03-06 15:49:12 +01:00
Nedelosk bbec31fc6e Fix #1573 Butterfly shift stats don't match analyzer stats 2017-03-05 16:37:11 +01:00
Nedelosk 67024ffb2b Fix #1394 Add podzol as an alternative to mycelium 2017-03-05 16:27:28 +01:00
Nedelosk 1945c4ff70 Fix #1484 Add podzol recipe to the moistener 2017-03-05 15:57:15 +01:00
Nedelosk 7a1e35e05f Fix #1569 Can't See Capsule/Can Recipes 2017-03-05 14:55:35 +01:00
Nedelosk 06adb53944 Fix #1610 1.11.2 - Multiblocks not assembling? 2017-03-03 22:14:43 +01:00
Nedelosk 919ce8238b Fix #1590 [1.11.2] Tin tubes creating in the carpenter without tin. 2017-02-26 20:54:48 +01:00
Nedelosk 6f285d1c88 Fix #1608 Thermionic Fabricator crash 2017-02-26 20:26:51 +01:00
Nedelosk af9ddb4928 Fix server packets on singeplayer 2017-02-26 20:17:52 +01:00
Nedelosk 1d2f3f16ab Fix #1582 Error in log related to forestry 2017-02-25 20:53:31 +01:00
Nedelosk 7f63ae8450 Fix #1600 backpackt2.png not found 2017-02-25 20:33:01 +01:00
Nedelosk 77ecd03416 Fix #1607 Wrong calculation for stamps in letters 2017-02-25 19:48:37 +01:00
Nedelosk 56a907dbec Fix Cocoon 2017-02-19 21:59:28 +01:00
mezz e93633d999 Add proper @SideOnly(Side.CLIENT) annotations
with help from Minecraft Dev Plugin
https://plugins.jetbrains.com/idea/plugin/8327-minecraft-development
2017-02-14 21:12:09 -08:00
mezz fc0d144508 Fix #1595 DataParameter ID issue caused by Forestry carts 2017-02-12 17:05:22 -08:00
mezz 252dd8ab22 Add IAlleleRegistry#addValidAlleleTypes 2017-02-08 22:51:46 -08:00
mezz 6ef41d4cd8 Allow IWoodTypes besides EnumForestryWoodType to use Forestry models 2017-02-08 22:31:40 -08:00
mezz 0b08780964 Fix pipetting small amounts of liquid 2017-02-08 22:31:40 -08:00
Nedelosk 1cf24982fd Merge pull request #1588 from Ellpeck/mc-1.11
fix Actually Additions integration
2017-02-04 17:03:17 +01:00
Ellpeck 9555005ac0 fix actually additions integration 2017-02-04 16:59:56 +01:00
Nedelosk 00b4b6552c Fix #1568 Oredict carpenter problem 2017-01-31 14:23:22 +01:00
Nedelosk 23a9af3020 Fix TreeFactory 2017-01-24 11:13:34 +01:00
Nedelosk 84a14811d8 Merge branch 'mc-1.11' of https://github.com/ForestryMC/ForestryMC into mc-1.11 2017-01-24 11:11:32 +01:00
Nedelosk 7b340fdb49 Add ILeafProvider 2017-01-24 11:11:24 +01:00
mezz 9044a72aee Fix #1572 All trees have apple oak leaves 2017-01-21 19:35:17 -08:00
mezz cc40bd1cc3 Expose WoodAccess registration to the API 2017-01-20 23:00:33 -08:00
mezz a13e63cb2d Fix #1566 Incompatibility with Schematica 2017-01-14 11:08:47 -08:00
Nedelosk 6cb3b73200 Add minecraft curseforge link 2017-01-12 16:34:25 +01:00
Nedelosk 7c8d81470d Add issue template and clean up .gitignore 2017-01-12 16:01:26 +01:00
Nedelosk ef3f64fdd9 Upadate README.md to 1.11 2017-01-12 15:51:07 +01:00
Nedelosk fdd6d75d0e Improve cocoons 2017-01-12 15:44:30 +01:00
Nedelosk 46bb2cdccd Add missing code 2017-01-12 15:37:41 +01:00
Nedelosk aa21b31392 Clean Up Wood Textures 2017-01-12 15:19:21 +01:00
Nedelosk 6a12e19798 Clean Up Wood Model Loader 2017-01-12 13:29:31 +01:00
mezz 81dd20b41c Prevent exception from accessing tile entities from ChunkCache 2017-01-09 12:25:33 -08:00
mezz 0b491f26fc Fix #1561 Crash when using the carpenter 2017-01-08 03:36:43 -08:00
mezz bb0a0343c1 Fix #1563 Crash when viewing bee trades with a villager 2017-01-08 03:20:40 -08:00
mezz 17e38e7c5e Fix #1565 Farm crash when farmland on at least one side is missing 2017-01-08 03:01:06 -08:00
Nedelosk 0ad3baecda Fix #1564 Gamecrash while trying to craft golden electron tube 2017-01-08 01:06:26 +01:00
mezz a72971e042 Fix #1562 Carpenter recipes not showing properly in JEI 2017-01-07 01:10:16 -08:00
mezz b5e24e84cb Fix #1560 network sync issue for genome tracker when player logs in 2017-01-06 23:53:24 -08:00
Nedelosk c210886400 Fix #1559 2017-01-05 16:16:10 +01:00
Nedelosk 1bdbb7e9f8 Clean Up Models, Jei and IInduvidual translators 2017-01-04 23:26:47 +01:00
Nedelosk f91c0574ad Clean Up 2017-01-03 17:01:30 +01:00
Nedelosk 50f0efb7a0 Update Module 2017-01-03 02:35:57 +01:00
Nedelosk 3d932700cd Fix carpenter and thermionic fabricator recipes 2017-01-03 02:32:45 +01:00
Nedelosk 6a00a65aac Update lang Module 2017-01-02 23:22:06 +01:00
Nedelosk 1b781684a0 Improve charcoal pile 2017-01-02 23:21:48 +01:00
mezz f2d280a861 Clean up backpack resupply handler 2017-01-02 12:08:11 -08:00
Nedelosk 87ce642235 Make that the multiblocks error renderers are only work with naturalist eyes 2017-01-01 20:19:15 +01:00
Nedelosk b297bbb2c4 Fix #1556 Log Piles Missing Models 2017-01-01 20:15:13 +01:00
Nedelosk 931e518ca2 Add multiblock tooltips and error game overlay renderer 2017-01-01 04:09:29 +01:00
Nedelosk 7ff4944281 Clean Up greenhouse 2017-01-01 03:06:36 +01:00
572 changed files with 6566 additions and 7713 deletions

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
Thank you for reporting!
For issues:
* Try the latest version, it may have fixed the issue already.
* If you crashed, please paste the crash log to [gist](https://gist.github.com/) and link it here.
+3 -3
View File
@@ -2,11 +2,10 @@
/*
# folders
!/.github
!/forestry_techne
!/gradle/wrapper
!/src
!/api
!/test
# files
!/.gitignore
@@ -21,4 +20,5 @@
!/build.xml
!/gradlew
!/gradlew.bat
.DS_Store
!/cla-signatures.txt
!/formatting-settings.jar
+3 -3
View File
@@ -1,4 +1,4 @@
Forestry
[Forestry](https://minecraft.curseforge.com/projects/forestry/files)
====================================
### What is it?
@@ -9,7 +9,7 @@ Forestry is a modification for the game Minecraft and known primarily for its fa
[Wiki](http://forestry.sengir.net/)
[Latest Builds for 1.10 / 1.10.2](http://jenkins.ic2.player.to/job/Forestry_5/)
[Latest Builds for 1.11 / 1.11.2](http://jenkins.ic2.player.to/job/Forestry_1.11/)
[IRC #forestry on esper.net](http://webchat.esper.net/?nick=ForestryGithub...&channels=forestry&prompt=1)
@@ -17,7 +17,7 @@ For those interested in developement, you can also visit #forestry-dev.
### Building
The API and localization files reside in their own repository. It is pulled in automatically.
The localization files reside in their own repository. It is pulled in automatically.
You may want to adjust the "./gradle.properties" file to set your mc account as needed.
+3 -3
View File
@@ -1,11 +1,11 @@
mcversion=1.11.2
forgeversion=13.20.0.2201
forgeversion=13.20.0.2262
mcp_mappings=snapshot_20161220
tesla_version=1.11-1.3.0.51
jei_version=4.2.0.211
jei_version=4.3.0.252
#ic2_version=2.6.76-ex110
version_major=5
version_minor=3
version_patch=0
version_patch=2
+1 -1
Submodule lang updated: d39f07201c...addea45c4f.
+5 -4
View File
@@ -54,8 +54,8 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
version = Constants.VERSION,
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
acceptedMinecraftVersions = "[1.11]",
dependencies = "required-after:forge@[13.19.1.2189,);"
+ "after:JEI@[4.1.1,);")
dependencies = "required-after:forge@[13.20.0.2230,);"
+ "after:JEI@[4.3.0,);")
// + "after:" + PluginIC2.modId + ";")
public class Forestry {
@@ -90,9 +90,10 @@ public class Forestry {
MinecraftForge.EVENT_BUS.register(eventHandlerCore);
MinecraftForge.EVENT_BUS.register(new MultiblockEventHandler());
MinecraftForge.EVENT_BUS.register(new ClimateEventHandler());
Proxies.common.registerEventHandlers();
configFolder = new File(event.getModConfigurationDirectory(), Constants.MOD_ID);
Config.load();
Config.load(event.getSide());
PluginManager.runSetup(event);
@@ -100,7 +101,7 @@ public class Forestry {
Preconditions.checkState(gameMode != null);
ForestryAPI.activeMode = new GameMode(gameMode);
PluginManager.runPreInit();
PluginManager.runPreInit(event.getSide());
Proxies.render.registerModels();
}
@@ -7,6 +7,8 @@ package forestry.api.apiculture;
import forestry.api.genetics.IAlleleEffect;
import forestry.api.genetics.IEffectData;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public interface IAlleleBeeEffect extends IAlleleEffect {
@@ -28,6 +30,7 @@ public interface IAlleleBeeEffect extends IAlleleEffect {
* @param housing {@link IBeeHousing} the bee currently resides in.
* @return storedData, may have been manipulated.
*/
@SideOnly(Side.CLIENT)
IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing);
}
@@ -16,6 +16,8 @@ import forestry.api.genetics.IIndividualLiving;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* Other implementations than Forestry's default one are not supported.
@@ -54,6 +56,7 @@ public interface IBee extends IIndividualLiving {
IEffectData[] doEffect(IEffectData[] storedData, IBeeHousing housing);
@SideOnly(Side.CLIENT)
IEffectData[] doFX(IEffectData[] storedData, IBeeHousing housing);
/**
@@ -13,6 +13,8 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* Stores beekeeping logic for bee housings.
@@ -62,12 +64,14 @@ public interface IBeekeepingLogic extends INbtWritable, INbtReadable {
* Whether bee fx should be active.
* Internally, this is automatically synced to the client.
*/
@SideOnly(Side.CLIENT)
boolean canDoBeeFX();
/**
* Display bee fx. Calls IBee.doFX(IEffectData[] storedData, IBeeHousing housing) on the queen.
* Internally, the queen is automatically synced to the client for the fx.
*/
@SideOnly(Side.CLIENT)
void doBeeFX();
/**
@@ -8,7 +8,6 @@ package forestry.api.arboriculture;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IFruitFamily;
import forestry.core.utils.Translator;
import net.minecraft.util.text.translation.I18n;
public enum EnumFruitFamily implements IFruitFamily {
PRUNES("prunes", "Prunus domestica"),
@@ -41,8 +41,17 @@ public interface IAlleleTreeSpecies extends IAlleleSpecies, IAlleleProperty<IAll
* @return The modid from the mod of the species.
*/
String getModID();
/**
* @return Float between 0 and 1 representing the rarity of the species, will affect spawn rate. If it's 0, it will not spawn.
*/
float getRarity();
IWoodProvider getWoodProvider();
ILeafProvider getLeafProvider();
IGrowthProvider getGrowthProvider();
/* MODELS AND OVERRIDES */
@SideOnly(Side.CLIENT)
@@ -23,5 +23,15 @@ public interface IAlleleTreeSpeciesBuilder extends IAlleleSpeciesBuilder {
* Set the minecraft plant type for this tree. Default is Plains.
*/
IAlleleTreeSpeciesBuilder setPlantType(EnumPlantType type);
/**
* Set rarity of the species, will affect spawn rate in the world. Must be a float between 0 and 1. If it's 0, it will not spawn.
*/
IAlleleTreeSpeciesBuilder setRarity(float rarity);
/**
* Set the growth provider.
*/
IAlleleTreeSpeciesBuilder setGrowthProvider(IGrowthProvider growthProvider);
}
@@ -3,21 +3,18 @@
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.greenhouse;
package forestry.api.arboriculture;
import forestry.api.climate.IClimateInfo;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
public interface ITerrainRecipe {
boolean matches(IBlockState blockState);
IBlockState getResult();
IClimateInfo getMinClimate();
IClimateInfo getMaxClimate();
float getChance();
public interface ICharcoalPileWall {
int getCharcoalAmount();
boolean matches(IBlockState state);
NonNullList<ItemStack> getDisplyItems();
}
@@ -20,6 +20,7 @@ public interface IGermlingModelProvider {
@SideOnly(Side.CLIENT)
void registerModels(Item item, IModelManager manager, EnumGermlingType type);
@SideOnly(Side.CLIENT)
ModelResourceLocation getModel(EnumGermlingType type);
/**
@@ -0,0 +1,18 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.arboriculture;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
public interface IGrowthProvider {
boolean canSpawn(ITree tree, World world, BlockPos pos);
boolean isBiomeValid(ITree tree, Biome biome);
}
@@ -5,6 +5,12 @@
******************************************************************************/
package forestry.api.arboriculture;
public enum EnumGrowthConditions {
HOSTILE, PALTRY, NORMAL, GOOD, EXCELLENT
}
import net.minecraft.item.ItemStack;
public interface ILeafProvider {
void init(IAlleleTreeSpecies treeSpecies);
ItemStack getDecorativeLeaves();
}
@@ -19,6 +19,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public interface ITree extends IIndividual, ITreeGenData {
@@ -26,6 +28,7 @@ public interface ITree extends IIndividual, ITreeGenData {
IEffectData[] doEffect(IEffectData[] storedData, World world, BlockPos pos);
@SideOnly(Side.CLIENT)
IEffectData[] doFX(IEffectData[] storedData, World world, BlockPos pos);
@Override
@@ -31,6 +31,27 @@ public interface ITreeFactory {
*/
IAlleleTreeSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean dominant, IClassification branch, String binomial, String modID, ILeafSpriteProvider leafSpriteProvider, IGermlingModelProvider germlingModelProvider, IWoodProvider woodProvider, ITreeGenerator generator);
/**
* Creates a new tree species.
* Automatically registered with AlleleManager.alleleRegistry.registerAllele()
* See IAlleleTreeSpeciesBuilder and IAlleleSpeciesBuilder for adding additional properties to the returned species.
*
* @param uid Unique Identifier for this species
* @param unlocalizedName Unlocalized name for this species
* @param authority Authority for the binomial name, e.g. "Sengir" on species of base Forestry.
* @param unlocalizedDescription Unlocalized description for this species
* @param dominant Whether this species is genetically dominant (false means it is recessive)
* @param branch Classification of this species
* @param binomial Binomial name of the species sans genus. "humboldti" will have the bee species flavour name be "Apis humboldti". Feel free to use fun names or null.
* @param modID The modID from the mod of the species
* @param leafSpriteProvider The leaf sprite provider for this species
* @param germlingModelProvider The germling model provider for this species
* @param woodProvider The wood texture provider. It is used to get wood textures for the charcoal pile.
* @param generator The tree generator
* @return a new tree species allele.
*/
IAlleleTreeSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean dominant, IClassification branch, String binomial, String modID, ILeafSpriteProvider leafSpriteProvider, IGermlingModelProvider germlingModelProvider, IWoodProvider woodProvider, ITreeGenerator generator, ILeafProvider leafProvider);
/**
* Get one of the built-in Forestry leaf types. Default type is deciduous.
*/
@@ -6,6 +6,7 @@
package forestry.api.arboriculture;
import forestry.api.genetics.IGenome;
import net.minecraft.item.ItemStack;
public interface ITreeGenome extends IGenome {
@@ -37,4 +38,10 @@ public interface ITreeGenome extends IGenome {
int getGirth();
IAlleleLeafEffect getEffect();
/**
*
* @return A ItemStack that is used in getPickBlock of the leave block.
*/
ItemStack getDecorativeLeaves();
}
@@ -27,4 +27,5 @@ public interface IWoodAccess {
List<IWoodType> getRegisteredWoodTypes();
void register(IWoodType woodType, WoodBlockKind woodBlockKind, boolean fireproof, IBlockState blockState, ItemStack itemStack);
}
@@ -26,7 +26,7 @@ public interface IWoodProvider {
* @return A stack of wood from the tree to craft wood pile's or other things.
*/
ItemStack getWoodStack();
/**
* The amount of charcoal dropped from a charcoal pile of this wood.
*/
@@ -5,6 +5,9 @@
******************************************************************************/
package forestry.api.arboriculture;
import java.util.ArrayList;
import java.util.List;
public class TreeManager {
/**
@@ -26,4 +29,6 @@ public class TreeManager {
* Used to create new tree mutations.
*/
public static ITreeMutationFactory treeMutationFactory;
public static List<ICharcoalPileWall> pileWalls = new ArrayList<>();
}
@@ -9,21 +9,15 @@ import net.minecraftforge.client.model.IModel;
import net.minecraftforge.client.model.ModelProcessingHelper;
public enum WoodBlockKind {
LOG, PLANKS, SLAB, FENCE, FENCE_GATE, STAIRS, DOOR(false);
public final boolean retextureItem;
WoodBlockKind() {
this(true);
}
WoodBlockKind(boolean retextureItem) {
this.retextureItem = retextureItem;
LOG, PLANKS, SLAB, FENCE, FENCE_GATE, STAIRS, DOOR;
public String getName(){
return super.toString().toLowerCase(Locale.ENGLISH);
}
@Override
public String toString() {
return super.toString().toLowerCase(Locale.ENGLISH);
return getName();
}
public IModel retextureModel(IModel model, IWoodType type, ImmutableMap<String, String> customTextures) {
@@ -8,13 +8,17 @@ package forestry.api.circuits;
import java.util.List;
import forestry.api.core.INbtWritable;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public interface ICircuitBoard extends INbtWritable {
@SideOnly(Side.CLIENT)
int getPrimaryColor();
@SideOnly(Side.CLIENT)
int getSecondaryColor();
@SideOnly(Side.CLIENT)
void addTooltip(List<String> list);
void onInsertion(Object tile);
@@ -8,6 +8,8 @@ package forestry.api.core;
import java.util.Set;
import forestry.api.climate.IClimateManager;
import forestry.api.farming.IFarmRegistry;
import forestry.api.farming.ISimpleFarmLogic;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -42,14 +44,16 @@ public class ForestryAPI {
@SideOnly(Side.CLIENT)
public static ITextureManager textureManager;
/**
* A {@link IModelManager} needed for some things in the API.
*/
@SideOnly(Side.CLIENT)
public static IModelManager modelManager;
public static IClimateManager climateManager;
/**
* A registry for register fertilizers, {@link IFarmabeles}s and {@link ISimpleFarmLogic}s
*/
public static IFarmRegistry farmRegistry;
/**
* The currently active {@link IGameMode}.
*/
@@ -6,6 +6,7 @@
package forestry.api.core;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -18,7 +19,7 @@ public interface ITextureManager {
/**
* Location of the Forestry Gui Texture Map.
* Used for binding with {@link net.minecraft.client.renderer.texture.TextureManager#bindTexture(ResourceLocation)}
* Used for binding with {@link TextureManager#bindTexture(ResourceLocation)}
*/
ResourceLocation getGuiTextureMap();
@@ -10,6 +10,8 @@ import java.util.Map;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import forestry.api.core.ForestryAPI;
import net.minecraft.item.ItemStack;
public class Farmables {
@@ -17,9 +19,15 @@ public class Farmables {
* Can be used to add IFarmables to some of the vanilla farm logics.
* <p>
* Identifiers: farmArboreal farmWheat farmGourd farmInfernal farmPoales farmSucculentes farmVegetables farmShroom
* @deprecated Please use {@link IFarmRegistry#registerFarmables(String, IFarmable...)} and {@link IFarmRegistry#getFarmables(String)}.
*/
@Deprecated
public static final Multimap<String, IFarmable> farmables = HashMultimap.create();
/**
* @deprecated Please use {@link IFarmRegistry#registerFertilizer(ItemStack, int)} and {@link IFarmRegistry#getFertilizeValue(ItemStack)}.
*/
@Deprecated
public static final Map<ItemStack, Integer> fertilizers = new LinkedHashMap<>();
}
@@ -0,0 +1,40 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.farming;
import java.util.Collection;
import net.minecraft.item.ItemStack;
public interface IFarmRegistry {
/**
* Can be used to add IFarmables to some of the vanilla farm logics.
* <p>
* Identifiers: farmArboreal farmWheat farmGourd farmInfernal farmPoales farmSucculentes farmVegetables farmShroom
*/
void registerFarmables(String identifier, IFarmable... farmable);
Collection<IFarmable> getFarmables(String identifier);
/**
* Can be used to create a simple version of a farm logic, like the vanilla vegetable or wheat farm logic.
*/
IFarmLogic createLogic(ISimpleFarmLogic simpleFarmLogic);
/**
*
* @param itemStack
* @param value The value of the fertitlizer.The value of the forestry fertelizer is 500.
*/
void registerFertilizer(ItemStack itemStack, int value);
/**
* @return The value of the fertitlizer
*/
int getFertilizeValue(ItemStack itemStack);
}
@@ -0,0 +1,19 @@
package forestry.api.farming;
import net.minecraft.item.ItemStack;
/**
* A simple version of the IFarmLogic.
*/
public interface ISimpleFarmLogic {
/**
* @return the itemStack that represents this farm logic. Used as an icon for the farm logic.
*/
ItemStack getIconItemStack();
Iterable<IFarmable> getSeeds();
String getName();
}
@@ -1,13 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.food;
public class BeverageManager {
public static final IBeverageEffect[] effectList = new IBeverageEffect[128];
public static IInfuserManager infuserManager;
public static IIngredientManager ingredientManager;
}
@@ -5,12 +5,6 @@
******************************************************************************/
package forestry.api.genetics;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
/**
* Holds a static reference to the {@link IAlleleRegistry}.
*/
@@ -20,16 +14,6 @@ public class AlleleManager {
*/
public static IAlleleRegistry alleleRegistry;
/**
* Translates plain leaf blocks into genetic data. Used by bees and butterflies to convert and pollinate foreign leaf blocks.
*/
public static final Map<Block, ILeafTranslator> leafTranslators = new HashMap<>();
/**
* Translates plain saplings into genetic data. Used by the treealyzer and the farm to convert foreign saplings.
*/
public static final Map<Item, ISaplingTranslator> saplingTranslation = new HashMap<>();
/**
* Queryable instance of an {@link IClimateHelper} for easier implementation.
*/
@@ -109,6 +109,13 @@ public interface IAlleleRegistry {
*/
void registerAllele(IAllele allele, IChromosomeType... chromosomeTypes);
/**
* Add more valid chromosome types for an allele.
* Used by addons that create new chromosome types beyond bees, trees, and butterflies.
* @since Forestry 5.3.1
*/
void addValidAlleleTypes(IAllele allele, IChromosomeType... chromosomeTypes);
/**
* @return HashMap of all registered deprecated alleles and their corresponding replacements
*/
@@ -0,0 +1,20 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.genetics;
import javax.annotation.Nullable;
import net.minecraft.block.state.IBlockState;
/**
* Translates blockStates into genetic data.
* Used by bees and butterflies to convert and pollinate foreign leaf blocks.
*/
public interface IBlockTranslator<I extends IIndividual> extends IIndividualTranslator<I, IBlockState> {
@Nullable
@Override
I getIndividualFromObject(IBlockState blockState);
}
@@ -3,10 +3,11 @@
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.greenhouse;
package forestry.api.genetics;
public enum EnumGreenhouseEventType {
CAMOUFLAGE
import javax.annotation.Nullable;
public interface IIndividualTranslator<I extends IIndividual, O> {
@Nullable
I getIndividualFromObject(O objectToTranslator);
}
@@ -0,0 +1,19 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.genetics;
import javax.annotation.Nullable;
import net.minecraft.item.ItemStack;
/**
* Translates items into genetic data. Used by the treealyzer and the farm to convert foreign saplings.
*/
public interface IItemTranslator<I extends IIndividual> extends IIndividualTranslator<I, ItemStack> {
@Nullable
@Override
I getIndividualFromObject(ItemStack itemStack);
}
@@ -1,16 +0,0 @@
package forestry.api.genetics;
import javax.annotation.Nullable;
import forestry.api.arboriculture.ITree;
import net.minecraft.block.state.IBlockState;
/**
* Translates blockStates for a single plain leaf block into genetic data.
* Used by bees and butterflies to convert and pollinate foreign leaf blocks.
* Kept in a map with Block keys: {@link AlleleManager#leafTranslators}
*/
public interface ILeafTranslator {
@Nullable
ITree getTreeFromLeaf(IBlockState leafBlockState);
}
@@ -1,11 +0,0 @@
package forestry.api.genetics;
import javax.annotation.Nullable;
import forestry.api.arboriculture.ITree;
import net.minecraft.item.ItemStack;
public interface ISaplingTranslator {
@Nullable
ITree getTreeFromSapling(ItemStack sapling);
}
@@ -12,6 +12,7 @@ import java.util.Map;
import java.util.Random;
import com.mojang.authlib.GameProfile;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@@ -65,6 +66,11 @@ public interface ISpeciesRoot {
IIndividual getMember(ItemStack stack);
IIndividual getMember(NBTTagCompound compound);
<O extends Object, I extends IIndividual> void registerTranslator(Object translatorKey, IIndividualTranslator<I, O> translator);
@Nullable
<O extends Object, I extends IIndividual> IIndividualTranslator<I, O> getTranslator(Object translatorKey);
@Nullable
ISpeciesType getType(ItemStack itemStack);
@@ -1,56 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.greenhouse;
import forestry.api.multiblock.IGreenhouseController;
import net.minecraft.nbt.NBTTagCompound;
public class DefaultGreenhouseLogic implements IGreenhouseLogic {
public final IGreenhouseController controller;
private final String name;
public DefaultGreenhouseLogic(IGreenhouseController controller, String name) {
this.controller = controller;
this.name = name;
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
return nbt;
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
}
@Override
public void work() {
}
@Override
public void onEvent(EnumGreenhouseEventType type, Object event) {
}
@Override
public IGreenhouseController getController() {
return controller;
}
@Override
public String getName() {
return name;
}
@Override
public void onMachineAssembled() {
}
@Override
public void onMachineDisassembled() {
}
}
@@ -5,10 +5,6 @@
******************************************************************************/
package forestry.api.greenhouse;
import javax.annotation.Nullable;
import forestry.api.core.ICamouflageHandler;
import forestry.api.core.ICamouflagedTile;
import forestry.api.multiblock.IGreenhouseController;
import net.minecraftforge.fml.common.eventhandler.Event;
@@ -20,24 +16,6 @@ public class GreenhouseEvents extends Event {
this.controller = state;
}
public static class CamouflageChangeEvent extends GreenhouseEvents {
@Nullable
public final ICamouflagedTile camouflagedBlock;
public final ICamouflageHandler camouflageHandler;
public final String camouflageType;
public CamouflageChangeEvent(IGreenhouseController controller, @Nullable ICamouflagedTile camouflagedBlock, ICamouflageHandler camouflageHandler, String camouflageType) {
super(controller);
this.camouflagedBlock = camouflagedBlock;
this.camouflageHandler = camouflageHandler;
this.camouflageType = camouflageType;
}
}
public static class InternalBlockEvent extends GreenhouseEvents {
public final IInternalBlock internalBlock;
@@ -1,11 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.greenhouse;
public interface IGreenhouseClimaLogic extends IGreenhouseLogic {
}
@@ -6,12 +6,7 @@
package forestry.api.greenhouse;
import javax.annotation.Nullable;
import java.util.List;
import forestry.api.climate.IClimateInfo;
import forestry.api.multiblock.IGreenhouseController;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -23,14 +18,4 @@ public interface IGreenhouseHelper {
@Nullable
IGreenhouseController getGreenhouseController(World world, BlockPos pos);
void registerGreenhouseLogic(Class<? extends IGreenhouseLogic> logic);
List<Class<? extends IGreenhouseLogic>> getGreenhouseLogics();
void registerTerrainRecipe(Block inputBlock, IBlockState outputState, IClimateInfo minClimate, IClimateInfo maxClimate, float chance);
void registerTerrainRecipe(IBlockState inputState, IBlockState outputState, IClimateInfo minClimate, IClimateInfo maxClimate, float chance);
ITerrainRecipe getValidTerrainRecipe(IBlockState blockState, IClimateInfo climateInfo);
}
@@ -1,31 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.api.greenhouse;
import forestry.api.core.INbtReadable;
import forestry.api.core.INbtWritable;
import forestry.api.multiblock.IGreenhouseController;
public interface IGreenhouseLogic extends INbtWritable, INbtReadable {
void work();
void onEvent(EnumGreenhouseEventType type, Object event);
void onMachineAssembled();
void onMachineDisassembled();
IGreenhouseController getController();
String getName();
}
@@ -1,18 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.greenhouse;
import forestry.api.climate.IClimateInfo;
public interface IOvergrowth {
IClimateInfo getMinClimate();
IClimateInfo getMaxClimate();
float getChance();
}
@@ -23,5 +23,8 @@ public interface IAlleleButterflyCocoon extends IAlleleProperty<IAlleleButterfly
String getCocoonName();
Map<ItemStack, Float> getCocoonLoot();
void clearLoot();
void addLoot(ItemStack loot, float chance);
}
@@ -10,8 +10,6 @@
******************************************************************************/
package forestry.api.lepidopterology;
import javax.annotation.Nullable;
import forestry.api.genetics.IHousing;
public interface IButterflyCocoon extends IHousing {
@@ -20,11 +18,6 @@ public interface IButterflyCocoon extends IHousing {
void setCaterpillar(IButterfly butterfly);
@Nullable
IButterflyNursery getNursery();
void setNursery(IButterflyNursery nursery);
boolean isSolid();
}
@@ -14,6 +14,7 @@ import forestry.api.genetics.ISpeciesRoot;
import net.minecraft.entity.EntityLiving;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public interface IButterflyRoot extends ISpeciesRoot {
@@ -52,7 +53,7 @@ public interface IButterflyRoot extends ISpeciesRoot {
*/
EntityLiving spawnButterflyInWorld(World world, IButterfly butterfly, double x, double y, double z);
boolean plantCocoon(World world, IButterflyNursery nursery, GameProfile owner, int age);
BlockPos plantCocoon(World world, BlockPos pos, IButterfly caterpillar, GameProfile owner, int age, boolean createNursery);
/**
* @return true if passed item is mated.
@@ -1,38 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.multiblock;
import com.mojang.authlib.GameProfile;
import forestry.api.arboriculture.EnumPileType;
import forestry.api.arboriculture.IAlleleTreeSpecies;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* Needs to be implemented by TileEntities that want to be part of an charcoal pile.
* The sub-interfaces can be implemented to alter the operation of the charcoal pile.
* They are automatically detected and handled by the charcoal pile when they join its structure.
*/
public interface ICharcoalPileComponent<T extends IMultiblockLogicCharcoalPile> extends IMultiblockComponent {
@Override
T getMultiblockLogic();
IAlleleTreeSpecies getTreeSpecies();
void setTreeSpecies(IAlleleTreeSpecies treeSpecies);
@Override
GameProfile getOwner();
void setOwner(GameProfile owner);
EnumPileType getPileType();
@SideOnly(Side.CLIENT)
IAlleleTreeSpecies getNextWoodPile();
}
@@ -1,9 +0,0 @@
package forestry.api.multiblock;
public interface ICharcoalPileController extends IMultiblockController {
boolean isActive();
void setActive(boolean active);
}
@@ -32,8 +32,8 @@ public interface IGreenhouseComponent<T extends IMultiblockLogicGreenhouse> exte
IClimatiserDefinition getDefinition();
}
interface ButterflyHatch extends IGreenhouseComponent {
NonNullList<ItemStack> addCocoonLoot(IButterflyCocoon cocoon);
interface Nursery extends IGreenhouseComponent {
void addCocoonLoot(IButterflyCocoon cocoon, NonNullList<ItemStack> loot);
}
interface Active extends IGreenhouseComponent {
@@ -5,34 +5,24 @@
******************************************************************************/
package forestry.api.multiblock;
import java.util.List;
import java.util.Set;
import forestry.api.climate.IClimateControlProvider;
import forestry.api.climate.IClimateRegion;
import forestry.api.core.ICamouflageHandler;
import forestry.api.greenhouse.EnumGreenhouseEventType;
import forestry.api.greenhouse.IGreenhouseHousing;
import forestry.api.greenhouse.IGreenhouseLogic;
import forestry.api.greenhouse.IInternalBlock;
import forestry.api.lepidopterology.IButterfly;
public interface IGreenhouseController extends IMultiblockController, IGreenhouseHousing, ICamouflageHandler, IClimateControlProvider {
/**
* Handle change events.
*/
void onChange(EnumGreenhouseEventType type, Object event);
/**
* @return The logics of the greenhouse.
*/
List<IGreenhouseLogic> getLogics();
/**
* @return All internal blocks of the greenhouse.
*/
Set<IInternalBlock> getInternalBlocks();
boolean spawnButterfly(IButterfly butterfly);
IClimateRegion getRegion();
}
@@ -1,21 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.api.multiblock;
public interface IMultiblockLogicCharcoalPile extends IMultiblockLogic {
/**
* @return the multiblock controller for this logic
*/
@Override
ICharcoalPileController getController();
}
@@ -15,6 +15,4 @@ public interface IMultiblockLogicFactory {
IMultiblockLogicFarm createFarmLogic();
IMultiblockLogicGreenhouse createGreenhouseLogic();
IMultiblockLogicCharcoalPile createCharcoalPileLogic();
}
@@ -10,6 +10,8 @@ import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* Base logic class for Multiblock-connected tile entities.
@@ -86,6 +88,7 @@ public abstract class MultiblockTileEntityBase<T extends IMultiblockLogic> exten
}
@Override
@SideOnly(Side.CLIENT)
public final void onDataPacket(NetworkManager network, SPacketUpdateTileEntity packet) {
super.onDataPacket(network, packet);
NBTTagCompound nbtData = packet.getNbtCompound();
@@ -6,6 +6,7 @@
package forestry.api.recipes;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.NonNullList;
/**
@@ -30,6 +31,11 @@ public interface IDescriptiveRecipe {
* Each inner list represents one slot's accepted ItemStacks
*/
NonNullList<NonNullList<ItemStack>> getIngredients();
NonNullList<String> getOreDicts();
ItemStack getRecipeOutput();
/**
* Must not be named the same as {@link IRecipe#getRecipeOutput()} to avoid obfuscation for recipes that implement both.
*/
ItemStack getOutput();
}
@@ -21,6 +21,8 @@ public interface IFabricatorRecipe extends IForestryRecipe {
* Each inner list represents one slot's accepted ItemStacks
*/
NonNullList<NonNullList<ItemStack>> getIngredients();
NonNullList<String> getOreDicts();
/**
* @return the width of ingredients in the crafting grid to create this recipe.
@@ -40,8 +40,9 @@ import forestry.core.config.Constants;
import forestry.core.errors.EnumErrorCode;
import forestry.core.network.IStreamable;
import forestry.core.network.PacketBufferForestry;
import forestry.core.proxy.Proxies;
import forestry.core.utils.Log;
import forestry.core.utils.NetworkUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
@@ -50,6 +51,8 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
@@ -457,9 +460,9 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
if (world != null && !world.isRemote) {
if (housing instanceof Entity) {
Entity housingEntity = (Entity) this.housing;
Proxies.net.sendNetworkPacket(new PacketBeeLogicActiveEntity(this.housing, housingEntity), housingEntity.getPosition(), world);
NetworkUtil.sendNetworkPacket(new PacketBeeLogicActiveEntity(this.housing, housingEntity), housingEntity.getPosition(), world);
} else {
Proxies.net.sendNetworkPacket(new PacketBeeLogicActive(housing), housing.getCoordinates(), world);
NetworkUtil.sendNetworkPacket(new PacketBeeLogicActive(housing), housing.getCoordinates(), world);
}
}
}
@@ -469,9 +472,9 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
World world = housing.getWorldObj();
if (world != null && !world.isRemote) {
if (housing instanceof TileEntity) {
Proxies.net.sendToPlayer(new PacketBeeLogicActive(housing), player);
NetworkUtil.sendToPlayer(new PacketBeeLogicActive(housing), player);
} else if (housing instanceof Entity) {
Proxies.net.sendToPlayer(new PacketBeeLogicActiveEntity(housing, (Entity) housing), player);
NetworkUtil.sendToPlayer(new PacketBeeLogicActiveEntity(housing, (Entity) housing), player);
}
}
}
@@ -486,11 +489,13 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
}
@Override
@SideOnly(Side.CLIENT)
public boolean canDoBeeFX() {
return !Proxies.common.getClientInstance().isGamePaused() && active;
return !Minecraft.getMinecraft().isGamePaused() && active;
}
@Override
@SideOnly(Side.CLIENT)
public void doBeeFX() {
if (queen != null) {
queen.doFX(effectData, housing);
@@ -498,7 +503,6 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
}
@Override
public List<BlockPos> getFlowerPositions() {
return hasFlowersCache.getFlowerCoords();
}
@@ -65,8 +65,6 @@ import forestry.apiculture.multiblock.TileAlvearySieve;
import forestry.apiculture.multiblock.TileAlvearyStabiliser;
import forestry.apiculture.multiblock.TileAlvearySwarmer;
import forestry.apiculture.network.PacketRegistryApiculture;
import forestry.apiculture.proxy.ProxyApiculture;
import forestry.apiculture.proxy.ProxyApicultureClient;
import forestry.apiculture.tiles.TileCandle;
import forestry.apiculture.tiles.TileHive;
import forestry.apiculture.worldgen.HiveDecorator;
@@ -99,10 +97,14 @@ import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
import net.minecraft.block.BlockFlower;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.init.PotionTypes;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionType;
import net.minecraft.potion.PotionUtils;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
@@ -113,11 +115,11 @@ import net.minecraft.world.storage.loot.LootTableList;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.brewing.BrewingRecipeRegistry;
import net.minecraftforge.common.capabilities.CapabilityManager;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
@@ -127,21 +129,21 @@ import net.minecraftforge.fml.relauncher.SideOnly;
@ForestryPlugin(pluginID = ForestryPluginUids.APICULTURE, name = "Apiculture", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.apiculture.description")
public class PluginApiculture extends BlankForestryPlugin {
@SuppressWarnings("NullableProblems")
@SidedProxy(clientSide = "forestry.apiculture.proxy.ProxyApicultureClient", serverSide = "forestry.apiculture.proxy.ProxyApiculture")
public static ProxyApiculture proxy;
private static final String CONFIG_CATEGORY = "apiculture";
public static String beekeepingMode = "NORMAL";
private static float secondPrincessChance = 0;
public static final int ticksPerBeeWorkCycle = 550;
@SideOnly(Side.CLIENT)
@Nullable
private static TextureAtlasSprite beeSprite;
@Nullable
private static ItemRegistryApiculture items;
@Nullable
private static BlockRegistryApiculture blocks;
@Nullable
private static HiveRegistry hiveRegistry;
public static String beekeepingMode = "NORMAL";
public static final int ticksPerBeeWorkCycle = 550;
@Nullable
public static VillagerRegistry.VillagerProfession villagerApiarist;
@@ -160,6 +162,12 @@ public class PluginApiculture extends BlankForestryPlugin {
return hiveRegistry;
}
@SideOnly(Side.CLIENT)
public static TextureAtlasSprite getBeeSprite() {
Preconditions.checkState(beeSprite != null, "Bee sprite has not been registered");
return beeSprite;
}
@Override
public void setupAPI() {
super.setupAPI();
@@ -499,6 +507,7 @@ public class PluginApiculture extends BlankForestryPlugin {
'#', items.honeydew,
'X', items.royalJelly,
'Y', fluidItems.waxCapsuleEmpty);
}
// / CAPSULES
@@ -757,6 +766,17 @@ public class PluginApiculture extends BlankForestryPlugin {
'X', OreDictUtil.SLAB_WOOD,
'#', OreDictUtil.PLANK_WOOD,
'C', OreDictUtil.BEE_COMB);
// BREWING RECIPES
BrewingRecipeRegistry.addRecipe(
PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), PotionTypes.AWKWARD),
items.pollenCluster.get(EnumPollenCluster.NORMAL, 1),
PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), PotionTypes.HEALING));
BrewingRecipeRegistry.addRecipe(
PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), PotionTypes.AWKWARD),
items.pollenCluster.get(EnumPollenCluster.CRYSTALLINE, 1),
PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), PotionTypes.REGENERATION));
}
private static void registerBeehiveDrops() {
@@ -901,7 +921,7 @@ public class PluginApiculture extends BlankForestryPlugin {
for (int i = 0; i < ParticleSnow.sprites.length; i++) {
ParticleSnow.sprites[i] = event.getMap().registerSprite(new ResourceLocation("forestry:entity/particles/snow." + (i + 1)));
}
ProxyApicultureClient.beeSprite = event.getMap().registerSprite(new ResourceLocation("forestry:entity/particles/swarm_bee"));
beeSprite = event.getMap().registerSprite(new ResourceLocation("forestry:entity/particles/swarm_bee"));
}
private static class EndFlowerAcceptableRule implements IFlowerAcceptableRule {
@@ -31,10 +31,11 @@ import forestry.apiculture.multiblock.TileAlvearyStabiliser;
import forestry.apiculture.multiblock.TileAlvearySwarmer;
import forestry.apiculture.network.packets.PacketAlvearyChange;
import forestry.core.blocks.BlockStructure;
import forestry.core.proxy.Proxies;
import forestry.core.tiles.IActivatable;
import forestry.core.tiles.TileUtil;
import forestry.core.utils.BlockUtil;
import forestry.core.utils.NetworkUtil;
import forestry.core.utils.Translator;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.properties.PropertyEnum;
@@ -42,13 +43,16 @@ import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -221,7 +225,7 @@ public abstract class BlockAlveary extends BlockStructure implements IStateMappe
@Override
@SideOnly(Side.CLIENT)
public void registerStateMapper() {
Proxies.render.registerStateMapper(this, new AlvearyStateMapper(getAlvearyType()));
ModelLoader.setCustomStateMapper(this, new AlvearyStateMapper(getAlvearyType()));
}
@SideOnly(Side.CLIENT)
@@ -244,15 +248,18 @@ public abstract class BlockAlveary extends BlockStructure implements IStateMappe
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
TileEntity tileEntity = worldIn.getTileEntity(pos);
if (tileEntity instanceof TileAlveary) {
TileAlveary tileAlveary = (TileAlveary) tileEntity;
TileUtil.actOnTile(worldIn, pos, TileAlveary.class, tileAlveary -> {
// We must check that the slabs on top were not removed
IAlvearyControllerInternal alveary = tileAlveary.getMultiblockLogic().getController();
alveary.reassemble();
BlockPos referenceCoord = alveary.getReferenceCoord();
Proxies.net.sendNetworkPacket(new PacketAlvearyChange(referenceCoord), referenceCoord, worldIn);
}
NetworkUtil.sendNetworkPacket(new PacketAlvearyChange(referenceCoord), referenceCoord, worldIn);
});
}
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) {
tooltip.add(Translator.translateToLocal("tile.for.alveary.tooltip"));
}
}
@@ -29,6 +29,7 @@ import forestry.apiculture.MaterialBeehive;
import forestry.apiculture.PluginApiculture;
import forestry.apiculture.tiles.TileHive;
import forestry.core.blocks.IBlockWithMeta;
import forestry.core.tiles.TileUtil;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
@@ -85,21 +86,13 @@ public class BlockBeeHives extends BlockContainer implements IItemModelRegister,
@Override
public void onBlockClicked(World world, BlockPos pos, EntityPlayer player) {
super.onBlockClicked(world, pos, player);
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof IHiveTile) {
IHiveTile hive = (IHiveTile) tile;
hive.onAttack(world, pos, player);
}
TileUtil.actOnTile(world, pos, IHiveTile.class, tile -> tile.onAttack(world, pos, player));
}
@Override
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
boolean canHarvest = canHarvestBlock(world, pos, player);
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof IHiveTile) {
IHiveTile hive = (IHiveTile) tile;
hive.onBroken(world, pos, player, canHarvest);
}
TileUtil.actOnTile(world, pos, IHiveTile.class, tile -> tile.onBroken(world, pos, player, canHarvest));
}
@Override
@@ -140,8 +140,8 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile
@Override
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity instanceof TileCandle && ((TileCandle) tileEntity).isLit()) {
TileCandle candle = TileUtil.getTile(world, pos, TileCandle.class);
if (candle != null && candle.isLit()) {
return 14;
}
return 0;
@@ -154,12 +154,10 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
TileEntity tileEntity = worldIn.getTileEntity(pos);
if (!(tileEntity instanceof TileCandle)) {
TileCandle tileCandle = TileUtil.getTile(worldIn, pos, TileCandle.class);
if (tileCandle == null) {
return false;
}
TileCandle tileCandle = (TileCandle) tileEntity;
final boolean isLit = tileCandle.isLit();
boolean flag = false;
@@ -297,6 +295,7 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) {
TileCandle tileCandle = TileUtil.getTile(worldIn, pos, TileCandle.class);
if (tileCandle != null && tileCandle.isLit()) {
@@ -10,28 +10,26 @@
******************************************************************************/
package forestry.apiculture.blocks;
import javax.annotation.Nullable;
import forestry.apiculture.tiles.TileApiaristChest;
import forestry.core.blocks.IBlockTypeTesr;
import forestry.core.blocks.IMachinePropertiesTesr;
import forestry.core.blocks.MachinePropertiesTesr;
import forestry.core.config.Constants;
import forestry.core.proxy.Proxies;
import forestry.core.tiles.TileForestry;
import forestry.core.tiles.TileNaturalistChest;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.util.math.AxisAlignedBB;
public enum BlockTypeApicultureTesr implements IBlockTypeTesr {
APIARIST_CHEST(TileApiaristChest.class, "api_chest", Proxies.render.getRenderChest("apiaristchest"), TileNaturalistChest.chestBoundingBox);
APIARIST_CHEST(TileApiaristChest.class, "api_chest", "apiaristchest", TileNaturalistChest.chestBoundingBox);
public static final BlockTypeApicultureTesr[] VALUES = values();
private final IMachinePropertiesTesr<?> machineProperties;
<T extends TileForestry> BlockTypeApicultureTesr(Class<T> teClass, String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, AxisAlignedBB boundingBox) {
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, boundingBox, Constants.MOD_ID + ":blocks/" + name + ".0", false);
<T extends TileApiaristChest> BlockTypeApicultureTesr(Class<T> teClass, String name, String textureName, AxisAlignedBB boundingBox) {
MachinePropertiesTesr<T> machineProperties = new MachinePropertiesTesr<>(teClass, name, boundingBox, Constants.MOD_ID + ":blocks/" + name + ".0", false);
Proxies.render.setRenderChest(machineProperties, textureName);
this.machineProperties = machineProperties;
}
@Override
@@ -29,9 +29,13 @@ import forestry.apiculture.inventory.IApiaryInventory;
import forestry.apiculture.inventory.InventoryApiary;
import forestry.core.inventory.IInventoryAdapter;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implements IApiary {
@@ -98,13 +102,14 @@ public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implement
}
@Override
public Object getGui(EntityPlayer player, int data) {
@SideOnly(Side.CLIENT)
public GuiContainer getGui(EntityPlayer player, int data) {
ContainerMinecartBeehouse container = new ContainerMinecartBeehouse(player.inventory, this, true);
return new GuiBeeHousing<>(this, container, GuiBeeHousing.Icon.APIARY);
}
@Override
public Object getContainer(EntityPlayer player, int data) {
public Container getContainer(EntityPlayer player, int data) {
return new ContainerMinecartBeehouse(player.inventory, this, true);
}
}
@@ -33,10 +33,9 @@ import forestry.core.owner.GameProfileDataSerializer;
import forestry.core.owner.IOwnedTile;
import forestry.core.owner.IOwnerHandler;
import forestry.core.owner.OwnerHandler;
import forestry.core.proxy.Proxies;
import forestry.core.tiles.IClimatised;
import forestry.core.utils.ClimateUtil;
import net.minecraft.entity.item.EntityMinecart;
import forestry.core.utils.NetworkUtil;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.datasync.DataParameter;
import net.minecraft.network.datasync.EntityDataManager;
@@ -46,7 +45,7 @@ import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContainerForestry implements IBeeHousing, IOwnedTile, IGuiBeeHousingDelegate, IClimatised, IStreamableGui {
private static final DataParameter<Optional<GameProfile>> OWNER = EntityDataManager.createKey(EntityMinecart.class, GameProfileDataSerializer.INSTANCE);
private static final DataParameter<Optional<GameProfile>> OWNER = EntityDataManager.createKey(EntityMinecartBeeHousingBase.class, GameProfileDataSerializer.INSTANCE);
private static final Random random = new Random();
private static final int beeFXInterval = 4;
@@ -192,7 +191,7 @@ public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContain
} else {
if (needsActiveUpdate) {
IForestryPacketServer packet = new PacketBeeLogicEntityRequest(this);
Proxies.net.sendToServer(packet);
NetworkUtil.sendToServer(packet);
needsActiveUpdate = false;
}
@@ -23,9 +23,13 @@ import forestry.apiculture.gui.ContainerMinecartBeehouse;
import forestry.apiculture.gui.GuiBeeHousing;
import forestry.core.inventory.IInventoryAdapter;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class EntityMinecartBeehouse extends EntityMinecartBeeHousingBase {
private static final IBeeModifier beeModifier = new BeehouseBeeModifier();
@@ -80,13 +84,14 @@ public class EntityMinecartBeehouse extends EntityMinecartBeeHousingBase {
}
@Override
public Object getGui(EntityPlayer player, int data) {
@SideOnly(Side.CLIENT)
public GuiContainer getGui(EntityPlayer player, int data) {
ContainerMinecartBeehouse container = new ContainerMinecartBeehouse(player.inventory, this, false);
return new GuiBeeHousing<>(this, container, GuiBeeHousing.Icon.BEE_HOUSE);
}
@Override
public Object getContainer(EntityPlayer player, int data) {
public Container getContainer(EntityPlayer player, int data) {
return new ContainerMinecartBeehouse(player.inventory, this, false);
}
}
@@ -10,7 +10,7 @@
******************************************************************************/
package forestry.apiculture.entities;
import forestry.apiculture.proxy.ProxyApicultureClient;
import forestry.apiculture.PluginApiculture;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.entity.Entity;
@@ -23,7 +23,7 @@ public class ParticleBeeExplore extends Particle {
public ParticleBeeExplore(World world, Vec3d origin, BlockPos destination, int color) {
super(world, origin.xCoord, origin.yCoord, origin.zCoord, 0.0D, 0.0D, 0.0D);
setParticleTexture(ProxyApicultureClient.beeSprite);
setParticleTexture(PluginApiculture.getBeeSprite());
this.origin = origin;
this.motionX = (destination.getX() + 0.5 - this.posX) * 0.015;
@@ -10,7 +10,7 @@
******************************************************************************/
package forestry.apiculture.entities;
import forestry.apiculture.proxy.ProxyApicultureClient;
import forestry.apiculture.PluginApiculture;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.entity.Entity;
@@ -24,7 +24,7 @@ public class ParticleBeeRoundTrip extends Particle {
public ParticleBeeRoundTrip(World world, Vec3d origin, BlockPos destination, int color) {
super(world, origin.xCoord, origin.yCoord, origin.zCoord, 0.0D, 0.0D, 0.0D);
setParticleTexture(ProxyApicultureClient.beeSprite);
setParticleTexture(PluginApiculture.getBeeSprite());
this.origin = origin;
this.destination = destination;
@@ -10,7 +10,7 @@
******************************************************************************/
package forestry.apiculture.entities;
import forestry.apiculture.proxy.ProxyApicultureClient;
import forestry.apiculture.PluginApiculture;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.entity.Entity;
@@ -23,7 +23,7 @@ public class ParticleBeeTargetEntity extends Particle {
public ParticleBeeTargetEntity(World world, Vec3d origin, Entity entity, int color) {
super(world, origin.xCoord, origin.yCoord, origin.zCoord, 0.0D, 0.0D, 0.0D);
setParticleTexture(ProxyApicultureClient.beeSprite);
setParticleTexture(PluginApiculture.getBeeSprite());
this.origin = origin;
this.entity = entity;
@@ -52,19 +52,21 @@ import forestry.core.errors.EnumErrorCode;
import forestry.core.genetics.Chromosome;
import forestry.core.genetics.GenericRatings;
import forestry.core.genetics.IndividualLiving;
import forestry.core.tiles.TileUtil;
import forestry.core.utils.GeneticsUtil;
import forestry.core.utils.Translator;
import forestry.core.utils.VectUtil;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class Bee extends IndividualLiving implements IBee {
@@ -182,6 +184,7 @@ public class Bee extends IndividualLiving implements IBee {
}
@Override
@SideOnly(Side.CLIENT)
public IEffectData[] doFX(IEffectData[] storedData, IBeeHousing housing) {
IAlleleBeeEffect effect = genome.getEffect();
@@ -202,6 +205,7 @@ public class Bee extends IndividualLiving implements IBee {
return storedData;
}
@SideOnly(Side.CLIENT)
private IEffectData doFX(IAlleleBeeEffect effect, IEffectData storedData, IBeeHousing housing) {
return effect.doFX(genome, storedData, housing);
}
@@ -662,10 +666,8 @@ public class Bee extends IndividualLiving implements IBee {
for (int i = 0; i < 20; i++) {
BlockPos randomPos = VectUtil.getRandomPositionInArea(random, area);
BlockPos blockPos = VectUtil.add(housingPos, randomPos, offset);
TileEntity tile = world.getTileEntity(blockPos);
if (tile instanceof ICheckPollinatable) {
ICheckPollinatable pitcher = (ICheckPollinatable) tile;
ICheckPollinatable pitcher = TileUtil.getTile(world, blockPos, ICheckPollinatable.class);
if (pitcher != null) {
if (genome.getFlowerProvider().isAcceptedPollinatable(world, pitcher)) {
pollen = pitcher.getPollen();
}
@@ -717,7 +719,7 @@ public class Bee extends IndividualLiving implements IBee {
continue;
}
IPollinatable realPollinatable = GeneticsUtil.getOrCreatePollinatable(housing.getOwner(), world, posBlock);
IPollinatable realPollinatable = GeneticsUtil.getOrCreatePollinatable(housing.getOwner(), world, posBlock, Config.pollinateVanillaTrees);
if (realPollinatable != null) {
realPollinatable.mateWith(pollen);
@@ -18,6 +18,7 @@ import forestry.api.apiculture.IAlleleBeeSpecies;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IJubilanceProvider;
import forestry.core.tiles.TileUtil;
import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
@@ -39,7 +40,7 @@ public class JubilanceRequiresResource implements IJubilanceProvider {
TileEntity tile;
do {
pos = pos.down();
tile = world.getTileEntity(pos);
tile = TileUtil.getTile(world, pos);
} while (tile instanceof IBeeHousing && pos.getY() > 0);
IBlockState blockState = world.getBlockState(pos);
@@ -183,6 +183,7 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
}
@Override
@SideOnly(Side.CLIENT)
public ModelResourceLocation getModel(EnumBeeType type) {
return beeModelProvider.getModel(type);
}
@@ -21,12 +21,14 @@ import forestry.api.apiculture.IBeekeepingLogic;
import forestry.api.genetics.IEffectData;
import forestry.core.config.Constants;
import forestry.core.genetics.alleles.AlleleCategorized;
import forestry.core.proxy.Proxies;
import forestry.core.render.ParticleRender;
import forestry.core.utils.VectUtil;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public abstract class AlleleEffect extends AlleleCategorized implements IAlleleBeeEffect {
protected AlleleEffect(String valueName, boolean isDominant) {
@@ -49,11 +51,12 @@ public abstract class AlleleEffect extends AlleleCategorized implements IAlleleB
}
@Override
@SideOnly(Side.CLIENT)
public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
IBeekeepingLogic beekeepingLogic = housing.getBeekeepingLogic();
List<BlockPos> flowerPositions = beekeepingLogic.getFlowerPositions();
Proxies.render.addBeeHiveFX(housing, genome, flowerPositions);
ParticleRender.addBeeHiveFX(housing, genome, flowerPositions);
return storedData;
}
@@ -16,10 +16,12 @@ import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.genetics.IEffectData;
import forestry.core.proxy.Proxies;
import forestry.core.render.ParticleRender;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class AlleleEffectIgnition extends AlleleEffectThrottled {
private static final int ignitionChance = 50;
@@ -63,13 +65,14 @@ public class AlleleEffectIgnition extends AlleleEffectThrottled {
}
@Override
@SideOnly(Side.CLIENT)
public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorldObj();
if (world.rand.nextInt(2) != 0) {
super.doFX(genome, storedData, housing);
} else {
Vec3d beeFXCoordinates = housing.getBeeFXCoordinates();
Proxies.render.addEntityIgnitionFX(world, beeFXCoordinates.xCoord, beeFXCoordinates.yCoord + 0.5, beeFXCoordinates.zCoord);
ParticleRender.addEntityIgnitionFX(world, beeFXCoordinates.xCoord, beeFXCoordinates.yCoord + 0.5, beeFXCoordinates.zCoord);
}
return storedData;
}
@@ -18,7 +18,7 @@ import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.genetics.IEffectData;
import forestry.core.proxy.Proxies;
import forestry.core.render.ParticleRender;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.IMob;
import net.minecraft.potion.Potion;
@@ -26,6 +26,8 @@ import net.minecraft.potion.PotionEffect;
import net.minecraft.potion.PotionUtils;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class AlleleEffectPotion extends AlleleEffectThrottled {
@@ -84,13 +86,14 @@ public class AlleleEffectPotion extends AlleleEffectThrottled {
}
@Override
@SideOnly(Side.CLIENT)
public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorldObj();
if (world.rand.nextBoolean()) {
super.doFX(genome, storedData, housing);
} else {
Vec3d beeFXCoordinates = housing.getBeeFXCoordinates();
Proxies.render.addEntityPotionFX(world, beeFXCoordinates.xCoord, beeFXCoordinates.yCoord + 0.5, beeFXCoordinates.zCoord, potionFXColor);
ParticleRender.addEntityPotionFX(world, beeFXCoordinates.xCoord, beeFXCoordinates.yCoord + 0.5, beeFXCoordinates.zCoord, potionFXColor);
}
return storedData;
}
@@ -18,6 +18,7 @@ import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.genetics.IEffectData;
import forestry.apiculture.blocks.BlockAlveary;
import forestry.core.tiles.TileUtil;
import forestry.core.utils.BlockUtil;
import forestry.core.utils.DamageSourceForestry;
import forestry.core.utils.VectUtil;
@@ -94,7 +95,7 @@ public class AlleleEffectRadioactive extends AlleleEffectThrottled {
continue;
}
TileEntity tile = world.getTileEntity(posBlock);
TileEntity tile = TileUtil.getTile(world, posBlock);
if (tile instanceof IBeeHousing) {
continue;
}
@@ -14,7 +14,7 @@ import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.core.EnumTemperature;
import forestry.api.genetics.IEffectData;
import forestry.core.proxy.Proxies;
import forestry.core.render.ParticleRender;
import forestry.core.utils.VectUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSnow;
@@ -24,6 +24,8 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class AlleleEffectSnowing extends AlleleEffectThrottled {
@@ -78,6 +80,7 @@ public class AlleleEffectSnowing extends AlleleEffectThrottled {
}
@Override
@SideOnly(Side.CLIENT)
public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
if (housing.getWorldObj().rand.nextInt(3) == 0) {
Vec3i area = getModifiedArea(genome, housing);
@@ -87,7 +90,7 @@ public class AlleleEffectSnowing extends AlleleEffectThrottled {
World world = housing.getWorldObj();
BlockPos spawn = VectUtil.getRandomPositionInArea(world.rand, area).add(coordinates).add(offset);
Proxies.render.addEntitySnowFX(world, spawn.getX(), spawn.getY(), spawn.getZ());
ParticleRender.addEntitySnowFX(world, spawn.getX(), spawn.getY(), spawn.getZ());
return storedData;
} else {
return super.doFX(genome, storedData, housing);
@@ -16,7 +16,7 @@ import forestry.core.gui.ContainerItemInventory;
import forestry.core.gui.IGuiSelectable;
import forestry.core.gui.slots.SlotFiltered;
import forestry.core.gui.slots.SlotOutput;
import forestry.core.proxy.Proxies;
import forestry.core.utils.NetworkUtil;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
@@ -48,7 +48,7 @@ public class ContainerImprinter extends ContainerItemInventory<ItemInventoryImpr
}
PacketImprintSelectionResponse packetResponse = new PacketImprintSelectionResponse(inventory.getPrimaryIndex(), inventory.getSecondaryIndex());
Proxies.net.sendToPlayer(packetResponse, player);
NetworkUtil.sendToPlayer(packetResponse, player);
}
public void setSelection(int primary, int secondary) {
@@ -22,8 +22,8 @@ import forestry.core.config.Constants;
import forestry.core.gui.GuiForestry;
import forestry.core.gui.GuiUtil;
import forestry.core.network.packets.PacketGuiSelectRequest;
import forestry.core.proxy.Proxies;
import forestry.core.render.ColourProperties;
import forestry.core.utils.NetworkUtil;
import forestry.core.utils.Translator;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
@@ -127,7 +127,7 @@ public class GuiImprinter extends GuiForestry<ContainerImprinter> {
}
private static void sendSelectionChange(int index, int advance) {
Proxies.net.sendToServer(new PacketGuiSelectRequest(index, advance));
NetworkUtil.sendToServer(new PacketGuiSelectRequest(index, advance));
}
@Override
@@ -17,8 +17,7 @@ import java.util.Locale;
import forestry.core.gui.tooltips.ToolTip;
import forestry.core.gui.widgets.Widget;
import forestry.core.gui.widgets.WidgetManager;
import forestry.core.proxy.Proxies;
import forestry.core.render.TextureManager;
import forestry.core.render.TextureManagerForestry;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraftforge.common.BiomeDictionary;
@@ -47,7 +46,7 @@ public class HabitatSlot extends Widget {
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIcon() {
return TextureManager.getInstance().getDefault(iconIndex);
return TextureManagerForestry.getInstance().getDefault(iconIndex);
}
public void setActive(Collection<BiomeDictionary.Type> biomes) {
@@ -62,7 +61,7 @@ public class HabitatSlot extends Widget {
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
}
Proxies.render.bindTexture(TextureManager.getInstance().getGuiTextureMap());
TextureManagerForestry.getInstance().bindGuiTextureMap();
manager.gui.drawTexturedModalRect(startX + xPos, startY + yPos, getIcon(), 16, 16);
}
}
@@ -54,4 +54,11 @@ public enum EnumHoneyComb {
public boolean isSecret() {
return secret;
}
public static EnumHoneyComb get(int meta){
if(meta >= VALUES.length){
meta = 0;
}
return VALUES[meta];
}
}
@@ -17,7 +17,8 @@ import java.util.Set;
import forestry.api.apiculture.IBee;
import forestry.apiculture.network.packets.PacketHabitatBiomePointer;
import forestry.core.proxy.Proxies;
import forestry.apiculture.render.TextureHabitatLocator;
import forestry.core.utils.NetworkUtil;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -72,7 +73,9 @@ public class HabitatLocatorLogic {
removeInvalidBiomes(currentBiome, targetBiomes);
// reset the locator coordinates
Proxies.render.setHabitatLocatorTexture(null, null);
if (player.world.isRemote) {
TextureHabitatLocator.getInstance().setTargetCoordinates(null);
}
}
public void onUpdate(World world, Entity player) {
@@ -93,7 +96,7 @@ public class HabitatLocatorLogic {
// send an update if we find the biome
if (target != null && player instanceof EntityPlayerMP) {
Proxies.net.sendToPlayer(new PacketHabitatBiomePointer(target), (EntityPlayerMP) player);
NetworkUtil.sendToPlayer(new PacketHabitatBiomePointer(target), (EntityPlayerMP) player);
biomeFound = true;
}
}
@@ -23,6 +23,7 @@ import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleSpecies;
import forestry.apiculture.genetics.BeeGenome;
import forestry.apiculture.genetics.DefaultBeeModelProvider;
import forestry.core.config.Config;
import forestry.core.genetics.ItemGE;
import forestry.core.items.IColoredItem;
@@ -79,6 +80,7 @@ public class ItemBeeGE extends ItemGE implements IColoredItem {
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemstack, EntityPlayer player, List<String> list, boolean flag) {
if (itemstack.getTagCompound() == null) {
return;
@@ -141,9 +143,13 @@ public class ItemBeeGE extends ItemGE implements IColoredItem {
manager.registerItemModel(item, new BeeMeshDefinition());
}
@SideOnly(Side.CLIENT)
private class BeeMeshDefinition implements ItemMeshDefinition {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
if (!stack.hasTagCompound()) { // villager trade wildcard bees
return DefaultBeeModelProvider.instance.getModel(type);
}
IAlleleBeeSpecies species = (IAlleleBeeSpecies) getSpecies(stack);
return species.getModel(type);
}
@@ -26,9 +26,11 @@ import forestry.core.items.ItemWithGui;
import forestry.core.utils.ClimateUtil;
import forestry.core.utils.Translator;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
@@ -66,6 +68,7 @@ public class ItemHabitatLocator extends ItemWithGui implements ISpriteRegister {
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemstack, EntityPlayer player, List<String> list, boolean flag) {
super.addInformation(itemstack, player, list, flag);
@@ -81,12 +84,13 @@ public class ItemHabitatLocator extends ItemWithGui implements ISpriteRegister {
}
@Override
public Object getGui(EntityPlayer player, ItemStack heldItem, int data) {
@SideOnly(Side.CLIENT)
public GuiContainer getGui(EntityPlayer player, ItemStack heldItem, int data) {
return new GuiHabitatLocator(player, new ItemInventoryHabitatLocator(player, heldItem));
}
@Override
public Object getContainer(EntityPlayer player, ItemStack heldItem, int data) {
public Container getContainer(EntityPlayer player, ItemStack heldItem, int data) {
return new ContainerHabitatLocator(player, new ItemInventoryHabitatLocator(player, heldItem));
}
}
@@ -23,6 +23,8 @@ import forestry.core.items.ItemForestry;
import forestry.core.utils.Translator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ItemHiveFrame extends ItemForestry implements IHiveFrame {
@@ -52,6 +54,7 @@ public class ItemHiveFrame extends ItemForestry implements IHiveFrame {
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
super.addInformation(stack, playerIn, tooltip, advanced);
beeModifier.addInformation(stack, playerIn, tooltip, advanced);
@@ -78,6 +81,7 @@ public class ItemHiveFrame extends ItemForestry implements IHiveFrame {
return this.geneticDecay;
}
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
tooltip.add(Translator.translateToLocalFormatted("item.for.bee.modifier.production", production));
tooltip.add(Translator.translateToLocalFormatted("item.for.bee.modifier.genetic.decay", geneticDecay));
@@ -48,31 +48,31 @@ public class ItemHoneyComb extends ItemForestry implements IColoredItem {
@Override
public void registerModel(Item item, IModelManager manager) {
for (int i = 0; i < EnumHoneyComb.VALUES.length; i++) {
manager.registerItemModel(item, i, "beecombs/" + EnumHoneyComb.VALUES[i].name);
manager.registerItemModel(item, i, "beecombs/" + EnumHoneyComb.get(i).name);
}
}
@Override
public String getUnlocalizedName(ItemStack stack) {
EnumHoneyComb honeyComb = EnumHoneyComb.VALUES[stack.getItemDamage()];
EnumHoneyComb honeyComb = EnumHoneyComb.get(stack.getItemDamage());
return super.getUnlocalizedName(stack) + "." + honeyComb.name;
}
@Override
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> subItems) {
for (int i = 0; i < EnumHoneyComb.VALUES.length; i++) {
EnumHoneyComb honeyComb = EnumHoneyComb.VALUES[i];
EnumHoneyComb honeyComb = EnumHoneyComb.get(i);
if (!honeyComb.isSecret() || Config.isDebug) {
subItems.add(new ItemStack(this, 1, i));
}
}
}
@Nullable
private static EnumHoneyComb getRandomCombType(Random random, boolean includeSecret) {
List<EnumHoneyComb> validCombs = new ArrayList<>(EnumHoneyComb.VALUES.length);
for (int i = 0; i < EnumHoneyComb.VALUES.length; i++) {
EnumHoneyComb honeyComb = EnumHoneyComb.VALUES[i];
EnumHoneyComb honeyComb = EnumHoneyComb.get(i);
if (!honeyComb.isSecret() || includeSecret) {
validCombs.add(honeyComb);
}
@@ -99,7 +99,7 @@ public class ItemHoneyComb extends ItemForestry implements IColoredItem {
@Override
public int getColorFromItemstack(ItemStack itemstack, int tintIndex) {
EnumHoneyComb honeyComb = EnumHoneyComb.VALUES[itemstack.getItemDamage()];
EnumHoneyComb honeyComb = EnumHoneyComb.get(itemstack.getItemDamage());
if (tintIndex == 1) {
return honeyComb.primaryColor;
} else {
@@ -15,8 +15,12 @@ import forestry.apiculture.gui.ContainerImprinter;
import forestry.apiculture.gui.GuiImprinter;
import forestry.apiculture.inventory.ItemInventoryImprinter;
import forestry.core.items.ItemWithGui;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ItemImprinter extends ItemWithGui {
public ItemImprinter() {
@@ -24,12 +28,13 @@ public class ItemImprinter extends ItemWithGui {
}
@Override
public Object getGui(EntityPlayer player, ItemStack heldItem, int data) {
@SideOnly(Side.CLIENT)
public GuiContainer getGui(EntityPlayer player, ItemStack heldItem, int data) {
return new GuiImprinter(player.inventory, new ItemInventoryImprinter(player, heldItem));
}
@Override
public Object getContainer(EntityPlayer player, ItemStack heldItem, int data) {
public Container getContainer(EntityPlayer player, ItemStack heldItem, int data) {
return new ContainerImprinter(player.inventory, new ItemInventoryImprinter(player, heldItem));
}
}
@@ -6,13 +6,13 @@ import forestry.api.apiculture.ApicultureCapabilities;
import forestry.api.apiculture.IHiveTile;
import forestry.api.core.Tabs;
import forestry.core.items.ItemForestry;
import forestry.core.proxy.Proxies;
import forestry.core.render.ParticleRender;
import forestry.core.tiles.TileUtil;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
@@ -77,13 +77,12 @@ public class ItemSmoker extends ItemForestry {
Vec3d scaledOffset = handOffset.scale(1.0 / distance);
Vec3d smokePos = lookDistance.add(entity.getPositionVector()).add(scaledOffset);
Proxies.render.addEntitySmokeFX(world, smokePos.xCoord, smokePos.yCoord + 1, smokePos.zCoord);
BlockPos blockPos = new BlockPos(smokePos.xCoord, smokePos.yCoord + 1, smokePos.zCoord);
TileEntity tileEntity = world.getTileEntity(blockPos);
if (tileEntity instanceof IHiveTile) {
IHiveTile hive = (IHiveTile) tileEntity;
hive.calmBees();
if (world.isRemote) {
ParticleRender.addEntitySmokeFX(world, smokePos.xCoord, smokePos.yCoord + 1, smokePos.zCoord);
}
BlockPos blockPos = new BlockPos(smokePos.xCoord, smokePos.yCoord + 1, smokePos.zCoord);
TileUtil.actOnTile(world, blockPos, IHiveTile.class, IHiveTile::calmBees);
}
@Override
@@ -95,11 +94,7 @@ public class ItemSmoker extends ItemForestry {
@Override
public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity instanceof IHiveTile) {
IHiveTile hive = (IHiveTile) tileEntity;
hive.calmBees();
}
TileUtil.actOnTile(world, pos, IHiveTile.class, IHiveTile::calmBees);
return super.onItemUseFirst(player, world, pos, side, hitX, hitY, hitZ, hand);
}
@@ -36,7 +36,7 @@ import forestry.core.multiblock.IMultiblockControllerInternal;
import forestry.core.multiblock.MultiblockValidationException;
import forestry.core.multiblock.RectangularMultiblockControllerBase;
import forestry.core.network.PacketBufferForestry;
import forestry.core.proxy.Proxies;
import forestry.core.render.ParticleRender;
import forestry.core.utils.BlockUtil;
import forestry.core.utils.ClimateUtil;
import forestry.core.utils.Translator;
@@ -47,6 +47,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class AlvearyController extends RectangularMultiblockControllerBase implements IAlvearyControllerInternal, IClimateControlled {
private final InventoryBeeHousing inventory;
@@ -256,6 +258,7 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
}
@Override
@SideOnly(Side.CLIENT)
protected void updateClient(int tickCount) {
for (IAlvearyComponent.Active activeComponent : activeComponents) {
activeComponent.updateClient(tickCount);
@@ -276,10 +279,10 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
fxY += upSpread;
// display fx on all 4 sides
Proxies.render.addEntityHoneyDustFX(world, fxX - distanceFromCenter, fxY, fxZ + leftRightSpreadFromCenter);
Proxies.render.addEntityHoneyDustFX(world, fxX + distanceFromCenter, fxY, fxZ + leftRightSpreadFromCenter);
Proxies.render.addEntityHoneyDustFX(world, fxX + leftRightSpreadFromCenter, fxY, fxZ - distanceFromCenter);
Proxies.render.addEntityHoneyDustFX(world, fxX + leftRightSpreadFromCenter, fxY, fxZ + distanceFromCenter);
ParticleRender.addEntityHoneyDustFX(world, fxX - distanceFromCenter, fxY, fxZ + leftRightSpreadFromCenter);
ParticleRender.addEntityHoneyDustFX(world, fxX + distanceFromCenter, fxY, fxZ + leftRightSpreadFromCenter);
ParticleRender.addEntityHoneyDustFX(world, fxX + leftRightSpreadFromCenter, fxY, fxZ - distanceFromCenter);
ParticleRender.addEntityHoneyDustFX(world, fxX + leftRightSpreadFromCenter, fxY, fxZ + distanceFromCenter);
}
}
}
@@ -34,11 +34,15 @@ import forestry.core.owner.IOwnerHandler;
import forestry.core.tiles.IClimatised;
import forestry.core.tiles.ITitled;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public abstract class TileAlveary extends MultiblockTileEntityForestry<MultiblockLogicAlveary> implements IBeeHousing, IAlvearyComponent, IOwnedTile, IStreamableGui, ITitled, IClimatised {
private final String unlocalizedTitle;
@@ -172,17 +176,19 @@ public abstract class TileAlveary extends MultiblockTileEntityForestry<Multibloc
}
@Override
@SideOnly(Side.CLIENT)
public void readGuiData(PacketBufferForestry data) throws IOException {
getMultiblockLogic().getController().readGuiData(data);
}
@Override
public Object getGui(EntityPlayer player, int data) {
@SideOnly(Side.CLIENT)
public GuiContainer getGui(EntityPlayer player, int data) {
return new GuiAlveary(player.inventory, this);
}
@Override
public Object getContainer(EntityPlayer player, int data) {
public Container getContainer(EntityPlayer player, int data) {
return new ContainerAlveary(player.inventory, this);
}
}
@@ -15,8 +15,8 @@ import javax.annotation.Nullable;
import forestry.api.climate.IClimateControlled;
import forestry.api.multiblock.IAlvearyComponent;
import forestry.apiculture.network.packets.PacketActiveUpdate;
import forestry.core.proxy.Proxies;
import forestry.core.tiles.IActivatable;
import forestry.core.utils.NetworkUtil;
import forestry.energy.EnergyHelper;
import forestry.energy.EnergyManager;
import forestry.energy.EnergyTransferMode;
@@ -116,7 +116,7 @@ public abstract class TileAlvearyClimatiser extends TileAlveary implements IActi
if (world.isRemote) {
world.markBlockRangeForRenderUpdate(getPos(), getPos());
} else {
Proxies.net.sendNetworkPacket(new PacketActiveUpdate(this), pos, world);
NetworkUtil.sendNetworkPacket(new PacketActiveUpdate(this), pos, world);
}
}
}
@@ -25,7 +25,9 @@ import forestry.core.fluids.Fluids;
import forestry.core.fluids.TankManager;
import forestry.core.inventory.IInventoryAdapter;
import forestry.core.tiles.ILiquidTankTile;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
@@ -34,6 +36,8 @@ import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class TileAlvearyHygroregulator extends TileAlveary implements IInventory, ILiquidTankTile, IAlvearyComponent.Climatiser {
private final HygroregulatorRecipe[] recipes;
@@ -173,12 +177,13 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
}
@Override
public Object getGui(EntityPlayer player, int data) {
@SideOnly(Side.CLIENT)
public GuiContainer getGui(EntityPlayer player, int data) {
return new GuiAlvearyHygroregulator(player.inventory, this);
}
@Override
public Object getContainer(EntityPlayer player, int data) {
public Container getContainer(EntityPlayer player, int data) {
return new ContainerAlvearyHygroregulator(player.inventory, this);
}
@@ -23,8 +23,12 @@ import forestry.apiculture.gui.GuiAlvearySieve;
import forestry.apiculture.inventory.InventoryAlvearySieve;
import forestry.core.inventory.IInventoryAdapter;
import forestry.core.inventory.watchers.ISlotPickupWatcher;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class TileAlvearySieve extends TileAlveary implements IAlvearyComponent.BeeListener {
@@ -52,12 +56,13 @@ public class TileAlvearySieve extends TileAlveary implements IAlvearyComponent.B
}
@Override
public Object getGui(EntityPlayer player, int data) {
@SideOnly(Side.CLIENT)
public GuiContainer getGui(EntityPlayer player, int data) {
return new GuiAlvearySieve(player.inventory, this);
}
@Override
public Object getContainer(EntityPlayer player, int data) {
public Container getContainer(EntityPlayer player, int data) {
return new ContainerAlvearySieve(player.inventory, this);
}
@@ -27,14 +27,18 @@ import forestry.apiculture.worldgen.Hive;
import forestry.apiculture.worldgen.HiveDecorator;
import forestry.apiculture.worldgen.HiveDescriptionSwarmer;
import forestry.core.inventory.IInventoryAdapter;
import forestry.core.proxy.Proxies;
import forestry.core.tiles.IActivatable;
import forestry.core.utils.ItemStackUtil;
import forestry.core.utils.NetworkUtil;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class TileAlvearySwarmer extends TileAlveary implements ISidedInventory, IActivatable, IAlvearyComponent.Active {
@@ -199,17 +203,18 @@ public class TileAlvearySwarmer extends TileAlveary implements ISidedInventory,
this.active = active;
if (world != null && !world.isRemote) {
Proxies.net.sendNetworkPacket(new PacketActiveUpdate(this), pos, world);
NetworkUtil.sendNetworkPacket(new PacketActiveUpdate(this), pos, world);
}
}
@Override
public Object getGui(EntityPlayer player, int data) {
@SideOnly(Side.CLIENT)
public GuiContainer getGui(EntityPlayer player, int data) {
return new GuiAlvearySwarmer(player.inventory, this);
}
@Override
public Object getContainer(EntityPlayer player, int data) {
public Container getContainer(EntityPlayer player, int data) {
return new ContainerAlvearySwarmer(player.inventory, this);
}
}
@@ -21,10 +21,18 @@ import forestry.apiculture.network.packets.PacketImprintSelectionResponse;
import forestry.core.network.IPacketRegistry;
import forestry.core.network.PacketIdClient;
import forestry.core.network.PacketIdServer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class PacketRegistryApiculture implements IPacketRegistry {
@Override
public void registerPackets() {
public void registerPacketsServer() {
PacketIdServer.BEE_LOGIC_ACTIVE_ENTITY_REQUEST.setPacketHandler(new PacketBeeLogicEntityRequest.Handler());
}
@Override
@SideOnly(Side.CLIENT)
public void registerPacketsClient() {
PacketIdClient.IMPRINT_SELECTION_RESPONSE.setPacketHandler(new PacketImprintSelectionResponse.Handler());
PacketIdClient.TILE_FORESTRY_ACTIVE.setPacketHandler(new PacketActiveUpdate.Handler());
PacketIdClient.BEE_LOGIC_ACTIVE.setPacketHandler(new PacketBeeLogicActive.Handler());
@@ -32,7 +40,5 @@ public class PacketRegistryApiculture implements IPacketRegistry {
PacketIdClient.HABITAT_BIOME_POINTER.setPacketHandler(new PacketHabitatBiomePointer.Handler());
PacketIdClient.CANDLE_UPDATE.setPacketHandler(new PacketCandleUpdate.Handler());
PacketIdClient.ALVERAY_CONTROLLER_CHANGE.setPacketHandler(new PacketAlvearyChange.Handler());
PacketIdServer.BEE_LOGIC_ACTIVE_ENTITY_REQUEST.setPacketHandler(new PacketBeeLogicEntityRequest.Handler());
}
}
@@ -18,11 +18,15 @@ import forestry.core.network.IForestryPacketClient;
import forestry.core.network.IForestryPacketHandlerClient;
import forestry.core.network.PacketBufferForestry;
import forestry.core.network.PacketIdClient;
import forestry.core.proxy.Proxies;
import forestry.core.tiles.IActivatable;
import forestry.core.tiles.TileUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class PacketActiveUpdate extends ForestryPacket implements IForestryPacketClient {
private final BlockPos pos;
@@ -44,21 +48,21 @@ public class PacketActiveUpdate extends ForestryPacket implements IForestryPacke
data.writeBoolean(active);
}
@SideOnly(Side.CLIENT)
public static class Handler implements IForestryPacketHandlerClient {
@Override
public void onPacketData(PacketBufferForestry data, EntityPlayer player) {
BlockPos pos = data.readBlockPos();
boolean active = data.readBoolean();
TileEntity tile = Proxies.common.getRenderWorld().getTileEntity(pos);
WorldClient world = Minecraft.getMinecraft().world;
TileEntity tile = TileUtil.getTile(world, pos);
if (tile instanceof IActivatable) {
((IActivatable) tile).setActive(active);
} else {
if (tile instanceof IMultiblockComponent) {
IMultiblockComponent component = (IMultiblockComponent) tile;
if (component.getMultiblockLogic().isConnected() && component.getMultiblockLogic().getController() instanceof IActivatable) {
((IActivatable) component.getMultiblockLogic().getController()).setActive(active);
}
} else if (tile instanceof IMultiblockComponent) {
IMultiblockComponent component = (IMultiblockComponent) tile;
if (component.getMultiblockLogic().isConnected() && component.getMultiblockLogic().getController() instanceof IActivatable) {
((IActivatable) component.getMultiblockLogic().getController()).setActive(active);
}
}
}
@@ -18,10 +18,11 @@ import forestry.core.network.IForestryPacketClient;
import forestry.core.network.IForestryPacketHandlerClient;
import forestry.core.network.PacketBufferForestry;
import forestry.core.network.PacketIdClient;
import forestry.core.proxy.Proxies;
import forestry.core.tiles.TileUtil;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class PacketAlvearyChange extends ForestryPacket implements IForestryPacketClient {
private final BlockPos controllerPos;
@@ -40,14 +41,12 @@ public class PacketAlvearyChange extends ForestryPacket implements IForestryPack
data.writeBlockPos(controllerPos);
}
@SideOnly(Side.CLIENT)
public static class Handler implements IForestryPacketHandlerClient {
@Override
public void onPacketData(PacketBufferForestry data, EntityPlayer player) throws IOException {
BlockPos pos = data.readBlockPos();
TileEntity tile = Proxies.common.getRenderWorld().getTileEntity(pos);
if (tile instanceof IMultiblockComponent) {
((IMultiblockComponent) tile).getMultiblockLogic().getController().reassemble();
}
TileUtil.actOnTile(player.world, pos, IMultiblockComponent.class, tile -> tile.getMultiblockLogic().getController().reassemble());
}
}
}
@@ -20,10 +20,11 @@ import forestry.core.network.IForestryPacketClient;
import forestry.core.network.IForestryPacketHandlerClient;
import forestry.core.network.PacketBufferForestry;
import forestry.core.network.PacketIdClient;
import forestry.core.proxy.Proxies;
import forestry.core.tiles.TileUtil;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class PacketBeeLogicActive extends ForestryPacket implements IForestryPacketClient {
private final BlockPos tilePos;
@@ -45,14 +46,14 @@ public class PacketBeeLogicActive extends ForestryPacket implements IForestryPac
beekeepingLogic.writeData(data);
}
@SideOnly(Side.CLIENT)
public static class Handler implements IForestryPacketHandlerClient {
@Override
public void onPacketData(PacketBufferForestry data, EntityPlayer player) throws IOException {
BlockPos tilePos = data.readBlockPos();
TileEntity tile = Proxies.common.getRenderWorld().getTileEntity(tilePos);
if (tile instanceof IBeeHousing) {
IBeeHousing beeHousing = (IBeeHousing) tile;
IBeeHousing beeHousing = TileUtil.getTile(player.world, tilePos, IBeeHousing.class);
if (beeHousing != null) {
IBeekeepingLogic beekeepingLogic = beeHousing.getBeekeepingLogic();
if (beekeepingLogic instanceof BeekeepingLogic) {
((BeekeepingLogic) beekeepingLogic).readData(data);
@@ -22,6 +22,8 @@ import forestry.core.network.PacketBufferForestry;
import forestry.core.network.PacketIdClient;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class PacketBeeLogicActiveEntity extends ForestryPacket implements IForestryPacketClient {
private final Entity entity;
@@ -43,6 +45,7 @@ public class PacketBeeLogicActiveEntity extends ForestryPacket implements IFores
beekeepingLogic.writeData(data);
}
@SideOnly(Side.CLIENT)
public static class Handler implements IForestryPacketHandlerClient {
@Override
public void onPacketData(PacketBufferForestry data, EntityPlayer player) throws IOException {
@@ -18,9 +18,11 @@ import forestry.core.network.IForestryPacketClient;
import forestry.core.network.IForestryPacketHandlerClient;
import forestry.core.network.PacketBufferForestry;
import forestry.core.network.PacketIdClient;
import forestry.core.tiles.TileUtil;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class PacketCandleUpdate extends ForestryPacket implements IForestryPacketClient {
private final BlockPos pos;
@@ -45,6 +47,7 @@ public class PacketCandleUpdate extends ForestryPacket implements IForestryPacke
data.writeBoolean(lit);
}
@SideOnly(Side.CLIENT)
public static class Handler implements IForestryPacketHandlerClient {
@Override
public void onPacketData(PacketBufferForestry data, EntityPlayer player) throws IOException {
@@ -52,10 +55,7 @@ public class PacketCandleUpdate extends ForestryPacket implements IForestryPacke
int colour = data.readInt();
boolean lit = data.readBoolean();
TileEntity tileEntity = player.world.getTileEntity(pos);
if (tileEntity instanceof TileCandle) {
((TileCandle) tileEntity).onPacketUpdate(colour, lit);
}
TileUtil.actOnTile(player.world, pos, TileCandle.class, tile -> tile.onPacketUpdate(colour, lit));
}
}
}
@@ -12,14 +12,16 @@ package forestry.apiculture.network.packets;
import java.io.IOException;
import forestry.apiculture.render.TextureHabitatLocator;
import forestry.core.network.ForestryPacket;
import forestry.core.network.IForestryPacketClient;
import forestry.core.network.IForestryPacketHandlerClient;
import forestry.core.network.PacketBufferForestry;
import forestry.core.network.PacketIdClient;
import forestry.core.proxy.Proxies;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class PacketHabitatBiomePointer extends ForestryPacket implements IForestryPacketClient {
private final BlockPos pos;
@@ -38,11 +40,12 @@ public class PacketHabitatBiomePointer extends ForestryPacket implements IForest
return PacketIdClient.HABITAT_BIOME_POINTER;
}
@SideOnly(Side.CLIENT)
public static class Handler implements IForestryPacketHandlerClient {
@Override
public void onPacketData(PacketBufferForestry data, EntityPlayer player) throws IOException {
BlockPos pos = data.readBlockPos();
Proxies.render.setHabitatLocatorTexture(player, pos);
TextureHabitatLocator.getInstance().setTargetCoordinates(pos);
}
}
}
Loaded 100 of 572 files, more files were not shown because too many files have changed in this diff. Show more