Compare commits

..
43 Commits
Author SHA1 Message Date
ah-OOG-ah 3cd4c9a934 Update en_US.lang 2024-09-29 23:08:23 -04:00
ah-OOG-ah abcdd2e9fa Spotless 2024-09-29 19:14:10 -04:00
ah-OOG-ah 4566fef4cb Remove gross reflection 2024-09-29 19:14:10 -04:00
ah-OOG-ah 533b41cae8 Remove unused item classes 2024-09-29 19:14:10 -04:00
ah-OOG-ah afa0cbe790 Move drop items 2024-09-29 19:14:10 -04:00
ah-OOG-ah e0b90f69e0 Move comb items 2024-09-29 19:14:10 -04:00
ah-OOG-ah fe53e964c1 Move Propolis 2024-09-29 19:14:10 -04:00
ah-OOG-ah 822920d3b2 Move ET food 2024-09-29 19:14:10 -04:00
ah-OOG-ah c34ab342d9 Move Botany items 2024-09-29 19:14:10 -04:00
ah-OOG-ah 3f3443a374 Move initialization 2024-09-29 19:14:10 -04:00
ah-OOG-ah 43d06a9ba0 Remove empty methods 2024-09-29 19:14:10 -04:00
ah-OOG-ah 59534a05cf Fix broken langs in ExtraTrees 2024-09-29 19:14:10 -04:00
ah-OOG-ah 77068b106d Add default methods for some blocks 2024-09-29 19:14:10 -04:00
ah-OOG-ah 983bd25f7a Replace ExtraBees items 2024-09-29 19:14:10 -04:00
ah-OOG-ah 37fda09964 Load non-damage ET items 2024-09-29 19:14:10 -04:00
ah-OOG-ah ce71fe4912 Move init 2024-09-29 19:14:10 -04:00
ah-OOG-ah 033f536462 De-enum GeneticsItems, create ETItems 2024-09-29 19:14:10 -04:00
ah-OOG-ah 27c13f7758 Localise damage items 2024-09-29 19:14:10 -04:00
ah-OOG-ah 04c68468e5 Remap Genetics to genetics 2024-09-29 19:14:10 -04:00
ah-OOG-ah 004f38a782 Fix genetics item registration
However, now textures are screwed because Binnie made doesn't have consistent capitalization.
2024-09-29 19:14:10 -04:00
ah-OOG-ah aea58b0b65 Spotless 2024-09-29 19:14:10 -04:00
ah-OOG-ah 1bc0567b4a Replace GeneticsItems 2024-09-29 19:14:10 -04:00
ah-OOG-ah 882b9c3964 Remove redundant methods 2024-09-29 19:14:10 -04:00
ah-OOG-ah b61fff5691 Move simple Genetics items to enum 2024-09-29 19:14:10 -04:00
ah-OOG-ah 1a3b24c589 Remove unused GUI factory 2024-09-29 19:13:17 -04:00
ah-OOG-ah d77c705d54 Spotless 2024-09-26 19:18:43 -04:00
ah-OOG-ah 3222bf35ca Register EBConfig and add ranges 2024-09-26 19:18:19 -04:00
ah-OOG-ah 56c2e72748 Remove module configs
We don't support disabling parts
2024-09-26 17:33:07 -04:00
ah-OOG-ah 0f2e6bd76e Yeet the config system 2024-09-26 14:27:48 -04:00
ah-OOG-ah 880f952d0f Actually remove the last config 2024-09-26 14:27:48 -04:00
ah-OOG-ah 5db9be848f Remove the last config 2024-09-26 14:27:48 -04:00
ah-OOG-ah 57345f4daa I may be dense 2024-09-26 14:27:48 -04:00
ah-OOG-ah ccd425de9d Migrate ExtraBees config
Needs testing in prod
2024-09-26 14:27:48 -04:00
ah-OOG-ah df042779de Actually plug in the config class
Although I'm not sure that child mods are handled correctly.
2024-09-26 14:27:48 -04:00
ah-OOG-ah 162ac5a46c Move ExtraTrees to NHLib config 2024-09-26 14:27:48 -04:00
ah-OOG-ah 1077567cc3 Yeet empty config file 2024-09-26 14:27:48 -04:00
ah-OOG-ah a5ac246a28 Delete a bunch of unused code
Passes the scream test, at least without binnie-specific tests
2024-09-26 14:27:48 -04:00
ah-OOG-ah f0f14bb278 Minor cleanups (#50)
* Finalize, minor alloc reduction

Also enable Jabel and generic injection

* Update dependencies.gradle

* Clean up Machine a bit

* spotless

more enhanced instanceof

* Update ModuleMachine.java

* More clen

* WARN: Removed exception catching

* Many, many tiny patches + birthday fix

* Spotless

* Spotless again

* Fix getLow and clamp tolerance value

* Revert event -> ignored on unused event parameters

* Rename instanceof variables

* Update Machine.java

* Use StringBuilder

* Cache getStack()

* Oops, Jabel can't handle that

* Spotless

* Spotless again

My IDE was fighting with it

* Remove unused elements + scream test success
2024-09-26 16:59:20 +02:00
Martin Robertz 6b4f3eb1c7 update 2024-09-15 14:30:24 +02:00
Ryan Nasers f74f9e4967 Should be fixed (#49) 2024-09-15 11:07:23 +02:00
Dream Master 12643d1b98 update 2024-08-09 20:41:23 +07:00
Ethryan 5bf4224f03 don't let players eat fluids anymore (#48) 2024-08-09 19:54:49 +07:00
Martin Robertz 5a1030bde4 update 2024-05-31 19:00:50 +02:00
433 changed files with 3855 additions and 5715 deletions

No files matched your search

+3 -3
View File
@@ -1,10 +1,10 @@
// Add your dependencies here
dependencies {
api('com.github.GTNewHorizons:ForestryMC:4.9.3:dev')
implementation('com.github.GTNewHorizons:GTNHLib:0.2.11:dev')
api('com.github.GTNewHorizons:ForestryMC:4.9.16:dev')
implementation('com.github.GTNewHorizons:GTNHLib:0.5.11:dev')
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.6.1-GTNH:dev')
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.6.38-GTNH:dev')
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.39:api')
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
+17 -6
View File
@@ -41,19 +41,19 @@ developmentEnvironmentUserName = Developer
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
enableModernJavaSyntax = false
enableModernJavaSyntax = true
# Enables injecting missing generics into the decompiled source code for a better coding experience.
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
enableGenericInjection = false
enableGenericInjection = true
# Generate a class with a String field for the mod version named as defined below.
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
generateGradleTokenClass =
generateGradleTokenClass = binnie.core.Tags
# Name of the token containing the project's current version to generate/replace.
gradleTokenVersion = GRADLETOKEN_VERSION
gradleTokenVersion = VERSION
# [DEPRECATED] Mod ID replacement token.
gradleTokenModId =
@@ -70,7 +70,7 @@ gradleTokenGroupName =
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...]).
# Leave these properties empty to skip individual token replacements.
replaceGradleTokenInFile = BinnieCore.java
replaceGradleTokenInFile =
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty.
@@ -85,6 +85,11 @@ accessTransformersFile =
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
# Mixin classes will have access to "main" classes, but not the other way around.
separateMixinSourceSet =
# Adds some debug arguments like verbose output and class export.
usesMixinDebug = false
@@ -117,9 +122,15 @@ minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true
# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories.
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
# list of strings, with the acceptable keys being(case does not matter):
# cursemaven
# modrinth
excludeWellKnownRepositories =
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+5 -2
View File
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Vendored
+2
View File
@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
+1 -1
View File
@@ -17,5 +17,5 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.22'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.27'
}
-4
View File
@@ -5,19 +5,15 @@ import java.util.List;
import binnie.core.ManagerBase;
import binnie.core.genetics.ManagerGenetics;
import binnie.core.item.ManagerItem;
import binnie.core.liquid.ManagerLiquid;
import binnie.core.machines.ManagerMachine;
import binnie.core.mod.config.ManagerConfig;
import binnie.core.resource.ManagerResource;
public final class Binnie {
public static List<ManagerBase> Managers = new ArrayList<>();
public static ManagerGenetics Genetics = new ManagerGenetics();
public static ManagerConfig Configuration = new ManagerConfig();
public static ManagerLiquid Liquid = new ManagerLiquid();
public static ManagerMachine Machine = new ManagerMachine();
public static ManagerItem Item = new ManagerItem();
public static ManagerResource Resource = new ManagerResource();
}
+38 -49
View File
@@ -1,8 +1,9 @@
package binnie.botany;
import static binnie.botany.items.BotanyItems.misc;
import net.minecraft.block.Block;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
@@ -20,27 +21,20 @@ import binnie.botany.ceramic.BlockCeramicPatterned;
import binnie.botany.ceramic.BlockStained;
import binnie.botany.core.BotanyCore;
import binnie.botany.core.BotanyGUI;
import binnie.botany.core.ModuleCore;
import binnie.botany.flower.BlockFlower;
import binnie.botany.flower.ItemFlower;
import binnie.botany.flower.ItemInsulatedTube;
import binnie.botany.flower.TileEntityFlower;
import binnie.botany.gardening.BlockPlant;
import binnie.botany.gardening.BlockSoil;
import binnie.botany.gardening.Gardening;
import binnie.botany.gardening.ItemSoilMeter;
import binnie.botany.gardening.ItemTrowel;
import binnie.botany.gardening.ModuleGardening;
import binnie.botany.genetics.ItemDictionary;
import binnie.botany.genetics.ModuleGenetics;
import binnie.botany.items.ItemClay;
import binnie.botany.items.ItemPigment;
import binnie.botany.items.BotanyItems;
import binnie.botany.network.PacketID;
import binnie.botany.proxy.Proxy;
import binnie.core.AbstractMod;
import binnie.core.BinnieCore;
import binnie.core.Tags;
import binnie.core.gui.IBinnieGUID;
import binnie.core.item.ItemMisc;
import binnie.core.network.BinniePacketHandler;
import binnie.core.network.IPacketID;
import binnie.core.proxy.IProxyCore;
@@ -48,19 +42,24 @@ import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLMissingMappingsEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.registry.GameRegistry;
@Mod(
modid = "Botany",
name = "Botany",
version = BinnieCore.VERSION,
modid = Botany.BOTANY_MODID,
name = Botany.BOTANY_MODNAME,
version = Tags.VERSION,
useMetadata = true,
dependencies = "after:BinnieCore")
public class Botany extends AbstractMod {
public static final String BOTANY_MODID = "botany";
public static final String BOTANY_MODNAME = "Botany";
@Mod.Instance("Botany")
public static Botany instance;
@@ -68,27 +67,13 @@ public class Botany extends AbstractMod {
public static Proxy proxy;
public static BlockFlower flower;
public static Item seed;
public static Item pollen;
public static ItemDictionary database;
public static BlockPlant plant;
public static ItemTrowel trowelWood;
public static ItemTrowel trowelStone;
public static ItemTrowel trowelIron;
public static ItemTrowel trowelDiamond;
public static ItemTrowel trowelGold;
public static BlockSoil soil;
public static BlockSoil loam;
public static BlockSoil flowerbed;
public static BlockSoil soilNoWeed;
public static BlockSoil loamNoWeed;
public static BlockSoil flowerbedNoWeed;
public static ItemInsulatedTube insulatedTube;
public static ItemSoilMeter soilMeter;
public static ItemMisc misc;
public static ItemFlower flowerItem;
public static ItemPigment pigment;
public static ItemClay clay;
public static BlockCeramic ceramic;
public static BlockCeramicPatterned ceramicTile;
public static BlockStained stained;
@@ -100,7 +85,10 @@ public class Botany extends AbstractMod {
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
addModule(new ModuleCore());
// Loads BotanyItems.class, guaranteeing that items are init by this point
// TODO: is this needed?
misc.getUnlocalizedName();
addModule(new ModuleGenetics());
addModule(new ModuleGardening());
preInit();
@@ -116,14 +104,22 @@ public class Botany extends AbstractMod {
postInit();
}
@Override
public IBinnieGUID[] getGUIDs() {
return BotanyGUI.values();
@Mod.EventHandler
public void missingMappings(FMLMissingMappingsEvent event) {
for (FMLMissingMappingsEvent.MissingMapping m : event.getAll()) {
final String[] name = m.name.split(":");
if (name.length < 2) continue;
if (name[0].equals("Botany")) {
if (m.type == GameRegistry.Type.BLOCK) m.remap(GameRegistry.findBlock(BOTANY_MODID, name[1]));
else m.remap(GameRegistry.findItem(BOTANY_MODID, name[1]));
}
}
}
@Override
public Class<?>[] getConfigs() {
return new Class[0];
public IBinnieGUID[] getGUIDs() {
return BotanyGUI.values();
}
@Override
@@ -143,7 +139,7 @@ public class Botany extends AbstractMod {
@Override
public String getModID() {
return "botany";
return BOTANY_MODID;
}
@Override
@@ -160,21 +156,19 @@ public class Botany extends AbstractMod {
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null
&& event.entityPlayer.getHeldItem().getItem() == Items.shears) {
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
if (tile instanceof TileEntityFlower) {
TileEntityFlower flower = (TileEntityFlower) tile;
flower.onShear();
if (tile instanceof TileEntityFlower tileFlower) {
tileFlower.onShear();
event.entityPlayer.getHeldItem().damageItem(1, event.entityPlayer);
}
}
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null
&& event.entityPlayer.getHeldItem().getItem() == Botany.pollen) {
&& event.entityPlayer.getHeldItem().getItem() == BotanyItems.pollen) {
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
if (tile instanceof TileEntityFlower) {
TileEntityFlower flower = (TileEntityFlower) tile;
if (tile instanceof TileEntityFlower tileFlower) {
IFlower pollen = BotanyCore.getFlowerRoot().getMember(event.entityPlayer.getHeldItem());
if (pollen != null && flower.canMateWith(pollen)) {
flower.mateWith(pollen);
if (pollen != null && tileFlower.canMateWith(pollen)) {
tileFlower.mateWith(pollen);
if (!event.entityPlayer.capabilities.isCreativeMode) {
ItemStack heldItem = event.entityPlayer.getHeldItem();
heldItem.stackSize--;
@@ -196,10 +190,10 @@ public class Botany extends AbstractMod {
int y = event.y;
Block block = event.world.getBlock(event.x, y, event.z);
if (block == null || !Gardening.isSoil(block)) {
if (!Gardening.isSoil(block)) {
block = event.world.getBlock(event.x, --y, event.z);
}
if (block == null || !Gardening.isSoil(block)) {
if (!Gardening.isSoil(block)) {
return;
}
@@ -314,11 +308,6 @@ public class Botany extends AbstractMod {
}
}
@Override
public boolean isActive() {
return BinnieCore.isBotanyActive();
}
@Mod.EventHandler
public void onIMC(FMLInterModComms.IMCEvent event) {
for (FMLInterModComms.IMCMessage message : event.getMessages()) {
@@ -24,7 +24,7 @@ public enum EnumFlowerChromosome implements IChromosomeType {
SAPPINESS(IAlleleFloat.class),
STEM(IAlleleInteger.class);
private Class<? extends IAllele> cls;
private final Class<? extends IAllele> cls;
EnumFlowerChromosome(Class<? extends IAllele> cls) {
this.cls = cls;
@@ -7,7 +7,7 @@ public enum EnumFlowerStage {
POLLEN("Pollen"),
NONE("NONE");
protected String name;
private final String name;
EnumFlowerStage(String name) {
this.name = name;
@@ -16,7 +16,6 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany;
@@ -65,23 +64,13 @@ public class BlockCeramic extends Block implements IBlockMetadata {
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
}
@Override
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
return TileEntityMetadata.getItemDamage(itemStack);
}
@Override
public int getDroppedMeta(int blockMeta, int tileMeta) {
return tileMeta;
}
@Override
public String getBlockName(ItemStack itemStack) {
return I18N.localise("botany.ceramicBlock");
}
@Override
public void addBlockTooltip(ItemStack stack, List tooltip) {
public void addBlockTooltip(ItemStack stack, List<String> tooltip) {
int meta = TileEntityMetadata.getItemDamage(stack);
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(meta).getName());
}
@@ -92,7 +81,7 @@ public class BlockCeramic extends Block implements IBlockMetadata {
}
@Override
public void getSubBlocks(Item item, CreativeTabs tabs, List itemList) {
public void getSubBlocks(Item item, CreativeTabs tabs, List<ItemStack> itemList) {
for (EnumFlowerColor c : EnumFlowerColor.values()) {
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
}
@@ -1,5 +1,7 @@
package binnie.botany.ceramic;
import static binnie.botany.items.BotanyMisc.Items.Mortar;
import java.util.ArrayList;
import java.util.List;
@@ -16,7 +18,6 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany;
@@ -73,16 +74,6 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
}
@Override
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
return TileEntityMetadata.getItemDamage(itemStack);
}
@Override
public int getDroppedMeta(int blockMeta, int tileMeta) {
return tileMeta;
}
@Override
public String getBlockName(ItemStack itemStack) {
int meta = TileEntityMetadata.getItemDamage(itemStack);
@@ -90,7 +81,7 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
}
@Override
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
public void addBlockTooltip(ItemStack itemStack, List<String> tooltip) {
int meta = TileEntityMetadata.getItemDamage(itemStack);
getType(meta).addTooltip(tooltip);
}
@@ -101,7 +92,7 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
}
@Override
public void getSubBlocks(Item item, CreativeTabs tab, List itemList) {
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> itemList) {
for (EnumFlowerColor c : EnumFlowerColor.values()) {
BlockType type = new BlockType(c, c, TileType.Tile);
itemList.add(TileEntityMetadata.getItemStack(this, type.ordinal()));
@@ -205,9 +196,9 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
VerticalStripeBrick("verticalbrickstripe", "verticalStripedCeramicBricks"),
VerticalLargeBrick("verticalbricklarge", "largeVerticalCeramicBricks");
protected String id;
protected String name;
protected IIcon[] icons;
private final String id;
private final String name;
private final IIcon[] icons;
TileType(String id, String name) {
icons = new IIcon[3];
@@ -224,32 +215,15 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
}
public ItemStack getRecipe(List<ItemStack> stacks) {
switch (this) {
case Tile:
return getTileRecipe(stacks);
case Split:
return getSplitRecipe(stacks);
case Chequered:
return getChequeredRecipe(stacks);
case Mixed:
return getMixedRecipe(stacks);
case LargeBrick:
return getLargeBrickRecipe(stacks);
case Brick:
case StripeBrick:
return getBrickRecipe(stacks);
case VerticalLargeBrick:
case VerticalBrick:
case VerticalStripeBrick:
return getVerticalBrickRecipe(stacks);
}
return null;
return switch (this) {
case Tile -> getTileRecipe(stacks);
case Split -> getSplitRecipe(stacks);
case Chequered -> getChequeredRecipe(stacks);
case Mixed -> getMixedRecipe(stacks);
case LargeBrick -> getLargeBrickRecipe(stacks);
case Brick, StripeBrick -> getBrickRecipe(stacks);
case VerticalLargeBrick, VerticalBrick, VerticalStripeBrick -> getVerticalBrickRecipe(stacks);
};
}
private ItemStack getTileRecipe(List<ItemStack> stacks) {
@@ -501,7 +475,7 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
}
private boolean isMortar(ItemStack stack) {
return stack.getItem() == Botany.misc && stack.getItemDamage() == BotanyItems.Mortar.ordinal();
return stack.getItem() == BotanyItems.misc && stack.getItemDamage() == Mortar.ordinal();
}
}
@@ -541,7 +515,7 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
return I18N.localise("botany." + type.name);
}
public void addTooltip(List tooltip) {
public void addTooltip(List<String> tooltip) {
String name = color1.getName();
if (type.canDouble() && color2 != color1) {
name = I18N.localise("botany.colour.double", name, color2.getName());
@@ -40,7 +40,7 @@ public class BlockCeramicPatterned extends BlockDesign {
}
@Override
public void addBlockTooltip(ItemStack stack, List tooltip) {
public void addBlockTooltip(ItemStack stack, List<String> tooltip) {
super.addBlockTooltip(stack, tooltip);
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), TileEntityMetadata.getItemDamage(stack));
tooltip.add(EnumChatFormatting.GRAY + block.getDesign().getName());
@@ -95,23 +95,13 @@ public class BlockStained extends Block implements IBlockMetadata {
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
}
@Override
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
return TileEntityMetadata.getItemDamage(itemStack);
}
@Override
public int getDroppedMeta(int blockMeta, int tileMeta) {
return tileMeta;
}
@Override
public String getBlockName(ItemStack itemStack) {
return I18N.localise("botany.pigmentedGlass");
}
@Override
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
public void addBlockTooltip(ItemStack itemStack, List<String> tooltip) {
int meta = TileEntityMetadata.getItemDamage(itemStack);
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(meta).getName());
}
@@ -122,7 +112,7 @@ public class BlockStained extends Block implements IBlockMetadata {
}
@Override
public void getSubBlocks(Item item, CreativeTabs tab, List itemList) {
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> itemList) {
for (EnumFlowerColor c : EnumFlowerColor.values()) {
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
}
@@ -1,5 +1,7 @@
package binnie.botany.ceramic;
import static binnie.botany.items.BotanyMisc.Items.Mortar;
import java.util.HashMap;
import java.util.Map;
@@ -10,7 +12,6 @@ import net.minecraft.util.IIcon;
import binnie.botany.Botany;
import binnie.botany.genetics.EnumFlowerColor;
import binnie.botany.items.BotanyItems;
import binnie.core.AbstractMod;
import binnie.core.BinnieCore;
import binnie.extratrees.api.IDesignMaterial;
@@ -96,7 +97,7 @@ public class CeramicDesignSystem implements IDesignSystem {
@Override
public ItemStack getAdhesive() {
return BotanyItems.Mortar.get(1);
return Mortar.get(1);
}
@Override
@@ -10,6 +10,7 @@ import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World;
import binnie.botany.Botany;
import binnie.botany.items.BotanyItems;
public class CeramicTileRecipe implements IRecipe {
@@ -26,7 +27,7 @@ public class CeramicTileRecipe implements IRecipe {
Item ceramicBlock = Item.getItemFromBlock(Botany.ceramic);
Item ceramicTile = Item.getItemFromBlock(Botany.ceramicTile);
Item ceramicBrick = Item.getItemFromBlock(Botany.ceramicBrick);
Item mortar = Botany.misc;
Item mortar = BotanyItems.misc;
List<ItemStack> stacks = new ArrayList<>();
int ix = -1;
int iy = -1;
@@ -6,14 +6,14 @@ import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World;
import binnie.Binnie;
import binnie.botany.Botany;
import binnie.botany.api.IFlower;
import binnie.botany.items.BotanyItems;
public class PigmentRecipe implements IRecipe {
protected ItemStack cached;
private ItemStack unknown;
private final ItemStack unknown;
public PigmentRecipe() {
unknown = null;
@@ -47,7 +47,7 @@ public class PigmentRecipe implements IRecipe {
IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(crafting.getStackInSlot(i));
if (flower.getAge() >= 1) {
stack = new ItemStack(Botany.pigment, 1, flower.getGenome().getPrimaryColor().getID());
stack = new ItemStack(BotanyItems.pigment, 1, flower.getGenome().getPrimaryColor().getID());
}
}
}
@@ -1,21 +0,0 @@
package binnie.botany.core;
import binnie.core.IInitializable;
public class ModuleCore implements IInitializable {
@Override
public void preInit() {
// ignored
}
@Override
public void init() {
// ignored
}
@Override
public void postInit() {
// ignored
}
}
@@ -6,7 +6,7 @@ import binnie.core.craftgui.controls.listbox.ControlListBox;
public class ControlColorMixBox extends ControlListBox<IColourMix> {
private Type type;
private final Type type;
public ControlColorMixBox(IWidget parent, int x, int y, int width, int height, Type type) {
super(parent, x, y, width, height, 12.0f);
@@ -18,7 +18,7 @@ public class ControlColorMixBox extends ControlListBox<IColourMix> {
return new ControlColorMixItem(getContent(), value, y);
}
enum Type {
public enum Type {
Resultant,
Further
}
@@ -13,11 +13,11 @@ import forestry.api.farming.IFarmHousing;
public class CircuitGarden extends BinnieCircuit {
private boolean isManual;
private boolean isFertilised;
private ItemStack icon;
private EnumMoisture moisture;
private EnumAcidity acidity;
private final boolean isManual;
private final boolean isFertilised;
private final ItemStack icon;
private final EnumMoisture moisture;
private final EnumAcidity acidity;
public CircuitGarden(EnumMoisture moisture, EnumAcidity ph, boolean manual, boolean fertilised, ItemStack recipe,
ItemStack icon) {
@@ -46,27 +46,27 @@ public class CircuitGarden extends BinnieCircuit {
}
if (acidity == EnumAcidity.ACID) {
if (info.length() > 0) {
if (!info.isEmpty()) {
info += ", ";
}
info += EnumChatFormatting.RED + I18N.localise("botany.ph.acid") + EnumChatFormatting.RESET;
}
if (acidity == EnumAcidity.NEUTRAL) {
if (info.length() > 0) {
if (!info.isEmpty()) {
info += ", ";
}
info += EnumChatFormatting.GREEN + I18N.localise("botany.ph.neutral") + EnumChatFormatting.RESET;
}
if (acidity == EnumAcidity.ALKALINE) {
if (info.length() > 0) {
if (!info.isEmpty()) {
info += ", ";
}
info += EnumChatFormatting.AQUA + I18N.localise("botany.ph.alkaline") + EnumChatFormatting.RESET;
}
if (info.length() > 0) {
if (!info.isEmpty()) {
info = " (" + info + EnumChatFormatting.RESET + ")";
}
addTooltipString(I18N.localise("botany.circuit.flowers") + info);
@@ -101,8 +101,4 @@ public class CircuitGarden extends BinnieCircuit {
((IFarmHousing) tile).resetFarmLogic(FarmDirection.values()[slot]);
}
@Override
public void onTick(int arg0, Object arg1) {
// ignored
}
}
@@ -359,8 +359,7 @@ public class GardenLogic extends FarmLogic {
try {
IOwnable housing2 = (IOwnable) housing;
GameProfile prof = (GameProfile) IOwnable.class.getMethod("getOwnerProfile", new Class[0])
.invoke(housing2);
GameProfile prof = (GameProfile) IOwnable.class.getMethod("getOwnerProfile").invoke(housing2);
((TileEntityFlower) tile).setOwner(prof);
} catch (Exception ex) {
// ignored
@@ -85,7 +85,7 @@ public class BlockFlower extends BlockContainer {
super.onBlockPlacedBy(world, x, y, z, entity, stack);
TileEntity flower = world.getTileEntity(x, y, z);
if (!BinnieCore.proxy.isSimulating(world)) {
if (flower != null && flower instanceof TileEntityFlower) {
if (flower instanceof TileEntityFlower) {
IFlower f = BotanyCore.getFlowerRoot().getMember(stack);
((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower));
}
@@ -93,7 +93,7 @@ public class BlockFlower extends BlockContainer {
}
TileEntity below = world.getTileEntity(x, y - 1, z);
if (flower != null && flower instanceof TileEntityFlower) {
if (flower instanceof TileEntityFlower) {
if (below instanceof TileEntityFlower) {
((TileEntityFlower) flower).setSection(((TileEntityFlower) below).getSection());
} else {
@@ -108,15 +108,14 @@ public class BlockFlower extends BlockContainer {
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
TileEntity tile = world.getTileEntity(x, y, z);
if (!(tile instanceof TileEntityFlower)) {
if (!(tile instanceof TileEntityFlower tileFlower)) {
return super.getIcon(world, x, y, z, side);
}
TileEntityFlower f = (TileEntityFlower) tile;
EnumFlowerStage stage = (f.getAge() == 0) ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER;
IFlowerType flower = f.getType();
int section = f.getRenderSection();
boolean flowered = f.isFlowered();
EnumFlowerStage stage = (tileFlower.getAge() == 0) ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER;
IFlowerType flower = tileFlower.getType();
int section = tileFlower.getRenderSection();
boolean flowered = tileFlower.isFlowered();
if (RendererBotany.pass == 0) {
return flower.getStem(stage, flowered, section);
}
@@ -129,12 +128,11 @@ public class BlockFlower extends BlockContainer {
@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEntityFlower) {
TileEntityFlower f = (TileEntityFlower) tile;
if (tile instanceof TileEntityFlower tileFlower) {
if (RendererBotany.pass == 0) {
return f.getStemColour();
return tileFlower.getStemColour();
}
return (RendererBotany.pass == 1) ? f.getPrimaryColor() : f.getSecondaryColor();
return (RendererBotany.pass == 1) ? tileFlower.getPrimaryColor() : tileFlower.getSecondaryColor();
}
return 0xffffff;
}
@@ -153,14 +151,13 @@ public class BlockFlower extends BlockContainer {
super.onNeighborBlockChange(world, x, y, z, block);
checkAndDropBlock(world, x, y, z);
TileEntity tile = world.getTileEntity(x, y, z);
if (!(tile instanceof TileEntityFlower)) {
if (!(tile instanceof TileEntityFlower tileFlower)) {
return;
}
TileEntityFlower flower = (TileEntityFlower) tile;
if (flower.getSection() == 0 && flower.getFlower() != null
&& flower.getFlower().getAge() > 0
&& flower.getFlower().getGenome().getPrimary().getType().getSections() > 1
if (tileFlower.getSection() == 0 && tileFlower.getFlower() != null
&& tileFlower.getFlower().getAge() > 0
&& tileFlower.getFlower().getGenome().getPrimary().getType().getSections() > 1
&& world.getBlock(x, y + 1, z) != Botany.flower) {
dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
world.setBlockToAir(x, y, z);
@@ -212,7 +209,7 @@ public class BlockFlower extends BlockContainer {
List<ItemStack> drops = getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
boolean hasBeenBroken = world.setBlockToAir(x, y, z);
if (hasBeenBroken && BinnieCore.proxy.isSimulating(world)
&& drops.size() > 0
&& !drops.isEmpty()
&& (player == null || !player.capabilities.isCreativeMode)) {
for (ItemStack drop : drops) {
dropBlockAsItem(world, x, y, z, drop);
@@ -27,6 +27,7 @@ import binnie.botany.genetics.EnumFlowerType;
import binnie.botany.genetics.Flower;
import binnie.core.BinnieCore;
import binnie.core.util.I18N;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.genetics.IIndividual;
@@ -39,6 +40,8 @@ public abstract class ItemBotany extends Item {
setCreativeTab(CreativeTabBotany.instance);
setUnlocalizedName(name);
hasSubtypes = true;
GameRegistry.registerItem(this, name);
}
@Override
@@ -57,11 +60,6 @@ public abstract class ItemBotany extends Item {
return false;
}
@Override
public boolean getShareTag() {
return true;
}
@Override
public boolean hasEffect(ItemStack stack, int pass) {
if (!stack.hasTagCompound()) {
@@ -73,7 +71,7 @@ public abstract class ItemBotany extends Item {
}
@Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List tooltip, boolean flag) {
public void addInformation(ItemStack itemstack, EntityPlayer player, List<String> tooltip, boolean flag) {
if (!itemstack.hasTagCompound()) {
return;
}
@@ -138,11 +136,11 @@ public abstract class ItemBotany extends Item {
}
@Override
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List<ItemStack> itemList) {
addCreativeItems(itemList, true);
}
public void addCreativeItems(List itemList, boolean hideSecrets) {
public void addCreativeItems(List<ItemStack> itemList, boolean hideSecrets) {
for (IIndividual individual : BotanyCore.speciesRoot.getIndividualTemplates()) {
if (hideSecrets && individual.isSecret() && !Config.isDebug) {
continue;
@@ -199,10 +197,9 @@ public abstract class ItemBotany extends Item {
if (getStage() == EnumFlowerStage.POLLEN) {
IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(itemstack);
TileEntity target = world.getTileEntity(x, y, z);
if (!(target instanceof IPollinatable)) {
if (!(target instanceof IPollinatable pollinatable)) {
return false;
}
IPollinatable pollinatable = (IPollinatable) target;
if (!pollinatable.canMateWith(flower)) {
return false;
}
@@ -13,6 +13,7 @@ import net.minecraft.util.IIcon;
import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany;
import binnie.core.util.I18N;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -21,10 +22,14 @@ public class ItemInsulatedTube extends Item {
IIcon[] icons;
public ItemInsulatedTube() {
final String name = "insulatedTube";
icons = new IIcon[3];
setUnlocalizedName("insulatedTube");
setUnlocalizedName(name);
setCreativeTab(CreativeTabBotany.instance);
setHasSubtypes(true);
GameRegistry.registerItem(this, name);
}
public static ItemStack getInsulateStack(ItemStack stack) {
@@ -33,7 +38,7 @@ public class ItemInsulatedTube extends Item {
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list) {
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
for (Material mat : Material.values()) {
for (Insulate ins : Insulate.values()) {
list.add(new ItemStack(this, 1, mat.ordinal() + ins.ordinal() * 128));
@@ -61,7 +66,7 @@ public class ItemInsulatedTube extends Item {
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);
tooltip.add(Insulate.get(stack.getItemDamage()).getName());
}
@@ -93,8 +98,8 @@ public class ItemInsulatedTube extends Item {
Bronze(0xddc276, "bronze"),
Iron(0xd8d8d8, "iron");
protected int color;
protected String name;
private final int color;
private final String name;
Material(int color, String name) {
this.color = color;
@@ -123,8 +128,8 @@ public class ItemInsulatedTube extends Item {
Stone(0x6d6d6d, "smoothStone"),
Sandstone(0xc1b989, "sandstone");
protected int color;
protected String name;
private final int color;
private final String name;
Insulate(int color, String name) {
this.color = color;
@@ -144,26 +149,14 @@ public class ItemInsulatedTube extends Item {
}
public ItemStack getStack() {
switch (this) {
case Clay:
return new ItemStack(Blocks.clay);
case Cobble:
return new ItemStack(Blocks.cobblestone);
case HardenedClay:
return new ItemStack(Blocks.hardened_clay);
case Sand:
return new ItemStack(Blocks.sand);
case Sandstone:
return new ItemStack(Blocks.sandstone);
case Stone:
return new ItemStack(Blocks.stone);
}
return null;
return switch (this) {
case Clay -> new ItemStack(Blocks.clay);
case Cobble -> new ItemStack(Blocks.cobblestone);
case HardenedClay -> new ItemStack(Blocks.hardened_clay);
case Sand -> new ItemStack(Blocks.sand);
case Sandstone -> new ItemStack(Blocks.sandstone);
case Stone -> new ItemStack(Blocks.stone);
};
}
}
}
@@ -25,9 +25,8 @@ public class RendererBotany implements ISimpleBlockRenderingHandler {
Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(block.getMixedBrightnessForBlock(renderer.blockAccess, x, y, z));
double d1 = x;
double d2 = y;
double d3 = z;
long i1 = x * 3129871 ^ z * 116129781L;
long i1 = x * 3129871L ^ z * 116129781L;
i1 = i1 * i1 * 42317861L + i1 * 11L;
d1 += ((i1 >> 16 & 0xFL) / 15.0f - 0.5) * 0.3;
d3 += ((i1 >> 24 & 0xFL) / 15.0f - 0.5) * 0.3;
@@ -46,7 +45,7 @@ public class RendererBotany implements ISimpleBlockRenderingHandler {
}
tessellator.setColorOpaque_F(f, f2, f3);
IIcon iicon = block.getIcon(world, x, y, z, 0);
renderer.drawCrossedSquares(iicon, d1, d2, d3, 1.0f);
renderer.drawCrossedSquares(iicon, d1, y, d3, 1.0f);
}
return false;
}
@@ -213,11 +213,7 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
return;
}
if (!canTolerate || light < 1.0f) {
flower.setWilted(true);
} else {
flower.setWilted(false);
}
flower.setWilted(!canTolerate || light < 1.0f);
float chanceDispersal = 0.8f;
chanceDispersal += 0.2f * flower.getGenome().getFertility();
@@ -302,7 +298,7 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
public void updateRender(boolean update) {
if (update && getFlower() != null && getFlower().getGenome() != null) {
RenderInfo newInfo = new RenderInfo(getFlower(), this);
if (renderInfo == null || !newInfo.equals(renderInfo)) {
if (!newInfo.equals(renderInfo)) {
setRender(newInfo);
}
}
@@ -619,8 +615,7 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
@Override
public boolean equals(Object obj) {
if (obj instanceof RenderInfo) {
RenderInfo o = (RenderInfo) obj;
if (obj instanceof RenderInfo o) {
return o.age == age && o.wilted == wilted
&& o.flowered == flowered
&& o.primary == primary
@@ -71,7 +71,7 @@ public class BlockPlant extends BlockBush {
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> list) {
for (Type type : Type.values()) {
list.add(type.get());
}
@@ -137,7 +137,7 @@ public class BlockPlant extends BlockBush {
public IIcon icon;
protected String name;
private final String name;
Type(String name) {
this.name = name;
@@ -56,7 +56,7 @@ public class BlockSoil extends Block implements IBlockSoil {
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> list) {
for (int i = 0; i < 9; ++i) {
list.add(new ItemStack(this, 1, i));
}
@@ -1,5 +1,7 @@
package binnie.botany.gardening;
import static binnie.botany.items.BotanyMisc.Items.Weedkiller;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -22,7 +24,6 @@ import binnie.botany.api.EnumSoilType;
import binnie.botany.api.IFlower;
import binnie.botany.api.gardening.IBlockSoil;
import binnie.botany.flower.TileEntityFlower;
import binnie.botany.items.BotanyItems;
import binnie.core.BinnieCore;
import forestry.api.core.EnumTemperature;
@@ -46,16 +47,16 @@ public class Gardening {
for (int dz = -1; dz < 2; ++dz) {
if (dx != 0 || dz != 0) {
if (world.getBlock(x + dx, y, z + dz) == Blocks.sand) {
bias -= 1.5;
bias -= 1.5f;
} else if (world.getBlock(x + dx, y, z + dz) == Blocks.water) {
bias += 1.5;
bias += 1.5f;
}
}
}
}
if (world.isRaining() && world.canBlockSeeTheSky(x, y + 1, z) && world.getPrecipitationHeight(x, z) <= y + 1) {
bias += 1.5;
bias += 1.5f;
}
for (int dx = -1; dx < 2; ++dx) {
@@ -118,13 +119,13 @@ public class Gardening {
return false;
}
TileEntity tileFlower = world.getTileEntity(x, y, z);
TileEntity below = world.getTileEntity(x, y - 1, z);
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
if (below instanceof TileEntityFlower) {
((TileEntityFlower) tileFlower).setSection(((TileEntityFlower) below).getSection());
final TileEntity tile = world.getTileEntity(x, y, z);
final TileEntity below = world.getTileEntity(x, y - 1, z);
if (tile instanceof TileEntityFlower tileFlower) {
if (below instanceof TileEntityFlower lowerFlower) {
tileFlower.setSection(lowerFlower.getSection());
} else {
((TileEntityFlower) tileFlower).create(flower, owner);
tileFlower.create(flower, owner);
}
}
@@ -138,7 +139,7 @@ public class Gardening {
}
TileEntity flower = world.getTileEntity(x, y, z);
if (flower == null || !(flower instanceof TileEntityFlower)) {
if (!(flower instanceof TileEntityFlower)) {
return;
}
@@ -151,7 +152,7 @@ public class Gardening {
world.setBlock(x, y + 1, z, Botany.flower, 0, 2);
TileEntity tileFlower = world.getTileEntity(x, y + 1, z);
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
if (tileFlower instanceof TileEntityFlower) {
((TileEntityFlower) tileFlower).setSection(section + 1);
}
}
@@ -250,14 +251,11 @@ public class Gardening {
}
public static Block getSoilBlock(EnumSoilType type, boolean weedkill) {
switch (type) {
case FLOWERBED:
return weedkill ? Botany.flowerbedNoWeed : Botany.flowerbed;
case LOAM:
return weedkill ? Botany.loamNoWeed : Botany.loam;
}
return weedkill ? Botany.soilNoWeed : Botany.soil;
return switch (type) {
case FLOWERBED -> weedkill ? Botany.flowerbedNoWeed : Botany.flowerbed;
case LOAM -> weedkill ? Botany.loamNoWeed : Botany.loam;
default -> weedkill ? Botany.soilNoWeed : Botany.soil;
};
}
public static boolean canTolerate(IFlower flower, EnumAcidity ePH, EnumMoisture eMoisture, EnumTemperature eTemp) {
@@ -266,7 +264,7 @@ public class Gardening {
}
public static boolean isWeedkiller(ItemStack heldItem) {
return heldItem != null && heldItem.isItemEqual(BotanyItems.Weedkiller.get(1));
return heldItem != null && heldItem.isItemEqual(Weedkiller.get(1));
}
public static boolean addWeedKiller(World world, int x, int y, int z) {
@@ -20,7 +20,7 @@ public class ItemSoil extends ItemBlock {
protected EnumSoilType type;
private boolean noWeed;
private final boolean noWeed;
public ItemSoil(Block block) {
super(block);
@@ -31,7 +31,7 @@ public class ItemSoil extends ItemBlock {
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);
EnumMoisture moisture = EnumMoisture.values()[stack.getItemDamage() % 3];
EnumAcidity acidity = EnumAcidity.values()[stack.getItemDamage() / 3];
@@ -45,20 +45,20 @@ public class ItemSoil extends ItemBlock {
}
if (acidity == EnumAcidity.ACID) {
if (info.length() > 0) {
if (!info.isEmpty()) {
info += ", ";
}
info += EnumChatFormatting.YELLOW + I18N.localise("botany.ph.acid") + EnumChatFormatting.RESET;
}
if (acidity == EnumAcidity.ALKALINE) {
if (info.length() > 0) {
if (!info.isEmpty()) {
info += ", ";
}
info += EnumChatFormatting.YELLOW + I18N.localise("botany.ph.alkaline") + EnumChatFormatting.RESET;
}
if (info.length() > 0) {
if (!info.isEmpty()) {
tooltip.add(info);
}
@@ -19,15 +19,20 @@ import binnie.botany.api.gardening.IBlockSoil;
import binnie.core.BinnieCore;
import binnie.core.util.I18N;
import binnie.genetics.genetics.AlleleHelper;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemSoilMeter extends Item {
public ItemSoilMeter() {
final String name = "soilMeter";
setCreativeTab(CreativeTabBotany.instance);
setUnlocalizedName("soilMeter");
setUnlocalizedName(name);
setMaxStackSize(1);
GameRegistry.registerItem(this, name);
}
@Override
@@ -13,21 +13,25 @@ import binnie.botany.CreativeTabBotany;
import binnie.botany.api.EnumAcidity;
import binnie.botany.api.EnumMoisture;
import binnie.botany.api.EnumSoilType;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemTrowel extends Item {
protected Item.ToolMaterial theToolMaterial;
String locName;
final String locName;
public ItemTrowel(Item.ToolMaterial toolMaterial, String material) {
locName = "trowel" + material;
theToolMaterial = toolMaterial;
maxStackSize = 1;
setMaxDamage(toolMaterial.getMaxUses());
setCreativeTab(CreativeTabBotany.instance);
setUnlocalizedName("trowel" + material);
locName = "trowel" + material;
setUnlocalizedName(locName);
GameRegistry.registerItem(this, locName);
}
@Override
@@ -1,5 +1,14 @@
package binnie.botany.gardening;
import static binnie.botany.items.BotanyMisc.Items.AshPowder;
import static binnie.botany.items.BotanyMisc.Items.CompostPowder;
import static binnie.botany.items.BotanyMisc.Items.FertiliserPowder;
import static binnie.botany.items.BotanyMisc.Items.Mortar;
import static binnie.botany.items.BotanyMisc.Items.MulchPowder;
import static binnie.botany.items.BotanyMisc.Items.PulpPowder;
import static binnie.botany.items.BotanyMisc.Items.SulphurPowder;
import static binnie.botany.items.BotanyMisc.Items.Weedkiller;
import java.util.HashMap;
import java.util.Map;
@@ -12,9 +21,7 @@ import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import binnie.Binnie;
import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany;
import binnie.botany.api.EnumAcidity;
import binnie.botany.api.EnumMoisture;
import binnie.botany.api.EnumSoilType;
@@ -28,8 +35,6 @@ import binnie.botany.farm.CircuitGarden;
import binnie.botany.flower.ItemInsulatedTube;
import binnie.botany.genetics.EnumFlowerColor;
import binnie.botany.items.BotanyItems;
import binnie.botany.items.ItemClay;
import binnie.botany.items.ItemPigment;
import binnie.core.BinnieCore;
import binnie.core.IInitializable;
import binnie.core.Mods;
@@ -68,17 +73,6 @@ public class ModuleGardening implements IInitializable {
Botany.flowerbedNoWeed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbedNoWeed", true);
GameRegistry.registerBlock(Botany.flowerbedNoWeed, ItemSoil.class, "flowerbedNoWeed");
Botany.soilMeter = new ItemSoilMeter();
Botany.insulatedTube = new ItemInsulatedTube();
Botany.trowelWood = new ItemTrowel(Item.ToolMaterial.WOOD, "Wood");
Botany.trowelStone = new ItemTrowel(Item.ToolMaterial.STONE, "Stone");
Botany.trowelIron = new ItemTrowel(Item.ToolMaterial.IRON, "Iron");
Botany.trowelDiamond = new ItemTrowel(Item.ToolMaterial.EMERALD, "Diamond");
Botany.trowelGold = new ItemTrowel(Item.ToolMaterial.GOLD, "Gold");
Botany.misc = Binnie.Item.registerMiscItems(BotanyItems.values(), CreativeTabBotany.instance);
Botany.pigment = new ItemPigment();
Botany.clay = new ItemClay();
Botany.ceramic = new BlockCeramic();
GameRegistry.registerBlock(Botany.ceramic, ItemMetadata.class, "ceramic");
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramic), new ItemMetadataRenderer());
@@ -100,7 +94,7 @@ public class ModuleGardening implements IInitializable {
@Override
public void init() {
OreDictionary.registerOre("pigment", Botany.pigment);
OreDictionary.registerOre("pigment", BotanyItems.pigment);
RecipeSorter.register("botany:ceramictile", CeramicTileRecipe.class, RecipeSorter.Category.SHAPED, "");
RecipeSorter.register("botany:pigment", PigmentRecipe.class, RecipeSorter.Category.SHAPED, "");
ItemStack yellow = new ItemStack(Blocks.yellow_flower, 1);
@@ -121,28 +115,28 @@ public class ModuleGardening implements IInitializable {
null,
manual,
fertilised,
new ItemStack(Botany.insulatedTube, 1, 128 * insulate),
new ItemStack(BotanyItems.insulatedTube, 1, 128 * insulate),
icon);
new CircuitGarden(
moist,
EnumAcidity.ACID,
manual,
fertilised,
new ItemStack(Botany.insulatedTube, 1, 1 + 128 * insulate),
new ItemStack(BotanyItems.insulatedTube, 1, 1 + 128 * insulate),
icon);
new CircuitGarden(
moist,
EnumAcidity.NEUTRAL,
manual,
fertilised,
new ItemStack(Botany.insulatedTube, 1, 2 + 128 * insulate),
new ItemStack(BotanyItems.insulatedTube, 1, 2 + 128 * insulate),
icon);
new CircuitGarden(
moist,
EnumAcidity.ALKALINE,
manual,
fertilised,
new ItemStack(Botany.insulatedTube, 1, 3 + 128 * insulate),
new ItemStack(BotanyItems.insulatedTube, 1, 3 + 128 * insulate),
icon);
}
}
@@ -154,7 +148,7 @@ public class ModuleGardening implements IInitializable {
GameRegistry.addRecipe(new CeramicTileRecipe());
for (int mat = 0; mat < 4; ++mat) {
for (int insulate = 0; insulate < 6; ++insulate) {
ItemStack tubes = new ItemStack(Botany.insulatedTube, 2, mat + 128 * insulate);
ItemStack tubes = new ItemStack(BotanyItems.insulatedTube, 2, mat + 128 * insulate);
ItemStack insulateStack = ItemInsulatedTube.getInsulateStack(tubes);
ItemStack forestryTube = new ItemStack(Mods.forestry.item("thermionicTubes"), 1, mat);
GameRegistry.addShapelessRecipe(tubes, forestryTube, forestryTube, insulateStack);
@@ -182,62 +176,61 @@ public class ModuleGardening implements IInitializable {
GameRegistry.addRecipe(
new ShapedOreRecipe(
Botany.trowelWood,
BotanyItems.trowelWood,
new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "plankWood" }));
GameRegistry.addRecipe(
new ShapedOreRecipe(
Botany.trowelStone,
BotanyItems.trowelStone,
new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "cobblestone" }));
GameRegistry.addRecipe(
new ShapedOreRecipe(
Botany.trowelIron,
BotanyItems.trowelIron,
new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "ingotIron" }));
GameRegistry.addRecipe(
new ShapedOreRecipe(
Botany.trowelGold,
BotanyItems.trowelGold,
new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "ingotGold" }));
GameRegistry.addRecipe(
new ShapedOreRecipe(
Botany.trowelDiamond,
BotanyItems.trowelDiamond,
new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "gemDiamond" }));
GameRegistry.addRecipe(
new ShapedOreRecipe(
Botany.soilMeter,
BotanyItems.soilMeter,
new Object[] { " gg", " rg", "i ", 'g', "ingotGold", 'r', "dustRedstone", 'i', "ingotIron" }));
GameRegistry.addShapelessRecipe(
BotanyItems.Weedkiller.get(4),
Weedkiller.get(4),
new ItemStack(Items.spider_eye),
new ItemStack(Items.wheat_seeds),
new ItemStack(Items.wheat_seeds),
new ItemStack(Items.wheat_seeds));
GameRegistry.addShapelessRecipe(BotanyItems.AshPowder.get(4), Mods.forestry.stack("ash"));
GameRegistry.addShapelessRecipe(BotanyItems.MulchPowder.get(4), Mods.forestry.stack("mulch"));
GameRegistry.addShapelessRecipe(BotanyItems.CompostPowder.get(4), Mods.forestry.stack("fertilizerBio"));
GameRegistry.addShapelessRecipe(BotanyItems.FertiliserPowder.get(4), Mods.forestry.stack("fertilizerCompound"));
GameRegistry.addShapelessRecipe(BotanyItems.PulpPowder.get(4), Mods.forestry.stack("woodPulp"));
GameRegistry
.addRecipe(new ShapelessOreRecipe(BotanyItems.SulphurPowder.get(4), new Object[] { "dustSulphur" }));
GameRegistry.addShapelessRecipe(AshPowder.get(4), Mods.forestry.stack("ash"));
GameRegistry.addShapelessRecipe(MulchPowder.get(4), Mods.forestry.stack("mulch"));
GameRegistry.addShapelessRecipe(CompostPowder.get(4), Mods.forestry.stack("fertilizerBio"));
GameRegistry.addShapelessRecipe(FertiliserPowder.get(4), Mods.forestry.stack("fertilizerCompound"));
GameRegistry.addShapelessRecipe(PulpPowder.get(4), Mods.forestry.stack("woodPulp"));
GameRegistry.addRecipe(new ShapelessOreRecipe(SulphurPowder.get(4), new Object[] { "dustSulphur" }));
GameRegistry.addRecipe(
new ShapelessOreRecipe(
new ItemStack(Botany.pigment, 2, EnumFlowerColor.BLACK.ordinal()),
new ItemStack(BotanyItems.pigment, 2, EnumFlowerColor.BLACK.ordinal()),
new Object[] { "pigment", "pigment", "dyeBlack" }));
ModuleGardening.queuedAcidFertilisers.put(BotanyItems.SulphurPowder.get(1), 1);
ModuleGardening.queuedAcidFertilisers.put(BotanyItems.MulchPowder.get(1), 1);
ModuleGardening.queuedAcidFertilisers.put(SulphurPowder.get(1), 1);
ModuleGardening.queuedAcidFertilisers.put(MulchPowder.get(1), 1);
ModuleGardening.queuedAcidFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "mulch")), 2);
for (ItemStack stack : OreDictionary.getOres("dustSulfur")) {
ModuleGardening.queuedAcidFertilisers.put(stack, 2);
}
ModuleGardening.queuedAlkalineFertilisers.put(BotanyItems.AshPowder.get(1), 1);
ModuleGardening.queuedAlkalineFertilisers.put(BotanyItems.PulpPowder.get(1), 1);
ModuleGardening.queuedAlkalineFertilisers.put(AshPowder.get(1), 1);
ModuleGardening.queuedAlkalineFertilisers.put(PulpPowder.get(1), 1);
ModuleGardening.queuedAlkalineFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "ash")), 2);
ModuleGardening.queuedAlkalineFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "woodPulp")), 2);
ModuleGardening.queuedNutrientFertilisers.put(BotanyItems.CompostPowder.get(1), 1);
ModuleGardening.queuedNutrientFertilisers.put(BotanyItems.FertiliserPowder.get(1), 1);
ModuleGardening.queuedNutrientFertilisers.put(CompostPowder.get(1), 1);
ModuleGardening.queuedNutrientFertilisers.put(FertiliserPowder.get(1), 1);
ModuleGardening.queuedNutrientFertilisers
.put(new ItemStack(GameRegistry.findItem("Forestry", "fertilizerBio")), 2);
ModuleGardening.queuedNutrientFertilisers
@@ -255,12 +248,11 @@ public class ModuleGardening implements IInitializable {
addNutrientFertiliser(entry.getKey(), entry.getValue());
}
GameRegistry
.addRecipe(BotanyItems.Mortar.get(6), " c ", "cgc", " c ", 'c', Items.clay_ball, 'g', Blocks.gravel);
GameRegistry.addRecipe(Mortar.get(6), " c ", "cgc", " c ", 'c', Items.clay_ball, 'g', Blocks.gravel);
for (EnumFlowerColor c : EnumFlowerColor.values()) {
ItemStack clay = new ItemStack(Botany.clay, 1, c.ordinal());
ItemStack pigment = new ItemStack(Botany.pigment, 1, c.ordinal());
ItemStack clay = new ItemStack(BotanyItems.clay, 1, c.ordinal());
ItemStack pigment = new ItemStack(BotanyItems.pigment, 1, c.ordinal());
GameRegistry.addShapelessRecipe(clay, Items.clay_ball, Items.clay_ball, Items.clay_ball, pigment);
GameRegistry.addSmelting(clay, TileEntityMetadata.getItemStack(Botany.ceramic, c.ordinal()), 0.0f);
ItemStack glass = TileEntityMetadata.getItemStack(Botany.stained, c.ordinal());
@@ -4,10 +4,9 @@ import forestry.api.genetics.IAlleleInteger;
public class AlleleColor implements IAlleleInteger {
private String uid;
private int value;
private EnumFlowerColor color;
private boolean dominant = true;
private final String uid;
private final int value;
private final EnumFlowerColor color;
public AlleleColor(EnumFlowerColor color, String uid, int value) {
this.color = color;
@@ -22,7 +21,7 @@ public class AlleleColor implements IAlleleInteger {
@Override
public boolean isDominant() {
return dominant;
return true;
}
@Override
@@ -93,10 +93,10 @@ public enum EnumFlowerColor implements IFlowerColor {
YELLOW_GREEN("yellowGreen", 0x9acd32);
private static final EnumFlowerColor[] ALL_VALUES = values();
private int color;
private int colorDis;
private String name;
private AlleleColor allele;
private final int color;
private final int colorDis;
private final String name;
private final AlleleColor allele;
EnumFlowerColor(String name, int color) {
this.name = name;
@@ -57,18 +57,18 @@ public enum EnumFlowerType implements IFlowerType {
DELPHINIUM(2),
HOLLYHOCK(2);
protected int sections;
protected IIcon[] stem;
protected IIcon[] petal;
protected IIcon[] variant;
protected IIcon[] unflowered;
protected IIcon seedStem;
protected IIcon seedPetal;
protected IIcon seedVariant;
protected IIcon pollenStem;
protected IIcon pollenPetal;
protected IIcon pollenVariant;
protected IIcon blank;
private final int sections;
private final IIcon[] stem;
private final IIcon[] petal;
private final IIcon[] variant;
private final IIcon[] unflowered;
private IIcon seedStem;
private IIcon seedPetal;
private IIcon seedVariant;
private IIcon pollenStem;
private IIcon pollenPetal;
private IIcon pollenVariant;
private IIcon blank;
EnumFlowerType() {
this(1);
@@ -96,7 +96,7 @@ public class FlowerGenome extends Genome implements IFlowerGenome {
@Override
public float getAgeChance() {
return 1.0f * (float) Math.sqrt(2.0f / getLifespan());
return (float) Math.sqrt(2.0f / getLifespan());
}
@Override
@@ -14,7 +14,6 @@ import net.minecraft.world.World;
import com.mojang.authlib.GameProfile;
import binnie.botany.Botany;
import binnie.botany.api.EnumFlowerChromosome;
import binnie.botany.api.EnumFlowerStage;
import binnie.botany.api.IAlleleFlowerSpecies;
@@ -24,6 +23,7 @@ import binnie.botany.api.IFlower;
import binnie.botany.api.IFlowerGenome;
import binnie.botany.api.IFlowerMutation;
import binnie.botany.api.IFlowerRoot;
import binnie.botany.items.BotanyItems;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IChromosomeType;
@@ -39,8 +39,8 @@ public class FlowerHelper extends SpeciesRoot implements IFlowerRoot {
protected static String UID = "rootFlowers";
private static ArrayList<IFlowerMutation> flowerMutations = new ArrayList<>();
private static ArrayList<IColourMix> colourMixes = new ArrayList<>();
private static final ArrayList<IFlowerMutation> flowerMutations = new ArrayList<>();
private static final ArrayList<IColourMix> colourMixes = new ArrayList<>();
protected Map<ItemStack, IFlower> conversions;
@@ -88,16 +88,16 @@ public class FlowerHelper extends SpeciesRoot implements IFlowerRoot {
return null;
}
Item flowerItem = Botany.flowerItem;
Item flowerItem = BotanyItems.flowerItem;
if (type == EnumFlowerStage.SEED.ordinal()) {
flowerItem = Botany.seed;
flowerItem = BotanyItems.seed;
}
if (type == EnumFlowerStage.POLLEN.ordinal()) {
flowerItem = Botany.pollen;
flowerItem = BotanyItems.pollen;
}
if (flowerItem != Botany.flowerItem) {
if (flowerItem != BotanyItems.flowerItem) {
((IFlower) flower).setAge(0);
}
@@ -113,13 +113,13 @@ public class FlowerHelper extends SpeciesRoot implements IFlowerRoot {
if (stack == null) {
return EnumFlowerStage.NONE;
}
if (stack.getItem() == Botany.flowerItem) {
if (stack.getItem() == BotanyItems.flowerItem) {
return EnumFlowerStage.FLOWER;
}
if (stack.getItem() == Botany.pollen) {
if (stack.getItem() == BotanyItems.pollen) {
return EnumFlowerStage.POLLEN;
}
if (stack.getItem() == Botany.seed) {
if (stack.getItem() == BotanyItems.seed) {
return EnumFlowerStage.SEED;
}
return EnumFlowerStage.NONE;
@@ -226,7 +226,7 @@ public class FlowerHelper extends SpeciesRoot implements IFlowerRoot {
}
@Override
public Class getMemberClass() {
public Class<? extends IIndividual> getMemberClass() {
return IFlower.class;
}
@@ -56,8 +56,7 @@ public enum FlowerSpecies implements IAlleleFlowerSpecies {
FOXGLOVE("foxglove", "digitalis", "purpurea", EnumFlowerType.FOXGLOVE, EnumFlowerColor.HOT_PINK),
ZINNIA("zinnia", "zinnia", "elegans", EnumFlowerType.ZINNIA, EnumFlowerColor.MEDIUM_VIOLET_RED,
EnumFlowerColor.YELLOW),
CHRYSANTHEMUM("chrysanthemum", "chrysanthemum", "\u00ef?? grandiflorum", EnumFlowerType.MUMS,
EnumFlowerColor.VIOLET),
CHRYSANTHEMUM("chrysanthemum", "chrysanthemum", "ï?? grandiflorum", EnumFlowerType.MUMS, EnumFlowerColor.VIOLET),
MARIGOLD("marigold", "calendula", "officinalis", EnumFlowerType.MARIGOLD, EnumFlowerColor.GOLD,
EnumFlowerColor.DARK_ORANGE),
GERANIUM("geranium", "geranium", "maderense", EnumFlowerType.GERANIUM, EnumFlowerColor.DEEP_PINK),
@@ -68,7 +67,7 @@ public enum FlowerSpecies implements IAlleleFlowerSpecies {
EnumFlowerColor.WHITE),
LILY("lily", "lilium", "auratum", EnumFlowerType.LILY, EnumFlowerColor.PINK, EnumFlowerColor.GOLD),
YARROW("yarrow", "achillea", "millefolium", EnumFlowerType.YARROW, EnumFlowerColor.YELLOW),
PETUNIA("petunia", "petunia", "\u00ef?? atkinsiana", EnumFlowerType.PETUNIA, EnumFlowerColor.MEDIUM_VIOLET_RED,
PETUNIA("petunia", "petunia", "ï?? atkinsiana", EnumFlowerType.PETUNIA, EnumFlowerColor.MEDIUM_VIOLET_RED,
EnumFlowerColor.THISTLE),
AGAPANTHUS("agapanthus", "agapanthus", "praecox", EnumFlowerType.AGAPANTHUS, EnumFlowerColor.DEEP_SKY_BLUE),
FUCHSIA("fuchsia", "fuchsia", "magellanica", EnumFlowerType.FUCHSIA, EnumFlowerColor.DEEP_PINK,
@@ -96,24 +95,24 @@ public enum FlowerSpecies implements IAlleleFlowerSpecies {
DELPHINIUM("delphinium", "delphinium", "staphisagria", EnumFlowerType.DELPHINIUM, EnumFlowerColor.DARK_SLATE_BLUE),
HOLLYHOCK("hollyhock", "Alcea", "rosea", EnumFlowerType.HOLLYHOCK, EnumFlowerColor.BLACK, EnumFlowerColor.GOLD);
protected EnumFlowerColor stemColor;
protected EnumAllele.Fertility fert;
protected EnumAllele.Lifespan life;
protected EnumAllele.Sappiness sap;
protected IFlowerType type;
protected String name;
protected String binomial;
protected String branchName;
protected EnumFlowerColor primaryColor;
protected EnumFlowerColor secondaryColor;
protected EnumTemperature temperature;
protected EnumAcidity pH;
protected EnumMoisture moisture;
protected EnumTolerance tempTolerance;
protected EnumTolerance pHTolerance;
protected EnumTolerance moistureTolerance;
protected List<IAllele[]> variantTemplates;
protected IClassification branch;
private EnumFlowerColor stemColor;
private EnumAllele.Fertility fert;
private EnumAllele.Lifespan life;
private EnumAllele.Sappiness sap;
private final IFlowerType type;
private final String name;
private final String binomial;
private final String branchName;
private final EnumFlowerColor primaryColor;
private final EnumFlowerColor secondaryColor;
private EnumTemperature temperature;
private EnumAcidity pH;
private EnumMoisture moisture;
private EnumTolerance tempTolerance;
private EnumTolerance pHTolerance;
private EnumTolerance moistureTolerance;
private final List<IAllele[]> variantTemplates;
private IClassification branch;
FlowerSpecies(String name, String branch, String binomial, IFlowerType type, EnumFlowerColor colour) {
this(name, branch, binomial, type, colour, colour);
@@ -14,6 +14,7 @@ import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany;
import binnie.botany.core.BotanyGUI;
import binnie.core.util.I18N;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -22,9 +23,13 @@ public class ItemDictionary extends Item {
protected IIcon iconMaster;
public ItemDictionary() {
final String name = "database";
setCreativeTab(CreativeTabBotany.instance);
setUnlocalizedName("database");
setUnlocalizedName(name);
setMaxStackSize(1);
GameRegistry.registerItem(this, name);
}
@Override
@@ -42,13 +47,13 @@ public class ItemDictionary extends Item {
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list) {
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
super.getSubItems(item, tab, list);
list.add(new ItemStack(item, 1, 1));
}
@@ -8,11 +8,9 @@ import binnie.Binnie;
import binnie.botany.Botany;
import binnie.botany.core.BotanyCore;
import binnie.botany.flower.BlockFlower;
import binnie.botany.flower.ItemFlower;
import binnie.botany.flower.ItemPollen;
import binnie.botany.flower.ItemSeed;
import binnie.botany.flower.RendererBotany;
import binnie.botany.flower.TileEntityFlower;
import binnie.botany.items.BotanyItems;
import binnie.core.BinnieCore;
import binnie.core.IInitializable;
import cpw.mods.fml.client.registry.RenderingRegistry;
@@ -30,14 +28,10 @@ public class ModuleGenetics implements IInitializable {
public void preInit() {
EnumFlowerColor.setupMutations();
Botany.flower = new BlockFlower();
Botany.flowerItem = new ItemFlower();
Botany.pollen = new ItemPollen();
Botany.seed = new ItemSeed();
AlleleManager.alleleRegistry.registerSpeciesRoot(BotanyCore.speciesRoot);
AlleleManager.alleleRegistry.registerAllele(ModuleGenetics.alleleEffectNone);
GameRegistry.registerBlock(Botany.flower, "flower");
BinnieCore.proxy.registerTileEntity(TileEntityFlower.class, "botany.tile.flower", null);
Botany.database = new ItemDictionary();
}
@Override
@@ -66,7 +60,7 @@ public class ModuleGenetics implements IInitializable {
100,
Binnie.Liquid.getLiquidStack("water", 2000),
null,
new ItemStack(Botany.database),
new ItemStack(BotanyItems.database),
"X#X",
"YEY",
"RDR",
@@ -1,62 +1,30 @@
package binnie.botany.items;
import java.util.List;
import net.minecraft.item.Item;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import binnie.botany.flower.ItemFlower;
import binnie.botany.flower.ItemInsulatedTube;
import binnie.botany.flower.ItemPollen;
import binnie.botany.flower.ItemSeed;
import binnie.botany.gardening.ItemSoilMeter;
import binnie.botany.gardening.ItemTrowel;
import binnie.botany.genetics.ItemDictionary;
import binnie.core.item.DamageItems;
import binnie.botany.Botany;
import binnie.core.item.IItemMisc;
import binnie.core.util.I18N;
public class BotanyItems {
public enum BotanyItems implements IItemMisc {
AshPowder("powderAsh"),
PulpPowder("powderPulp"),
MulchPowder("powderMulch"),
SulphurPowder("powderSulphur"),
FertiliserPowder("powderFertiliser"),
CompostPowder("powderCompost"),
Mortar("mortar"),
Weedkiller("weedkiller");
protected IIcon icon;
protected String name;
protected String iconPath;
BotanyItems(String name) {
this.name = name;
this.iconPath = name;
}
@Override
public IIcon getIcon(ItemStack itemStack) {
return icon;
}
@Override
public void registerIcons(IIconRegister register) {
icon = Botany.proxy.getIcon(register, iconPath);
}
@Override
public void addInformation(List data) {
// ignored
}
@Override
public String getName(ItemStack itemStack) {
return I18N.localise("botany.item." + name + ".name");
}
@Override
public ItemStack get(int count) {
return new ItemStack(Botany.misc, count, ordinal());
}
@Override
public boolean isActive() {
return true;
}
public static final ItemInsulatedTube insulatedTube = new ItemInsulatedTube();
public static final ItemSoilMeter soilMeter = new ItemSoilMeter();
public static final DamageItems misc = new BotanyMisc();
public static final ItemFlower flowerItem = new ItemFlower();
public static final ItemPigment pigment = new ItemPigment();
public static final ItemClay clay = new ItemClay();
public static final Item seed = new ItemSeed();
public static final Item pollen = new ItemPollen();
public static final ItemDictionary database = new ItemDictionary();
public static final ItemTrowel trowelWood = new ItemTrowel(Item.ToolMaterial.WOOD, "Wood");
public static final ItemTrowel trowelStone = new ItemTrowel(Item.ToolMaterial.STONE, "Stone");
public static final ItemTrowel trowelIron = new ItemTrowel(Item.ToolMaterial.IRON, "Iron");
public static final ItemTrowel trowelDiamond = new ItemTrowel(Item.ToolMaterial.EMERALD, "Diamond");
public static final ItemTrowel trowelGold = new ItemTrowel(Item.ToolMaterial.GOLD, "Gold");
}
@@ -0,0 +1,44 @@
package binnie.botany.items;
import static binnie.botany.Botany.BOTANY_MODID;
import static binnie.botany.items.BotanyItems.misc;
import java.util.Arrays;
import net.minecraft.item.ItemStack;
import binnie.botany.CreativeTabBotany;
import binnie.core.item.DamageItems;
public class BotanyMisc extends DamageItems {
public enum Items {
AshPowder("powderAsh"),
PulpPowder("powderPulp"),
MulchPowder("powderMulch"),
SulphurPowder("powderSulphur"),
FertiliserPowder("powderFertiliser"),
CompostPowder("powderCompost"),
Mortar("mortar"),
Weedkiller("weedkiller");
final String name;
private static final Items[] VALUES = values();
Items(String name) {
this.name = name;
}
public ItemStack get(int count) {
return misc.getStack(count, ordinal());
}
}
public BotanyMisc() {
super(
CreativeTabBotany.instance,
BOTANY_MODID,
Arrays.stream(Items.VALUES).map(i -> i.name).toArray(String[]::new));
}
}
@@ -13,19 +13,24 @@ import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany;
import binnie.botany.genetics.EnumFlowerColor;
import binnie.core.util.I18N;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemClay extends Item {
public ItemClay() {
setUnlocalizedName("clay");
final String name = "clay";
setUnlocalizedName(name);
setHasSubtypes(true);
setCreativeTab(CreativeTabBotany.instance);
GameRegistry.registerItem(this, name);
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(stack.getItemDamage()).getName());
}
@@ -44,7 +49,7 @@ public class ItemClay extends Item {
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list) {
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
for (EnumFlowerColor c : EnumFlowerColor.values()) {
list.add(new ItemStack(this, 1, c.ordinal()));
}
@@ -13,19 +13,24 @@ import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany;
import binnie.botany.genetics.EnumFlowerColor;
import binnie.core.util.I18N;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemPigment extends Item {
public ItemPigment() {
setUnlocalizedName("pigment");
final String name = "pigment";
setUnlocalizedName(name);
setHasSubtypes(true);
setCreativeTab(CreativeTabBotany.instance);
GameRegistry.registerItem(this, name);
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(stack.getItemDamage()).getName());
}
@@ -44,7 +49,7 @@ public class ItemPigment extends Item {
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list) {
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
for (EnumFlowerColor c : EnumFlowerColor.values()) {
list.add(new ItemStack(this, 1, c.ordinal()));
}
+3 -50
View File
@@ -1,16 +1,11 @@
package binnie.core;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import net.minecraftforge.common.MinecraftForge;
import binnie.Binnie;
import binnie.core.gui.IBinnieGUID;
import binnie.core.mod.parser.FieldParser;
import binnie.core.network.BinniePacketHandler;
import binnie.core.network.IPacketID;
import binnie.core.network.IPacketProvider;
@@ -23,17 +18,17 @@ import cpw.mods.fml.relauncher.Side;
public abstract class AbstractMod implements IPacketProvider, IInitializable {
private SimpleNetworkWrapper wrapper;
private final LinkedHashSet<Field> fields;
protected final List<IInitializable> modules;
public AbstractMod() {
fields = new LinkedHashSet<>();
modules = new ArrayList<>();
BinnieCore.registerMod(this);
MinecraftForge.EVENT_BUS.register(this);
}
public abstract boolean isActive();
public boolean isActive() {
return true;
}
@Override
public abstract String getChannel();
@@ -47,10 +42,6 @@ public abstract class AbstractMod implements IPacketProvider, IInitializable {
return new IBinnieGUID[0];
}
public Class[] getConfigs() {
return new Class[0];
}
public abstract IProxyCore getProxy();
public abstract String getModID();
@@ -67,32 +58,10 @@ public abstract class AbstractMod implements IPacketProvider, IInitializable {
return;
}
if (getConfigs() != null) {
for (Class cls : getConfigs()) {
Binnie.Configuration.registerConfiguration(cls, this);
}
}
getProxy().preInit();
for (IInitializable module : modules) {
module.preInit();
}
// TODO what does it mean?
Collections.addAll(fields, getClass().getFields());
for (Class cls : getClass().getClasses()) {
Collections.addAll(fields, getClass().getFields());
}
for (IInitializable module : modules) {
Collections.addAll(fields, module.getClass().getFields());
}
for (Field field4 : fields) {
try {
FieldParser.preInitParse(field4, this);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
@Override
@@ -108,14 +77,6 @@ public abstract class AbstractMod implements IPacketProvider, IInitializable {
for (IInitializable module : modules) {
module.init();
}
for (Field field : fields) {
try {
FieldParser.initParse(field, this);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
@Override
@@ -128,14 +89,6 @@ public abstract class AbstractMod implements IPacketProvider, IInitializable {
for (IInitializable module : modules) {
module.postInit();
}
for (Field field : fields) {
try {
FieldParser.postInitParse(field, this);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
protected void addModule(IInitializable init) {
+12 -38
View File
@@ -16,23 +16,17 @@ import binnie.core.craftgui.minecraft.ModuleCraftGUI;
import binnie.core.gui.BinnieCoreGUI;
import binnie.core.gui.BinnieGUIHandler;
import binnie.core.gui.IBinnieGUID;
import binnie.core.item.ItemGenesis;
import binnie.core.item.ModuleItems;
import binnie.core.liquid.FluidContainer;
import binnie.core.liquid.ItemFluidContainer;
import binnie.core.machines.MachineGroup;
import binnie.core.machines.storage.ModuleStorage;
import binnie.core.mod.config.ConfigurationMain;
import binnie.core.mod.config.ConfigurationMods;
import binnie.core.mod.parser.FieldParser;
import binnie.core.mod.parser.ItemParser;
import binnie.core.network.BinnieCorePacketID;
import binnie.core.network.BinniePacketHandler;
import binnie.core.network.IPacketID;
import binnie.core.proxy.BinnieProxy;
import binnie.core.proxy.IBinnieProxy;
import binnie.core.triggers.ModuleTrigger;
import binnie.genetics.item.ItemFieldKit;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
@@ -49,13 +43,16 @@ import forestry.api.core.ForestryEvent;
import forestry.plugins.PluginManager;
@Mod(
modid = "BinnieCore",
name = "Binnie Core",
version = BinnieCore.VERSION,
modid = BinnieCore.CORE_MODID,
name = BinnieCore.CORE_MOD_NAME,
version = Tags.VERSION,
useMetadata = true,
dependencies = "after:Forestry@[4.2,),required-after:gtnhlib@[0.0.10,)")
public class BinnieCore extends AbstractMod {
public static final String CORE_MODID = "BinnieCore";
public static final String CORE_MOD_NAME = "Binnie Core";
@Mod.Instance("BinnieCore")
public static BinnieCore instance;
@@ -63,15 +60,11 @@ public class BinnieCore extends AbstractMod {
public static BinnieProxy proxy;
public static int multipassRenderID;
private static List<AbstractMod> modList = new ArrayList<>();
private static final List<AbstractMod> modList = new ArrayList<>();
public static MachineGroup packageCompartment;
public static ItemGenesis genesis;
public static ItemFieldKit fieldKit;
public static final String VERSION = "GRADLETOKEN_VERSION";
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent evt) {
Binnie.Configuration.registerConfiguration(ConfigurationMods.class, this);
public void preInit(FMLPreInitializationEvent event) {
for (ManagerBase baseManager : Binnie.Managers) {
addModule(baseManager);
}
@@ -86,12 +79,12 @@ public class BinnieCore extends AbstractMod {
}
@Mod.EventHandler
public void init(FMLInitializationEvent evt) {
public void init(FMLInitializationEvent event) {
init();
}
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent evt) {
public void postInit(FMLPostInitializationEvent event) {
postInit();
}
@@ -107,7 +100,6 @@ public class BinnieCore extends AbstractMod {
Item item = new ItemFluidContainer(container);
GameRegistry.registerItem(item, item.getUnlocalizedName().substring(5));
}
FieldParser.parsers.add(new ItemParser());
super.preInit();
}
@@ -135,20 +127,12 @@ public class BinnieCore extends AbstractMod {
return PluginManager.Module.ARBORICULTURE.isEnabled();
}
public static boolean isBotanyActive() {
return ConfigurationMods.botany;
}
public static boolean isGeneticsActive() {
return ConfigurationMods.genetics;
}
public static boolean isExtraBeesActive() {
return ConfigurationMods.extraBees && isApicultureActive();
return isApicultureActive();
}
public static boolean isExtraTreesActive() {
return ConfigurationMods.extraTrees && isArboricultureActive();
return isArboricultureActive();
}
@Override
@@ -216,21 +200,11 @@ public class BinnieCore extends AbstractMod {
Binnie.Resource.registerIcons(event.map, event.map.getTextureType());
}
@Override
public Class<?>[] getConfigs() {
return new Class[] { ConfigurationMain.class };
}
@Override
protected Class<? extends BinniePacketHandler> getPacketHandler() {
return PacketHandler.class;
}
@Override
public boolean isActive() {
return true;
}
public static class PacketHandler extends BinniePacketHandler {
public PacketHandler() {
@@ -2,9 +2,9 @@ package binnie.core;
public interface IInitializable {
void preInit();
default void preInit() {}
void init();
default void init() {}
void postInit();
default void postInit() {}
}
@@ -7,19 +7,4 @@ public abstract class ManagerBase implements IInitializable {
public ManagerBase() {
Binnie.Managers.add(this);
}
@Override
public void preInit() {
// ignored
}
@Override
public void init() {
// ignored
}
@Override
public void postInit() {
// ignored
}
}
+21 -20
View File
@@ -9,14 +9,16 @@ import cpw.mods.fml.common.registry.GameRegistry;
public class Mods {
public static Mod forestry;
public static Mod ic2;
public static Mod botania;
public static Mod extraBiomes;
public static final Mod forestry = new Mod("Forestry");
public static final Mod ic2 = new Mod("IC2");
public static final Mod botania = new Mod("Botania");
public static final Mod extraBiomes = new Mod("ExtrabiomesXL");
public static final Mod dreamcraft = new Mod("dreamcraft");
public static final Mod buildcraftCore = new Mod("BuildCraft|Core");
private static Item findItem(String modId, String name) {
Item stack = GameRegistry.findItem(modId, name);
if (stack == null && modId.equals("Forestry")) {
if (stack == null && forestry.matchID(modId)) {
throw new RuntimeException("Item not found: " + modId + ":" + name);
}
return stack;
@@ -24,7 +26,7 @@ public class Mods {
private static ItemStack findItemStack(String modId, String name, int stackSize) {
ItemStack stack = GameRegistry.findItemStack(modId, name, stackSize);
if (stack == null && modId.equals("Forestry")) {
if (stack == null && forestry.matchID(modId)) {
throw new RuntimeException("Stack not found: " + modId + ":" + name);
}
return stack;
@@ -32,37 +34,32 @@ public class Mods {
private static Block findBlock(String modId, String name) {
Block stack = GameRegistry.findBlock(modId, name);
if (stack == null && modId.equals("Forestry")) {
if (stack == null && forestry.matchID(modId)) {
throw new RuntimeException("Block not found: " + modId + ":" + name);
}
return stack;
}
static {
Mods.forestry = new Mod("Forestry");
Mods.ic2 = new Mod("IC2");
Mods.botania = new Mod("Botania");
Mods.extraBiomes = new Mod("ExtrabiomesXL");
}
public static class Mod {
private String id;
private final String modid;
private final boolean isLoaded;
private Mod(String id) {
this.id = id;
modid = id;
isLoaded = Loader.isModLoaded(id);
}
public Item item(String name) {
return findItem(id, name);
return findItem(modid, name);
}
public Block block(String name) {
return findBlock(id, name);
return findBlock(modid, name);
}
public ItemStack stack(String name, int stackSize) {
return findItemStack(id, name, stackSize);
return findItemStack(modid, name, stackSize);
}
public ItemStack stack(String name) {
@@ -74,7 +71,11 @@ public class Mods {
}
public boolean active() {
return Loader.isModLoaded(id);
return isLoaded;
}
public boolean matchID(final String id) {
return modid.equals(id);
}
}
}
@@ -13,7 +13,6 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import binnie.core.BinnieCore;
@@ -61,16 +60,6 @@ public class BlockMetadata extends BlockContainer implements IBlockMetadata {
return getLocalizedName();
}
@Override
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
// ignored
}
@Override
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
return TileEntityMetadata.getItemDamage(itemStack);
}
@Override
public int getDroppedMeta(int blockMeta, int tileMeta) {
return blockMeta;
@@ -97,7 +86,7 @@ public class BlockMetadata extends BlockContainer implements IBlockMetadata {
boolean hasBeenBroken = world.setBlockToAir(i, j, k);
if (hasBeenBroken && BinnieCore.proxy.isSimulating(world)
&& drops.size() > 0
&& !drops.isEmpty()
&& (player == null || !player.capabilities.isCreativeMode)) {
for (ItemStack drop : drops) {
block.dropAsStack(world, i, j, k, drop);
@@ -9,13 +9,17 @@ import net.minecraftforge.common.util.ForgeDirection;
public interface IBlockMetadata extends ITileEntityProvider {
int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction);
default int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
return TileEntityMetadata.getItemDamage(itemStack);
}
int getDroppedMeta(int blockMeta, int tileMeta);
default int getDroppedMeta(int blockMeta, int tileMeta) {
return tileMeta;
}
String getBlockName(ItemStack itemStack);
void addBlockTooltip(ItemStack itemStack, List tooltip);
default void addBlockTooltip(ItemStack itemStack, List<String> tooltip) {}
void dropAsStack(World world, int x, int y, int z, ItemStack itemStack);
}
@@ -19,11 +19,6 @@ public class ItemMetadata extends ItemBlock {
super(block);
}
@Override
public int getMetadata(int damage) {
return 0;
}
@Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
float hitX, float hitY, float hitZ, int metadata) {
@@ -56,7 +51,7 @@ public class ItemMetadata extends ItemBlock {
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemStack, EntityPlayer player, List tooltip, boolean advanced) {
public void addInformation(ItemStack itemStack, EntityPlayer player, List<String> tooltip, boolean advanced) {
((IBlockMetadata) field_150939_a).addBlockTooltip(itemStack, tooltip);
}
@@ -34,14 +34,10 @@ public class MultipassItemRenderer implements IItemRenderer {
@Override
public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) {
switch (type) {
case ENTITY:
case EQUIPPED:
case INVENTORY:
case EQUIPPED_FIRST_PERSON:
return true;
}
return false;
return switch (type) {
case ENTITY, EQUIPPED, INVENTORY, EQUIPPED_FIRST_PERSON -> true;
default -> false;
};
}
@Override
@@ -12,9 +12,9 @@ import forestry.api.circuits.ICircuitLayout;
public class BinnieCircuit implements ICircuit {
private String uid;
private int limit;
private List<String> tooltips;
private final String uid;
private final int limit;
private final List<String> tooltips;
public BinnieCircuit(String uid, int limit, ICircuitLayout layout, ItemStack itemStack) {
tooltips = new ArrayList<>();
@@ -9,8 +9,8 @@ import forestry.api.circuits.ICircuitSocketType;
public class BinnieCircuitLayout implements ICircuitLayout {
private String uid;
private AbstractMod mod;
private final String uid;
private final AbstractMod mod;
public BinnieCircuitLayout(AbstractMod mod, String uid) {
this.uid = uid;
@@ -39,13 +39,11 @@ public class Tooltip {
}
public boolean exists() {
return tooltip.size() > 0;
return !tooltip.isEmpty();
}
public void add(List list) {
for (Object obj : list) {
tooltip.add((String) obj);
}
public void add(List<String> list) {
tooltip.addAll(list);
}
public List<String> getList() {
@@ -19,17 +19,16 @@ public class Widget implements IWidget {
protected int color;
private IWidget parent;
private List<IWidget> subWidgets;
private List<WidgetAttribute> attributes;
private final List<IWidget> subWidgets;
private final List<WidgetAttribute> attributes;
private IPoint position;
private IPoint size;
private IPoint offset;
private Collection<EventHandler> globalEventHandlers;
private final Collection<EventHandler> globalEventHandlers;
private boolean enabled;
private boolean visible;
public Widget(IWidget parent) {
this.parent = null;
subWidgets = new ArrayList<>();
attributes = new ArrayList<>();
position = new IPoint(0.0f, 0.0f);
@@ -91,7 +90,7 @@ public class Widget implements IWidget {
@Override
public IWidget addWidget(IWidget widget) {
if (subWidgets.size() != 0
if (!subWidgets.isEmpty()
&& subWidgets.get(subWidgets.size() - 1).hasAttribute(WidgetAttribute.ALWAYS_ON_TOP)) {
subWidgets.add(subWidgets.size() - 1, widget);
} else {
@@ -32,6 +32,7 @@ import binnie.core.craftgui.resource.StyleSheet;
import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
import binnie.core.craftgui.resource.minecraft.PaddedTexture;
import binnie.core.craftgui.resource.minecraft.StandardTexture;
import binnie.core.item.BinnieItems;
import binnie.core.machines.inventory.SlotValidator;
import binnie.core.util.I18N;
import binnie.extrabees.core.ExtraBeeTexture;
@@ -51,13 +52,13 @@ public class WindowFieldKit extends Window {
private float glassOffsetY;
private float glassVX;
private float glassVY;
private Random glassRand;
private final Random glassRand;
private Control GlassControl;
private ControlChromosome chromo;
private ControlText text;
private float analyseProgress;
private boolean isAnalysing;
private Map<IChromosomeType, String> info;
private final Map<IChromosomeType, String> info;
public WindowFieldKit(EntityPlayer player, IInventory inventory, Side side) {
super(280.0f, 230.0f, player, inventory, side);
@@ -225,7 +226,7 @@ public class WindowFieldKit extends Window {
super.onWindowInventoryChanged();
if (isServer()) {
ItemStack kit = getPlayer().getHeldItem();
if (kit == null || !kit.getItem().equals(BinnieCore.fieldKit)) {
if (kit == null || !kit.getItem().equals(BinnieItems.fieldKit)) {
return;
}
@@ -75,7 +75,7 @@ public class WindowGenesis extends Window {
new Panel(this, one.outset(1), MinecraftGUI.PanelType.Black);
new Panel(this, two.outset(1), MinecraftGUI.PanelType.Black);
geneList = new ControlListBox<Gene>(this, one.x(), one.y(), one.w(), one.h(), 10.0f) {
geneList = new ControlListBox<>(this, one.x(), one.y(), one.w(), one.h(), 10.0f) {
@Override
public IWidget createOption(Gene value, int y) {
@@ -83,7 +83,7 @@ public class WindowGenesis extends Window {
}
};
geneOptions = new ControlListBox<Gene>(this, two.x(), two.y(), two.w(), two.h(), 10.0f) {
geneOptions = new ControlListBox<>(this, two.x(), two.y(), two.w(), two.h(), 10.0f) {
@Override
public IWidget createOption(Gene value, int y) {
@@ -28,7 +28,7 @@ public class ControlButton extends Control {
textWidget = new ControlText(this, getArea(), text, TextJustification.MIDDLE_CENTER);
}
private EventMouse.Down.Handler mouseHandler = new EventMouse.Down.Handler() {
private final EventMouse.Down.Handler mouseHandler = new EventMouse.Down.Handler() {
@Override
public void onEvent(EventMouse.Down event) {
@@ -23,7 +23,7 @@ public class ControlCheckbox extends Control implements IControlValue<Boolean> {
}
public ControlCheckbox(IWidget parent, float x, float y, float w, String text, boolean bool) {
super(parent, x, y, (w > 16.0f) ? w : 16.0f, 16.0f);
super(parent, x, y, Math.max(w, 16.0f), 16.0f);
this.text = text;
value = bool;
if (w > 16.0f) {
@@ -11,7 +11,7 @@ import binnie.core.craftgui.geometry.TextJustification;
public class ControlText extends Control implements IControlValue<String> {
private String text;
private TextJustification align;
private final TextJustification align;
public ControlText(IWidget parent, IPoint pos, String text) {
this(parent, new IArea(pos, new IPoint(500.0f, 0.0f)), text, TextJustification.TOP_LEFT);
@@ -69,11 +69,6 @@ public class ControlTextEdit extends Control implements IControlValue<String> {
}.setOrigin(EventHandler.Origin.Self, this));
}
@Override
public void onUpdateClient() {
// ignored
}
protected void onTextEdit(String value) {
// ignored
}
@@ -38,11 +38,6 @@ public class Control extends Widget implements ITooltipHelp, ITooltip {
// ignored
}
@Override
public void onUpdateClient() {
// ignored
}
public void addHelp(String string) {
helpStrings.add(string);
}
@@ -37,7 +37,7 @@ public class ControlOption<T> extends Control implements IControlValue<T> {
setColor(color);
}
private EventMouse.Down.Handler mouseHandler = new EventMouse.Down.Handler() {
private final EventMouse.Down.Handler mouseHandler = new EventMouse.Down.Handler() {
@Override
public void onEvent(EventMouse.Down event) {
@@ -22,7 +22,7 @@ public class ControlTextOption<T> extends ControlOption<T> {
this(controlList, option, option.toString(), y);
}
private EventWidget.ChangeColour.Handler mouseHandler = new EventWidget.ChangeColour.Handler() {
private final EventWidget.ChangeColour.Handler mouseHandler = new EventWidget.ChangeColour.Handler() {
@Override
public void onEvent(EventWidget.ChangeColour event) {
@@ -15,8 +15,8 @@ public class ControlPage<T> extends Control implements IControlValue<T> {
public ControlPage(IWidget parent, float x, float y, float w, float h, T value) {
super(parent, x, y, w, h);
setValue(value);
if (parent instanceof IControlValue && ((IControlValue) parent).getValue() == null) {
((IControlValue) parent).setValue(value);
if (parent instanceof IControlValue cv && ((IControlValue<?>) parent).getValue() == null) {
cv.setValue(value);
}
}
@@ -41,7 +41,7 @@ public class ControlPages<T> extends Control implements IControlValues<T>, ICont
public Collection<T> getValues() {
List<T> list = new ArrayList<>();
for (IWidget child : getWidgets()) {
list.add((T) ((IControlValue) child).getValue());
list.add((T) ((IControlValue<?>) child).getValue());
}
return list;
}
@@ -5,7 +5,7 @@ import binnie.core.craftgui.controls.core.Control;
public class ControlScroll extends Control {
private IControlScrollable scrollWidget;
private final IControlScrollable scrollWidget;
public ControlScroll(IWidget parent, float x, float y, float width, float height, IControlScrollable scrollWidget) {
super(parent, x, y, width, height);
@@ -30,7 +30,7 @@ public class ControlScrollBar extends Control {
addSelfEventHandler(mouseDownHandler);
}
private EventMouse.Down.Handler mouseDownHandler = new EventMouse.Down.Handler() {
private final EventMouse.Down.Handler mouseDownHandler = new EventMouse.Down.Handler() {
@Override
public void onEvent(EventMouse.Down event) {
@@ -50,11 +50,6 @@ public class ControlScrollBar extends Control {
}
};
@Override
public void onUpdateClient() {
// ignored
}
@Override
public void onRenderBackground() {
IArea renderArea = getRenderArea();
@@ -29,7 +29,7 @@ public class ControlScrollableContent<T extends IWidget> extends Control impleme
setPercentageIndex(getPercentageIndex());
}
private EventMouse.Wheel.Handler mouseWheelHandler = new EventMouse.Wheel.Handler() {
private final EventMouse.Wheel.Handler mouseWheelHandler = new EventMouse.Wheel.Handler() {
@Override
public void onEvent(EventMouse.Wheel event) {
@@ -20,7 +20,7 @@ public class ControlTab<T> extends Control implements ITooltip, IControlValue<T>
protected T value;
private ControlTabBar<T> tabBar;
private final ControlTabBar<T> tabBar;
public ControlTab(ControlTabBar<T> parent, float x, float y, float w, float h, T value) {
super(parent, x, y, w, h);
@@ -59,8 +59,7 @@ public class ControlTab<T> extends Control implements ITooltip, IControlValue<T>
}
CraftGUI.render.texture(iTexture, area);
if (this instanceof ControlTabIcon) {
ControlTabIcon icon = (ControlTabIcon) this;
if (this instanceof ControlTabIcon icon) {
ControlItemDisplay item = (ControlItemDisplay) getWidgets().get(0);
if (texture == CraftGUITexture.TabDisabled) {
item.setColor(0xaaaaaaaa);
@@ -13,9 +13,9 @@ import binnie.core.genetics.BreedingSystem;
class ControlBreedingProgress extends Control {
private static Texture Progress = new StandardTexture(80, 22, 4, 4, CraftGUITextureSheet.Controls2);
private float percentage;
private int colour;
private static final Texture Progress = new StandardTexture(80, 22, 4, 4, CraftGUITextureSheet.Controls2);
private final float percentage;
private final int colour;
public ControlBreedingProgress(IWidget parent, int x, int y, int width, int height, BreedingSystem system,
float percentage) {
@@ -12,7 +12,7 @@ import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
public class ControlItemStackOption extends ControlTextOption<ItemStack> {
private ControlItemDisplay controlBee;
private final ControlItemDisplay controlBee;
public ControlItemStackOption(ControlList<ItemStack> controlList, ItemStack option, int y) {
super(controlList, option, option.getDisplayName(), y);
@@ -11,7 +11,7 @@ import forestry.api.genetics.IMutation;
class ControlMutationBox extends ControlListBox<IMutation> {
private Type type;
private final Type type;
private IAlleleSpecies species;
@Override
@@ -17,11 +17,11 @@ import forestry.api.genetics.IMutation;
class ControlMutationSymbol extends Control implements ITooltip {
private static Texture MutationPlus = new StandardTexture(2, 94, 16, 16, CraftGUITextureSheet.Controls2);
private static Texture MutationArrow = new StandardTexture(20, 94, 32, 16, CraftGUITextureSheet.Controls2);
private static final Texture MutationPlus = new StandardTexture(2, 94, 16, 16, CraftGUITextureSheet.Controls2);
private static final Texture MutationArrow = new StandardTexture(20, 94, 32, 16, CraftGUITextureSheet.Controls2);
private IMutation value;
private boolean discovered;
private int type;
private final int type;
@Override
public void onRenderBackground() {
@@ -11,7 +11,7 @@ import forestry.api.genetics.IAlleleSpecies;
class ControlSpeciesBoxOption extends ControlTextOption<IAlleleSpecies> {
private ControlDatabaseIndividualDisplay controlBee;
private final ControlDatabaseIndividualDisplay controlBee;
public ControlSpeciesBoxOption(ControlList<IAlleleSpecies> controlList, IAlleleSpecies option, int y) {
super(controlList, option, option.getName(), y);
@@ -7,8 +7,8 @@ import binnie.core.util.I18N;
public class DatabaseTab implements ITooltipHelp {
private String mod;
private String unloc;
private final String mod;
private final String unloc;
public DatabaseTab(AbstractMod mod, String unloc) {
this.mod = mod.getModID();
@@ -14,10 +14,10 @@ import forestry.api.genetics.IClassification;
public class PageBranchOverview extends PageBranch {
private ControlText branchName;
private ControlText branchScientific;
private ControlText branchAuthority;
private List<ControlText> branchDescription;
private final ControlText branchName;
private final ControlText branchScientific;
private final ControlText branchAuthority;
private final List<ControlText> branchDescription;
public PageBranchOverview(IWidget parent, DatabaseTab tab) {
super(parent, tab);
@@ -10,7 +10,7 @@ import forestry.api.genetics.IClassification;
public class PageBranchSpecies extends PageBranch {
private ControlSpeciesBox speciesList;
private final ControlSpeciesBox speciesList;
@Mod.EventHandler
public void onHandleEvent(EventValueChanged<IAlleleSpecies> event) {
@@ -13,7 +13,7 @@ import binnie.core.util.I18N;
public class PageBreeder extends ControlPage<DatabaseTab> {
private GameProfile player;
private final GameProfile player;
public PageBreeder(IWidget parent, GameProfile player, DatabaseTab tab) {
super(parent, 0.0f, 0.0f, parent.getSize().x(), parent.getSize().y(), tab);
@@ -22,7 +22,7 @@ public class PageBreeder extends ControlPage<DatabaseTab> {
}
public void onPageRefresh() {
while (getWidgets().size() > 0) {
while (!getWidgets().isEmpty()) {
deleteChild(getWidgets().get(0));
}
@@ -11,8 +11,8 @@ import forestry.api.genetics.IClassification;
public class PageSpeciesClassification extends PageSpecies {
private Map<IClassification.EnumClassLevel, ControlText> levels;
private ControlText genus;
private final Map<IClassification.EnumClassLevel, ControlText> levels;
private final ControlText genus;
public PageSpeciesClassification(IWidget parent, DatabaseTab tab) {
super(parent, tab);
@@ -7,7 +7,7 @@ import forestry.api.genetics.IAlleleSpecies;
public class PageSpeciesMutations extends PageSpecies {
private ControlMutationBox list;
private final ControlMutationBox list;
public PageSpeciesMutations(IWidget parent, DatabaseTab tab) {
super(parent, tab);
@@ -14,14 +14,14 @@ import forestry.api.genetics.IAlleleSpecies;
public class PageSpeciesOverview extends PageSpecies {
private ControlText controlName;
private ControlText controlScientific;
private ControlText controlAuthority;
private ControlText controlComplexity;
private ControlText controlDescription;
private ControlText controlSignature;
private ControlDatabaseIndividualDisplay controlInd1;
private ControlDatabaseIndividualDisplay controlInd2;
private final ControlText controlName;
private final ControlText controlScientific;
private final ControlText controlAuthority;
private final ControlText controlComplexity;
private final ControlText controlDescription;
private final ControlText controlSignature;
private final ControlDatabaseIndividualDisplay controlInd1;
private final ControlDatabaseIndividualDisplay controlInd2;
public PageSpeciesOverview(IWidget parent, DatabaseTab tab) {
super(parent, tab);
@@ -58,23 +58,23 @@ public class PageSpeciesOverview extends PageSpecies {
+ EnumChatFormatting.RESET);
controlComplexity.setValue(I18N.localise("extratrees.genetics.complexity", species.getComplexity()));
String desc = species.getDescription();
String descBody = EnumChatFormatting.ITALIC.toString();
StringBuilder descBody = new StringBuilder(EnumChatFormatting.ITALIC.toString());
String descSig = "";
if (desc == null || desc.isEmpty() || desc.matches("(\\w+\\.?)+")) {
descBody += I18N.localise("binniecore.gui.database.species.noDesc");
descBody.append(I18N.localise("binniecore.gui.database.species.noDesc"));
} else {
String[] descStrings = desc.split("\\|");
descBody += descStrings[0];
descBody.append(descStrings[0]);
for (int i = 1; i < descStrings.length - 1; ++i) {
descBody = descBody + " " + descStrings[i];
descBody.append(" ").append(descStrings[i]);
}
if (descStrings.length > 1) {
descSig += descStrings[descStrings.length - 1];
}
}
controlDescription.setValue(descBody + EnumChatFormatting.RESET);
controlDescription.setValue(descBody.toString() + EnumChatFormatting.RESET);
controlSignature.setValue(descSig + EnumChatFormatting.RESET);
float descHeight = CraftGUI.render.textHeight(controlDescription.getValue(), controlDescription.getSize().x());
controlSignature.setPosition(
@@ -7,7 +7,7 @@ import forestry.api.genetics.IAlleleSpecies;
public class PageSpeciesResultant extends PageSpecies {
private ControlMutationBox list;
private final ControlMutationBox list;
public PageSpeciesResultant(IWidget parent, DatabaseTab tab) {
super(parent, tab);
@@ -40,8 +40,8 @@ public abstract class WindowAbstractDatabase extends Window {
protected boolean isNEI;
private float selectionBoxWidth;
private Map<IDatabaseMode, ModeWidgets> modes;
private BreedingSystem system;
private final Map<IDatabaseMode, ModeWidgets> modes;
private final BreedingSystem system;
private Panel panelInformation;
private Panel panelSearch;
private ControlPages<IDatabaseMode> modePages;
@@ -88,13 +88,12 @@ public abstract class WindowAbstractDatabase extends Window {
@Override
public void onEvent(EventValueChanged event) {
if (!(event.getOrigin().getParent() instanceof ControlPage)) {
if (!(event.getOrigin().getParent() instanceof ControlPage parent)) {
return;
} else if ((event.getValue() instanceof DatabaseTab)) {
return;
}
ControlPage parent = (ControlPage) event.getOrigin().getParent();
if (!(parent.getValue() instanceof IDatabaseMode)) {
return;
}
@@ -185,7 +184,7 @@ public abstract class WindowAbstractDatabase extends Window {
@Override
public ControlTab<IDatabaseMode> createTab(float x, float y, float w, float h, IDatabaseMode value) {
return new ControlTab<IDatabaseMode>(this, x, y, w, h, value) {
return new ControlTab<>(this, x, y, w, h, value) {
@Override
public String getName() {
@@ -199,7 +198,7 @@ public abstract class WindowAbstractDatabase extends Window {
CraftGUIUtil.linkWidgets(tab, modePages);
changeMode(Mode.Species);
for (IDatabaseMode mode : modes.keySet()) {
modes.get(mode).infoTabs = new ControlTabBar(
modes.get(mode).infoTabs = new ControlTabBar<>(
modes.get(mode).modePage,
8.0f,
24.0f,
@@ -266,7 +265,7 @@ public abstract class WindowAbstractDatabase extends Window {
public ControlPage<IDatabaseMode> modePage;
public ControlListBox listBox;
private ControlPages<DatabaseTab> infoPages;
private final ControlPages<DatabaseTab> infoPages;
private ControlTabBar<DatabaseTab> infoTabs;
public ModeWidgets(IDatabaseMode mode, WindowAbstractDatabase database) {
@@ -33,20 +33,12 @@ public abstract class EventHandler<E extends Event> {
DirectChild;
public boolean isOrigin(IWidget origin, IWidget test) {
switch (this) {
case Any:
return true;
case DirectChild:
return test.getWidgets().contains(origin);
case Parent:
return test.getParent() == origin;
case Self:
return test == origin;
}
return false;
return switch (this) {
case Any -> true;
case DirectChild -> test.getWidgets().contains(origin);
case Parent -> test.getParent() == origin;
case Self -> test == origin;
};
}
}
}
@@ -7,8 +7,8 @@ public enum Position {
LEFT(-1, 0),
RIGHT(1, 0);
protected int x;
protected int y;
private final int x;
private final int y;
Position(int x, int y) {
this.x = x;
@@ -24,19 +24,11 @@ public enum Position {
}
public Position opposite() {
switch (this) {
case BOTTOM:
return Position.TOP;
case LEFT:
return Position.RIGHT;
case RIGHT:
return Position.LEFT;
case TOP:
return Position.BOTTOM;
}
return null;
return switch (this) {
case BOTTOM -> Position.TOP;
case LEFT -> Position.RIGHT;
case RIGHT -> Position.LEFT;
case TOP -> Position.BOTTOM;
};
}
}
@@ -12,8 +12,8 @@ public enum TextJustification {
BOTTOM_CENTER(0.5f, 1.0f),
BOTTOM_RIGHT(1.0f, 1.0f);
protected float xOffset;
protected float yOffset;
final float xOffset;
final float yOffset;
TextJustification(float xOffset, float yOffset) {
this.xOffset = xOffset;
@@ -36,10 +36,10 @@ import cpw.mods.fml.relauncher.Side;
public class ContainerCraftGUI extends Container {
private Window window;
private Map<String, NBTTagCompound> syncedNBT;
private Map<String, NBTTagCompound> sentNBT;
private Map<Integer, TankInfo> syncedTanks;
private final Window window;
private final Map<String, NBTTagCompound> syncedNBT;
private final Map<String, NBTTagCompound> sentNBT;
private final Map<Integer, TankInfo> syncedTanks;
private PowerInfo syncedPower;
private ProcessInfo syncedProcess;
private int errorType;
@@ -61,8 +61,8 @@ public class ContainerCraftGUI extends Container {
return;
}
inventoryItemStacks = new ListMap();
inventorySlots = new ListMap();
inventoryItemStacks = new ListMap<>();
inventorySlots = new ListMap<>();
if (machine == null) {
return;
}
@@ -89,7 +89,7 @@ public class ContainerCraftGUI extends Container {
if (index < 0 || index >= inventorySlots.size()) {
return null;
}
return (Slot) inventorySlots.get(index);
return inventorySlots.get(index);
}
@Override
@@ -145,9 +145,9 @@ public class ContainerCraftGUI extends Container {
@Override
public boolean canInteractWith(EntityPlayer player) {
if (player instanceof EntityPlayerMP) {
if (!crafters.contains(player)) {
crafters.add(player);
if (player instanceof EntityPlayerMP playerMP) {
if (!crafters.contains(playerMP)) {
crafters.add(playerMP);
}
sentNBT.clear();
}
@@ -167,7 +167,7 @@ public class ContainerCraftGUI extends Container {
}
ItemStack stack = request.transfer(true);
Slot shiftClickedSlot = (Slot) inventorySlots.get(index);
Slot shiftClickedSlot = inventorySlots.get(index);
shiftClickedSlot.putStack(stack);
shiftClickedSlot.onSlotChanged();
return null;
@@ -233,9 +233,8 @@ public class ContainerCraftGUI extends Container {
int slotNumber = action.getShort("n");
getOrCreateSlot(InventoryType.values()[type % 4], index, slotNumber);
for (Object crafterObject : crafters) {
ICrafting crafter = (ICrafting) crafterObject;
crafter.sendContainerAndContentsToPlayer(this, getInventory());
for (ICrafting crafterObject : crafters) {
crafterObject.sendContainerAndContentsToPlayer(this, getInventory());
}
}
}
@@ -299,9 +298,8 @@ public class ContainerCraftGUI extends Container {
if (shouldSend) {
for (Object crafter : crafters) {
if (crafter instanceof EntityPlayerMP) {
EntityPlayerMP player = (EntityPlayerMP) crafter;
BinnieCore.proxy.sendToPlayer(new MessageContainerUpdate(nbt.getValue()), player);
if (crafter instanceof EntityPlayerMP playerMP) {
BinnieCore.proxy.sendToPlayer(new MessageContainerUpdate(nbt.getValue()), playerMP);
}
}
sentThisTime.put(nbt.getKey(), nbt.getValue());
@@ -20,9 +20,9 @@ public enum EnumColor {
Yellow("Yellow", 16777045, 'e'),
White("White", 16777215, 'f');
protected int colour;
protected String name;
protected char code;
private final int colour;
private final String name;
private final char code;
EnumColor(String name, int colour, char code) {
this.name = name;
@@ -35,7 +35,7 @@ public enum EnumColor {
}
public String getCode() {
return "\u00a7" + code;
return "§" + code;
}
@Override
@@ -21,7 +21,7 @@ public enum GUIIcon {
ArrowLeftDown("arrow-leftdown"),
ArrowLeftUp("arrow-leftup");
String path;
final String path;
BinnieIcon icon;
GUIIcon(String path) {
@@ -38,7 +38,7 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiCraftGUI extends GuiContainer {
private Window window;
private final Window window;
private ItemStack draggedItem;
public GuiCraftGUI(Window window) {
@@ -9,7 +9,7 @@ import java.util.Map;
class ListMap<T> implements List<T> {
private LinkedHashMap<Integer, T> map;
private final LinkedHashMap<Integer, T> map;
ListMap() {
map = new LinkedHashMap<>();
@@ -33,9 +33,9 @@ public class MinecraftTooltip extends Tooltip {
USER(0x962433, EnumChatFormatting.RED, EnumChatFormatting.DARK_RED),
POWER(0x896e00, EnumChatFormatting.YELLOW, EnumChatFormatting.GOLD);
int outline;
String mainText;
String bodyText;
final int outline;
final String mainText;
final String bodyText;
TypeColor(int outline, EnumChatFormatting mainText, EnumChatFormatting bodyText) {
this.outline = outline;
@@ -4,12 +4,6 @@ import binnie.core.IInitializable;
public class ModuleCraftGUI implements IInitializable {
@Override
public void preInit() {}
@Override
public void init() {}
@Override
public void postInit() {
for (GUIIcon icon : GUIIcon.values()) {
@@ -53,15 +53,15 @@ public abstract class Window extends TopLevelWidget implements INetwork.RecieveG
protected float titleButtonLeft;
protected float titleButtonRight;
private GuiCraftGUI gui;
private ContainerCraftGUI container;
private WindowInventory windowInventory;
private final ContainerCraftGUI container;
private final WindowInventory windowInventory;
private ControlText title;
private StandardTexture bgText1;
private StandardTexture bgText2;
private boolean hasBeenInitialised;
private EntityPlayer player;
private IInventory entityInventory;
private Side side;
private final Side side;
public Window(float width, float height, EntityPlayer player, IInventory inventory, Side side) {
this.side = side;
@@ -13,10 +13,10 @@ import binnie.core.machines.inventory.SlotValidator;
public class WindowInventory implements IInventory {
private Window window;
private Map<Integer, ItemStack> inventory;
private Map<Integer, SlotValidator> validators;
private List<Integer> disabledAutoDispenses;
private final Window window;
private final Map<Integer, ItemStack> inventory;
private final Map<Integer, SlotValidator> validators;
private final List<Integer> disabledAutoDispenses;
public WindowInventory(Window window) {
inventory = new HashMap<>();
@@ -27,7 +27,7 @@ public class WindowInventory implements IInventory {
@Override
public int getSizeInventory() {
if (inventory.size() == 0) {
if (inventory.isEmpty()) {
return 0;
}
@@ -61,8 +61,7 @@ public class WindowInventory implements IInventory {
amount = available;
}
ItemStack itemStack = item;
itemStack.stackSize -= amount;
item.stackSize -= amount;
output.stackSize = amount;
if (item.stackSize == 0) {
setInventorySlotContents(index, null);
Loaded 100 of 433 files, more files were not shown because too many files have changed in this diff. Show more