mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-14 17:24:53 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b05c7e7d2 | ||
|
|
a2d9c9f791 | ||
|
|
c6a72a489c | ||
|
|
71f71514ae | ||
|
|
74a0fcd883 | ||
|
|
eb36ee9260 | ||
|
|
5988871448 | ||
|
|
5bb88e9115 | ||
|
|
1591cdab8b | ||
|
|
42dd7e3fb5 | ||
|
|
d62c5d0054 | ||
|
|
e20df09909 | ||
|
|
b813b75a8b | ||
|
|
52d9d1aedc | ||
|
|
50bed12f66 | ||
|
|
0d6d7ff9aa |
No files matched your search
+2
-1
@@ -28,6 +28,7 @@ whitelist.json
|
||||
*.iws
|
||||
src/main/resources/mixins.*([!.]).json
|
||||
*.bat
|
||||
*.sh
|
||||
*.DS_Store
|
||||
!gradlew.bat
|
||||
.factorypath
|
||||
@@ -35,4 +36,4 @@ addon.local.gradle
|
||||
addon.local.gradle.kts
|
||||
addon.late.local.gradle
|
||||
addon.late.local.gradle.kts
|
||||
layout.json
|
||||
layout.json
|
||||
+4
-4
@@ -1,12 +1,12 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:ForestryMC:4.11.32:dev')
|
||||
implementation('com.github.GTNewHorizons:GTNHLib:0.11.35:dev')
|
||||
api('com.github.GTNewHorizons:ForestryMC:4.11.39:dev')
|
||||
implementation('com.github.GTNewHorizons:GTNHLib:0.11.54:dev')
|
||||
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.118-GTNH:dev')
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.162-GTNH:dev')
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.63:api')
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.64:api')
|
||||
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
|
||||
compileOnly("curse.maven:extrabiomesxl-60041:2273301")
|
||||
}
|
||||
@@ -186,6 +186,11 @@ modrinthRelations =
|
||||
# Leave this empty if you don't want to publish on CurseForge.
|
||||
curseForgeProjectId =
|
||||
|
||||
# Comma-separated supported CurseForge environments: client, server (case-insensitive).
|
||||
# Use client or server for mods that only support one environment. Defaults to client,server.
|
||||
# These tags describe where the mod can run, not whether installation is required on both sides.
|
||||
curseForgeEnvironments = client,server
|
||||
|
||||
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
||||
# Syntax: type1:name1;type2:name2;...
|
||||
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/97d46b5ff4df0bf61e95652a190a5567/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/9ef54a08e06b0754cee9fc95ed3a3134/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/97d46b5ff4df0bf61e95652a190a5567/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/9ef54a08e06b0754cee9fc95ed3a3134/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1df82b76031285ef2e6a4f59ffe9299d/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/c7d5be6a02945ac2e045048ee54a7d32/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/97d46b5ff4df0bf61e95652a190a5567/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/9ef54a08e06b0754cee9fc95ed3a3134/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/643f404f769811f5f265fd66f7af5d89/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/38256085a73e137cb4937ea9c4807fec/redirect
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/9064f22734b42ac03e85df04b632e167/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/4d0277c49991306ac78048580fe34bcf/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/a9fa3b809e484a1e1ac4308a5dda661a/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/aa99913fa6d767d899ffc96082da01ca/redirect
|
||||
toolchainVersion=25
|
||||
Vendored
BIN
Binary file not shown.
+3
-1
@@ -1,7 +1,9 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
|
||||
networkTimeout=10000
|
||||
retries=0
|
||||
retryBackOffMs=500
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
# gradlew start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
@@ -29,7 +29,7 @@
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
# ksh gradlew
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
@@ -57,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/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/.
|
||||
|
||||
Vendored
+12
-23
@@ -19,12 +19,12 @@
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem gradlew startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
@rem Set local scope for the variables, and ensure extensions are enabled
|
||||
setlocal EnableExtensions
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@@ -51,7 +51,7 @@ echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
"%COMSPEC%" /c exit 1
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
@@ -65,29 +65,18 @@ echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
"%COMSPEC%" /c exit 1
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
@rem Execute gradlew
|
||||
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
|
||||
@rem which allows us to clear the local environment before executing the java command
|
||||
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
:exitWithErrorLevel
|
||||
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
|
||||
"%COMSPEC%" /c exit %ERRORLEVEL%
|
||||
+1
-1
@@ -17,5 +17,5 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.27'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.34'
|
||||
}
|
||||
@@ -11,6 +11,8 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -19,18 +21,25 @@ import net.minecraft.world.World;
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.IFlowerColor;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.genetics.AlleleColor;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.botany.genetics.EnumFlowerType;
|
||||
import binnie.botany.genetics.Flower;
|
||||
import binnie.botany.genetics.FlowerSpecies;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.util.I18N;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import forestry.core.config.Config;
|
||||
@@ -61,12 +70,44 @@ public abstract class ItemBotany extends Item {
|
||||
return false;
|
||||
}
|
||||
|
||||
static IAllele getRenderAllele(ItemStack stack, EnumFlowerChromosome chromosome, boolean active) {
|
||||
if (stack == null || !stack.hasTagCompound()) return null;
|
||||
|
||||
NBTTagCompound genome = stack.getTagCompound().getCompoundTag("Genome");
|
||||
NBTTagList chromosomes = genome.getTagList("Chromosomes", 10);
|
||||
int slot = chromosome.ordinal();
|
||||
NBTTagCompound chromosomeTag = null;
|
||||
for (int index = chromosomes.tagCount() - 1; index >= 0; index--) {
|
||||
NBTTagCompound candidate = chromosomes.getCompoundTagAt(index);
|
||||
if (candidate.getByte("Slot") == slot) {
|
||||
chromosomeTag = candidate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (chromosomeTag == null) return null;
|
||||
|
||||
Class<? extends IAllele> alleleClass = chromosome.getAlleleClass();
|
||||
IAllele primary = AlleleManager.alleleRegistry.getAllele(chromosomeTag.getString("UID0"));
|
||||
if (!alleleClass.isInstance(primary)) return null;
|
||||
IAllele secondary = AlleleManager.alleleRegistry.getAllele(chromosomeTag.getString("UID1"));
|
||||
if (!alleleClass.isInstance(secondary)) return null;
|
||||
if (!active) return primary;
|
||||
|
||||
if (primary.isDominant()) return primary;
|
||||
return secondary.isDominant() ? secondary : primary;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack stack, int pass) {
|
||||
if (!stack.hasTagCompound()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
IAllele allele = getRenderAllele(stack, EnumFlowerChromosome.SPECIES, false);
|
||||
if (allele instanceof IAlleleFlowerSpecies species) {
|
||||
return species.hasEffect();
|
||||
}
|
||||
|
||||
IIndividual individual = getIndividual(stack);
|
||||
return individual != null && individual.getGenome() != null && individual.hasEffect();
|
||||
}
|
||||
@@ -152,6 +193,17 @@ public abstract class ItemBotany extends Item {
|
||||
|
||||
@Override
|
||||
public int getColorFromItemStack(ItemStack itemstack, int renderPass) {
|
||||
if (!itemstack.hasTagCompound()) {
|
||||
return (renderPass == 0 ? EnumFlowerColor.GREEN : EnumFlowerColor.RED).getColor(false);
|
||||
}
|
||||
|
||||
EnumFlowerChromosome chromosome = renderPass == 0 ? EnumFlowerChromosome.STEM
|
||||
: renderPass == 1 ? EnumFlowerChromosome.PRIMARY : EnumFlowerChromosome.SECONDARY;
|
||||
IAllele allele = getRenderAllele(itemstack, chromosome, true);
|
||||
if (allele instanceof AlleleColor color) {
|
||||
return color.getColor().getColor(itemstack.getTagCompound().getBoolean("Wilt"));
|
||||
}
|
||||
|
||||
IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
||||
if (flower == null || flower.getGenome() == null) {
|
||||
return 0xffffff;
|
||||
@@ -177,19 +229,32 @@ public abstract class ItemBotany extends Item {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(ItemStack itemstack, int renderPass) {
|
||||
IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
||||
if (flower == null || flower.getGenome() == null || flower.getGenome().getPrimary() == null) {
|
||||
return EnumFlowerType.ALLIUM.getBlank();
|
||||
IAlleleFlowerSpecies species = FlowerSpecies.POPPY;
|
||||
boolean flowered = false;
|
||||
|
||||
if (itemstack.hasTagCompound()) {
|
||||
IAllele allele = getRenderAllele(itemstack, EnumFlowerChromosome.SPECIES, false);
|
||||
if (allele instanceof IAlleleFlowerSpecies flowerSpecies) {
|
||||
species = flowerSpecies;
|
||||
flowered = itemstack.getTagCompound().getBoolean("Flowered");
|
||||
} else {
|
||||
IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
||||
if (flower == null || flower.getGenome() == null || flower.getGenome().getPrimary() == null) {
|
||||
return EnumFlowerType.ALLIUM.getBlank();
|
||||
}
|
||||
species = flower.getGenome().getPrimary();
|
||||
flowered = flower.hasFlowered();
|
||||
}
|
||||
}
|
||||
|
||||
IFlowerType type = flower.getGenome().getPrimary().getType();
|
||||
IFlowerType type = species.getType();
|
||||
if (renderPass == 0) {
|
||||
return type.getStem(getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||
return type.getStem(getStage(), flowered, type.getSections() - 1);
|
||||
}
|
||||
if (renderPass == 1) {
|
||||
return type.getPetalIcon(getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||
return type.getPetalIcon(getStage(), flowered, type.getSections() - 1);
|
||||
}
|
||||
return type.getVariantIcon(getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||
return type.getVariantIcon(getStage(), flowered, type.getSections() - 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -38,8 +38,8 @@ public class ItemInsulatedTube extends Item {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
|
||||
for (Material mat : Material.values()) {
|
||||
for (Insulate ins : Insulate.values()) {
|
||||
for (Material mat : Material.VALUES) {
|
||||
for (Insulate ins : Insulate.VALUES) {
|
||||
list.add(new ItemStack(this, 1, mat.ordinal() + ins.ordinal() * 128));
|
||||
}
|
||||
}
|
||||
@@ -97,6 +97,8 @@ public class ItemInsulatedTube extends Item {
|
||||
Bronze(0xddc276, "bronze"),
|
||||
Iron(0xd8d8d8, "iron");
|
||||
|
||||
public static final Material[] VALUES = values();
|
||||
|
||||
private final int color;
|
||||
private final String name;
|
||||
|
||||
@@ -106,7 +108,7 @@ public class ItemInsulatedTube extends Item {
|
||||
}
|
||||
|
||||
public static Material get(int i) {
|
||||
return values()[i % values().length];
|
||||
return VALUES[i % VALUES.length];
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
@@ -127,6 +129,8 @@ public class ItemInsulatedTube extends Item {
|
||||
Stone(0x6d6d6d, "smoothStone"),
|
||||
Sandstone(0xc1b989, "sandstone");
|
||||
|
||||
public static final Insulate[] VALUES = values();
|
||||
|
||||
private final int color;
|
||||
private final String name;
|
||||
|
||||
@@ -136,7 +140,7 @@ public class ItemInsulatedTube extends Item {
|
||||
}
|
||||
|
||||
public static Insulate get(int i) {
|
||||
return values()[i / 128 % values().length];
|
||||
return VALUES[i / 128 % VALUES.length];
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
|
||||
@@ -48,7 +48,7 @@ public class BlockPlant extends BlockBush {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
for (Type t : Type.values()) {
|
||||
for (Type t : Type.VALUES) {
|
||||
t.icon = Botany.proxy.getIcon(register, t.name().toLowerCase());
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class BlockPlant extends BlockBush {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return Type.values()[meta % Type.values().length].icon;
|
||||
return Type.VALUES[meta % Type.VALUES.length].icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,7 +72,7 @@ public class BlockPlant extends BlockBush {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> list) {
|
||||
for (Type type : Type.values()) {
|
||||
for (Type type : Type.VALUES) {
|
||||
list.add(type.get());
|
||||
}
|
||||
}
|
||||
@@ -135,6 +135,7 @@ public class BlockPlant extends BlockBush {
|
||||
DeadFlower("deadFlower"),
|
||||
DecayingFlower("decayingFlower");
|
||||
|
||||
public static final Type[] VALUES = values();
|
||||
public IIcon icon;
|
||||
|
||||
private final String name;
|
||||
@@ -144,7 +145,7 @@ public class BlockPlant extends BlockBush {
|
||||
}
|
||||
|
||||
public static Type get(int id) {
|
||||
return values()[id % values().length];
|
||||
return VALUES[id % VALUES.length];
|
||||
}
|
||||
|
||||
public ItemStack get() {
|
||||
|
||||
@@ -18,7 +18,7 @@ public class ItemWeed extends ItemBlock {
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return BlockPlant.Type.values()[stack.getItemDamage()].getName();
|
||||
return BlockPlant.Type.VALUES[stack.getItemDamage()].getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,7 +8,13 @@ import forestry.core.genetics.alleles.EnumAllele;
|
||||
|
||||
public class FlowerTemplates {
|
||||
|
||||
private static IAllele[] defaultTemplate;
|
||||
|
||||
public static IAllele[] getDefaultTemplate() {
|
||||
if (defaultTemplate != null) {
|
||||
return defaultTemplate.clone();
|
||||
}
|
||||
|
||||
IAllele[] alleles = new IAllele[EnumFlowerChromosome.VALUES.length];
|
||||
alleles[EnumFlowerChromosome.SPECIES.ordinal()] = FlowerSpecies.POPPY;
|
||||
alleles[EnumFlowerChromosome.PRIMARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED);
|
||||
@@ -22,6 +28,13 @@ public class FlowerTemplates {
|
||||
alleles[EnumFlowerChromosome.PH_TOLERANCE.ordinal()] = AlleleHelper.getAllele(EnumTolerance.NONE);
|
||||
alleles[EnumFlowerChromosome.SAPPINESS.ordinal()] = AlleleHelper.getAllele(EnumAllele.Sappiness.AVERAGE);
|
||||
alleles[EnumFlowerChromosome.STEM.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.GREEN);
|
||||
return alleles;
|
||||
|
||||
for (IAllele allele : alleles) {
|
||||
// Do not cache a partial template during registry initialization.
|
||||
if (allele == null) return alleles;
|
||||
}
|
||||
|
||||
defaultTemplate = alleles;
|
||||
return defaultTemplate.clone();
|
||||
}
|
||||
}
|
||||
@@ -194,7 +194,7 @@ public class Widget implements IWidget {
|
||||
|
||||
@Override
|
||||
public void setOffset(IPoint offset) {
|
||||
if (offset != this.offset) {
|
||||
if (!offset.equals(this.offset)) {
|
||||
this.offset = new IPoint(offset);
|
||||
callEvent(new EventWidget.ChangeOffset(this));
|
||||
}
|
||||
@@ -285,6 +285,10 @@ public class Widget implements IWidget {
|
||||
onRender(RenderStage.PreChildren);
|
||||
|
||||
for (IWidget widget : getWidgets()) {
|
||||
if (!widget.isVisible()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
widget.render();
|
||||
CraftGUI.render.preRender(widget);
|
||||
widget.onRender(RenderStage.PostSiblings);
|
||||
@@ -343,7 +347,7 @@ public class Widget implements IWidget {
|
||||
|
||||
@Override
|
||||
public boolean isMouseOverWidget(IPoint relativeMouse) {
|
||||
return getArea().contains(relativeMouse);
|
||||
return contains(relativeMouse);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -471,7 +475,8 @@ public class Widget implements IWidget {
|
||||
|
||||
@Override
|
||||
public boolean contains(IPoint position) {
|
||||
return getArea().contains(position);
|
||||
IPoint size = size();
|
||||
return position.x() >= 0.0f && position.y() >= 0.0f && position.x() <= size.x() && position.y() <= size.y();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package binnie.core.craftgui.controls.tab;
|
||||
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.ITooltip;
|
||||
import binnie.core.craftgui.Tooltip;
|
||||
@@ -21,6 +24,7 @@ public class ControlTab<T> extends Control implements ITooltip, IControlValue<T>
|
||||
protected T value;
|
||||
|
||||
private final ControlTabBar<T> tabBar;
|
||||
private final Map<Texture, Texture> croppedTextures = new IdentityHashMap<>();
|
||||
|
||||
public ControlTab(ControlTabBar<T> parent, float x, float y, float w, float h, T value) {
|
||||
super(parent, x, y, w, h);
|
||||
@@ -45,9 +49,8 @@ public class ControlTab<T> extends Control implements ITooltip, IControlValue<T>
|
||||
texture = CraftGUITexture.Tab;
|
||||
}
|
||||
|
||||
Texture lTexture = CraftGUI.render.getTexture(texture);
|
||||
Position position = getTabPosition();
|
||||
Texture iTexture = lTexture.crop(position, 8.0f);
|
||||
Texture iTexture = getCroppedTexture(texture);
|
||||
IArea area = getArea();
|
||||
if (texture == CraftGUITexture.TabDisabled) {
|
||||
if (position == Position.TOP || position == Position.LEFT) {
|
||||
@@ -68,14 +71,23 @@ public class ControlTab<T> extends Control implements ITooltip, IControlValue<T>
|
||||
}
|
||||
|
||||
if (icon.hasOutline()) {
|
||||
iTexture = CraftGUI.render.getTexture(CraftGUITexture.TabOutline);
|
||||
iTexture = iTexture.crop(position, 8.0f);
|
||||
iTexture = getCroppedTexture(CraftGUITexture.TabOutline);
|
||||
CraftGUI.render.color(icon.getOutlineColor());
|
||||
CraftGUI.render.texture(iTexture, area.inset(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Texture getCroppedTexture(Object key) {
|
||||
Texture source = CraftGUI.render.getTexture(key);
|
||||
Texture cropped = croppedTextures.get(source);
|
||||
if (cropped == null) {
|
||||
cropped = source.crop(getTabPosition(), 8.0f);
|
||||
croppedTextures.put(source, cropped);
|
||||
}
|
||||
return cropped;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
String name = getName();
|
||||
|
||||
@@ -4,6 +4,7 @@ import static net.minecraftforge.common.util.Constants.NBT.TAG_COMPOUND;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -37,6 +38,8 @@ import binnie.core.machines.power.TankInfo;
|
||||
import binnie.core.machines.transfer.TransferRequest;
|
||||
import binnie.core.network.packet.MessageContainerUpdate;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
|
||||
public class ContainerCraftGUI extends Container {
|
||||
|
||||
@@ -80,6 +83,7 @@ public class ContainerCraftGUI extends Container {
|
||||
private final Map<String, NBTTagCompound> syncedNBT = new HashMap<>();
|
||||
private final Map<String, NBTTagCompound> sentNBT = new HashMap<>();
|
||||
private final Map<Integer, TankInfo> syncedTanks = new HashMap<>();
|
||||
private final Map<IInventory, Int2ObjectMap<CustomSlot>> slotsByInventory = new IdentityHashMap<>();
|
||||
private PowerInfo syncedPower = new PowerInfo();
|
||||
private ProcessInfo syncedProcess = new ProcessInfo();
|
||||
private int errorType = 0;
|
||||
@@ -109,9 +113,17 @@ public class ContainerCraftGUI extends Container {
|
||||
|
||||
@Override
|
||||
protected Slot addSlotToContainer(Slot slot) {
|
||||
indexSlot(slot);
|
||||
return super.addSlotToContainer(slot);
|
||||
}
|
||||
|
||||
private void indexSlot(Slot slot) {
|
||||
if (slot instanceof CustomSlot customSlot) {
|
||||
slotsByInventory.computeIfAbsent(customSlot.inventory, key -> new Int2ObjectOpenHashMap<>())
|
||||
.putIfAbsent(customSlot.getSlotIndex(), customSlot);
|
||||
}
|
||||
}
|
||||
|
||||
private Side getSide() {
|
||||
return window.isServer() ? Side.SERVER : Side.CLIENT;
|
||||
}
|
||||
@@ -320,7 +332,7 @@ public class ContainerCraftGUI extends Container {
|
||||
|
||||
action.setString(ACTION_TYPE, actionType);
|
||||
|
||||
if (action.equals(actionPrev)) continue;
|
||||
if (action == actionPrev || action.equals(actionPrev)) continue;
|
||||
|
||||
if (actions == null) {
|
||||
actions = new NBTTagList();
|
||||
@@ -482,13 +494,8 @@ public class ContainerCraftGUI extends Container {
|
||||
}
|
||||
|
||||
private CustomSlot getSlot(IInventory inventory, int id) {
|
||||
for (Object o : inventorySlots) {
|
||||
CustomSlot slot = (CustomSlot) o;
|
||||
if (slot.inventory == inventory && slot.getSlotIndex() == id) {
|
||||
return slot;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
Int2ObjectMap<CustomSlot> slots = slotsByInventory.get(inventory);
|
||||
return (slots == null) ? null : slots.get(id);
|
||||
}
|
||||
|
||||
public void receiveNBT(Side side, EntityPlayer player, NBTTagCompound action) {
|
||||
@@ -549,6 +556,7 @@ public class ContainerCraftGUI extends Container {
|
||||
IInventory inventory = getInventory(type);
|
||||
Slot slot = new CustomSlot(inventory, index);
|
||||
slot.slotNumber = slotNumber;
|
||||
indexSlot(slot);
|
||||
inventorySlots.add(slotNumber, slot);
|
||||
ItemStack stack = slot.getStack();
|
||||
inventoryItemStacks.add(slotNumber, stack == null ? null : stack.copy());
|
||||
|
||||
@@ -11,6 +11,9 @@ import binnie.core.machines.inventory.InventorySlot;
|
||||
|
||||
public class CustomSlot extends Slot {
|
||||
|
||||
private InventorySlot inventorySlot;
|
||||
private boolean inventorySlotResolved;
|
||||
|
||||
public CustomSlot(IInventory inventory, int index) {
|
||||
super(inventory, index, 0, 0);
|
||||
}
|
||||
@@ -21,11 +24,12 @@ public class CustomSlot extends Slot {
|
||||
}
|
||||
|
||||
public InventorySlot getInventorySlot() {
|
||||
IInventorySlots slots = Machine.getInterface(IInventorySlots.class, inventory);
|
||||
if (slots != null) {
|
||||
return slots.getSlot(getSlotIndex());
|
||||
if (!inventorySlotResolved) {
|
||||
IInventorySlots slots = Machine.getInterface(IInventorySlots.class, inventory);
|
||||
inventorySlot = (slots == null) ? null : slots.getSlot(getSlotIndex());
|
||||
inventorySlotResolved = true;
|
||||
}
|
||||
return null;
|
||||
return inventorySlot;
|
||||
}
|
||||
|
||||
public boolean handleClick() {
|
||||
|
||||
@@ -21,6 +21,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
@@ -83,7 +84,7 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
window.setMousePosition(mouseX - (int) window.getPosition().x(), mouseY - (int) window.getPosition().y());
|
||||
drawDefaultBackground();
|
||||
|
||||
GL11.glDisable(32826); // GL_RESCALE_NORMAL_EXT
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
@@ -93,12 +94,13 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
|
||||
window.render();
|
||||
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
|
||||
NEIHook.renderObjects(window, mouseX, mouseY);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(32826); // GL_RESCALE_NORMAL_EXT
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0f, 240.0f);
|
||||
InventoryPlayer playerInventory = mc.thePlayer.inventory;
|
||||
draggedItem = playerInventory.getItemStack();
|
||||
@@ -106,7 +108,7 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
|
||||
renderItem(new IPoint(mouseX - 8, mouseY - 8), draggedItem, false);
|
||||
}
|
||||
GL11.glDisable(32826); // GL_RESCALE_NORMAL_EXT
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
@@ -133,7 +135,7 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
int mouseX = (int) mousePosition.x();
|
||||
int mouseY = (int) mousePosition.y();
|
||||
FontRenderer font = getFontRenderer();
|
||||
GL11.glDisable(32826); // GL_RESCALE_NORMAL_EXT
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
@@ -224,7 +226,7 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
GL11.glEnable(32826); // GL_RESCALE_NORMAL_EXT
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -424,8 +426,9 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
|
||||
public void renderItem(IPoint pos, ItemStack item, boolean rotating) {
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0f, 240.0f);
|
||||
GL11.glPushAttrib(8256);
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_LIGHTING_BIT);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
FontRenderer font = item.getItem().getFontRenderer(item);
|
||||
if (font == null) {
|
||||
@@ -448,6 +451,7 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
}
|
||||
|
||||
GuiScreen.itemRender.renderItemOverlayIntoGUI(font, mc.renderEngine, item, (int) pos.x(), (int) pos.y(), null);
|
||||
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
@@ -458,11 +462,11 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(32826); // GL_RESCALE_NORMAL_EXT
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
BinnieCore.proxy.bindTexture(map);
|
||||
GuiScreen.itemRender.zLevel = zLevel;
|
||||
GuiScreen.itemRender.renderIcon((int) pos.x(), (int) pos.y(), icon, 16, 16);
|
||||
GL11.glEnable(32826); // GL_RESCALE_NORMAL_EXT
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ class ListMap<T> implements List<T> {
|
||||
return entry.getKey();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package binnie.core.craftgui.minecraft;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Deque;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -47,6 +46,7 @@ import binnie.core.resource.BinnieResource;
|
||||
import binnie.core.resource.ResourceType;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
||||
|
||||
public abstract class Window extends TopLevelWidget implements INetwork.ReceiveGuiNBT {
|
||||
|
||||
@@ -81,7 +81,7 @@ public abstract class Window extends TopLevelWidget implements INetwork.ReceiveG
|
||||
setSize(new IPoint(width, height));
|
||||
gui = new GuiCraftGUI(this);
|
||||
for (EnumHighlighting h : EnumHighlighting.values()) {
|
||||
ControlSlot.highlighting.put(h, new ArrayList<>());
|
||||
ControlSlot.highlighting.put(h, new IntOpenHashSet());
|
||||
}
|
||||
|
||||
renderer = new Renderer(gui);
|
||||
|
||||
@@ -57,9 +57,10 @@ public class ControlErrorState extends Control implements ITooltip {
|
||||
|
||||
ControlEnergyBar.isError = errorState.isPowerError();
|
||||
if (errorState.isItemError()) {
|
||||
CustomSlot[] customSlots = Window.get(this).getContainer().getCustomSlots();
|
||||
for (int slot : errorState.getData()) {
|
||||
int id = -1;
|
||||
for (CustomSlot cslot : Window.get(this).getContainer().getCustomSlots()) {
|
||||
for (CustomSlot cslot : customSlots) {
|
||||
if (!(cslot.inventory instanceof InventoryPlayer) && cslot.getSlotIndex() == slot) {
|
||||
id = cslot.slotNumber;
|
||||
}
|
||||
|
||||
@@ -47,13 +47,13 @@ public class ControlItemDisplay extends Control implements ITooltip {
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
IPoint relativeToWindow = getAbsolutePosition().sub(getSuperParent().getPosition());
|
||||
if (relativeToWindow.x() > Window.get(this).getSize().x() + 100.0f
|
||||
|| relativeToWindow.y() > Window.get(this).getSize().y() + 100.0f) {
|
||||
if (itemStack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemStack == null) {
|
||||
IPoint relativeToWindow = getAbsolutePosition().sub(getSuperParent().getPosition());
|
||||
if (relativeToWindow.x() > Window.get(this).getSize().x() + 100.0f
|
||||
|| relativeToWindow.y() > Window.get(this).getSize().y() + 100.0f) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import static binnie.core.craftgui.minecraft.ContainerCraftGUI.SLOT_REG;
|
||||
import static binnie.core.craftgui.minecraft.ContainerCraftGUI.SLOT_TYPE;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -20,10 +20,13 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.Tooltip;
|
||||
import binnie.core.craftgui.events.EventMouse;
|
||||
import binnie.core.craftgui.events.EventWidget;
|
||||
import binnie.core.craftgui.geometry.IArea;
|
||||
import binnie.core.craftgui.geometry.IPoint;
|
||||
import binnie.core.craftgui.minecraft.CustomSlot;
|
||||
@@ -36,15 +39,17 @@ import binnie.core.machines.inventory.MachineSide;
|
||||
import binnie.core.machines.inventory.SlotValidator;
|
||||
import binnie.core.network.packet.MessageCraftGUI;
|
||||
import binnie.core.util.I18N;
|
||||
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
||||
import it.unimi.dsi.fastutil.ints.IntSet;
|
||||
|
||||
public class ControlSlot extends ControlSlotBase {
|
||||
|
||||
public static Map<EnumHighlighting, List<Integer>> highlighting = new HashMap<>();
|
||||
public static Map<EnumHighlighting, IntSet> highlighting = new EnumMap<>(EnumHighlighting.class);
|
||||
public static boolean shiftClickActive = false;
|
||||
|
||||
static {
|
||||
for (EnumHighlighting h : EnumHighlighting.values()) {
|
||||
ControlSlot.highlighting.put(h, new ArrayList<>());
|
||||
ControlSlot.highlighting.put(h, new IntOpenHashSet());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,22 +64,17 @@ public class ControlSlot extends ControlSlotBase {
|
||||
|
||||
@Override
|
||||
public void onEvent(EventMouse.Down event) {
|
||||
if (slot == null) {
|
||||
return;
|
||||
}
|
||||
clickSlot(event.getButton());
|
||||
}
|
||||
});
|
||||
addSelfEventHandler(new EventWidget.StartMouseOver.Handler() {
|
||||
|
||||
PlayerControllerMP playerController = ((Window) getSuperParent()).getGui()
|
||||
.getMinecraft().playerController;
|
||||
int windowId = ((Window) getSuperParent()).getContainer().windowId;
|
||||
int slotNumber = slot.slotNumber;
|
||||
int button = event.getButton();
|
||||
Window.get(getWidget()).getGui();
|
||||
playerController.windowClick(
|
||||
windowId,
|
||||
slotNumber,
|
||||
button,
|
||||
GuiScreen.isShiftKeyDown() ? 1 : 0,
|
||||
((Window) getSuperParent()).getGui().getMinecraft().thePlayer);
|
||||
@Override
|
||||
public void onEvent(EventWidget.StartMouseOver event) {
|
||||
if (GuiScreen.isShiftKeyDown() && Mouse.isButtonDown(0)
|
||||
&& Window.get(ControlSlot.this).getDraggedWidget() instanceof ControlSlot) {
|
||||
clickSlot(0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -90,6 +90,19 @@ public class ControlSlot extends ControlSlotBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
private void clickSlot(int button) {
|
||||
if (slot == null) return;
|
||||
|
||||
Window window = (Window) getSuperParent();
|
||||
PlayerControllerMP playerController = window.getGui().getMinecraft().playerController;
|
||||
playerController.windowClick(
|
||||
window.getContainer().windowId,
|
||||
slot.slotNumber,
|
||||
button,
|
||||
GuiScreen.isShiftKeyDown() ? 1 : 0,
|
||||
window.getGui().getMinecraft().thePlayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.render.texture(slotTexture, IPoint.ZERO);
|
||||
@@ -106,7 +119,7 @@ public class ControlSlot extends ControlSlotBase {
|
||||
}
|
||||
|
||||
boolean highlighted = false;
|
||||
for (Map.Entry<EnumHighlighting, List<Integer>> highlight : ControlSlot.highlighting.entrySet()) {
|
||||
for (Map.Entry<EnumHighlighting, IntSet> highlight : ControlSlot.highlighting.entrySet()) {
|
||||
if (highlight.getKey() == EnumHighlighting.SHIFT_CLICK && !ControlSlot.shiftClickActive) {
|
||||
continue;
|
||||
}
|
||||
@@ -135,7 +148,7 @@ public class ControlSlot extends ControlSlotBase {
|
||||
}
|
||||
|
||||
boolean highlighted = false;
|
||||
for (Map.Entry<EnumHighlighting, List<Integer>> highlight : ControlSlot.highlighting.entrySet()) {
|
||||
for (Map.Entry<EnumHighlighting, IntSet> highlight : ControlSlot.highlighting.entrySet()) {
|
||||
if (highlight.getKey() == EnumHighlighting.SHIFT_CLICK && !ControlSlot.shiftClickActive) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -52,9 +52,9 @@ public abstract class ControlSlotBase extends Control implements ITooltip {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateClient() {
|
||||
super.onUpdateClient();
|
||||
public void render() {
|
||||
itemDisplay.setItemStack(getItemStack());
|
||||
super.render();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,15 +9,17 @@ class ParsedTextureSheet implements IBinnieTexture {
|
||||
private final String name;
|
||||
private final String modid;
|
||||
private final String path;
|
||||
private final BinnieResource texture;
|
||||
|
||||
public ParsedTextureSheet(String name, String modid, String path) {
|
||||
this.name = name;
|
||||
this.modid = modid;
|
||||
this.path = path;
|
||||
texture = new BinnieResource(modid, ResourceType.GUI, path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BinnieResource getTexture() {
|
||||
return new BinnieResource(modid, ResourceType.GUI, path);
|
||||
return texture;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package binnie.core.machines;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -71,8 +72,9 @@ public class Machine implements INetworkedEntity, INBTTagable, INetwork.TilePack
|
||||
|
||||
@Override
|
||||
public <T> T getInterface(Class<T> cls) {
|
||||
if (hasInterface(cls)) {
|
||||
return getInterfaces(cls).get(0);
|
||||
List<MachineComponent> components = componentInterfaceMap.get(cls);
|
||||
if (components != null && !components.isEmpty()) {
|
||||
return cls.cast(components.get(0));
|
||||
}
|
||||
if (cls.isInstance(getPackage())) {
|
||||
return cls.cast(getPackage());
|
||||
@@ -88,11 +90,13 @@ public class Machine implements INetworkedEntity, INBTTagable, INetwork.TilePack
|
||||
|
||||
@Override
|
||||
public <T> List<T> getInterfaces(Class<T> cls) {
|
||||
ArrayList<T> interfaces = new ArrayList<>();
|
||||
if (!hasInterface(cls)) {
|
||||
return interfaces;
|
||||
List<MachineComponent> components = componentInterfaceMap.get(cls);
|
||||
if (components == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
for (MachineComponent component : componentInterfaceMap.get(cls)) {
|
||||
|
||||
List<T> interfaces = new ArrayList<>(components.size());
|
||||
for (MachineComponent component : components) {
|
||||
interfaces.add(cls.cast(component));
|
||||
}
|
||||
return interfaces;
|
||||
|
||||
@@ -27,6 +27,12 @@ public abstract class MachinePackage {
|
||||
|
||||
public abstract TileEntity createTileEntity();
|
||||
|
||||
/// Whether this machine's tile entity needs {@link net.minecraft.tileentity.TileEntity#updateEntity()}.
|
||||
/// Override to false only when no component implements onUpdate, onInventoryUpdate or a client display tick.
|
||||
public boolean isTickable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return I18N.localise(group.getMod().getModID() + ".machine." + group.getShortUID() + "." + getUID());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package binnie.core.machines;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
@@ -12,6 +15,8 @@ import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
// Hmm. It's used class
|
||||
public class RendererMachine extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
private final Map<Block, Map<Integer, TileEntityMachine>> inventoryTiles = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float partialTick) {
|
||||
renderTileEntity((TileEntityMachine) entity, x, y, z, partialTick);
|
||||
@@ -25,8 +30,20 @@ public class RendererMachine extends TileEntitySpecialRenderer implements ISimpl
|
||||
}
|
||||
|
||||
private void renderInvBlock(Block block, int i, int j) {
|
||||
TileEntity entity = block.createTileEntity(null, i);
|
||||
renderTileEntity((TileEntityMachine) entity, 0.0, -0.1, 0.0, 0.0625f);
|
||||
renderTileEntity(getInventoryTile(block, i), 0.0, -0.1, 0.0, 0.0625f);
|
||||
}
|
||||
|
||||
private TileEntityMachine getInventoryTile(Block block, int metadata) {
|
||||
Map<Integer, TileEntityMachine> tiles = inventoryTiles.computeIfAbsent(block, key -> new HashMap<>());
|
||||
TileEntityMachine tile = tiles.get(metadata);
|
||||
if (tile == null) {
|
||||
if (!(block.createTileEntity(null, metadata) instanceof TileEntityMachine created)) {
|
||||
return null;
|
||||
}
|
||||
tile = created;
|
||||
tiles.put(metadata, tile);
|
||||
}
|
||||
return tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,6 +21,11 @@ public class TileEntityMachine extends TileEntityMachineBase implements INetwork
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
return machine == null || machine.getPackage() == null || machine.getPackage().isTickable();
|
||||
}
|
||||
|
||||
public TileEntityMachine(MachinePackage pack) {
|
||||
setMachine(pack);
|
||||
}
|
||||
|
||||
@@ -21,19 +21,23 @@ import cpw.mods.fml.common.Optional;
|
||||
|
||||
public class TileEntityMachineBase extends TileEntity implements IInventoryMachine, ITankMachine, IPoweredMachine {
|
||||
|
||||
private static final DefaultInventory DEFAULT_INVENTORY = new DefaultInventory();
|
||||
private static final DefaultTankContainer DEFAULT_TANK_CONTAINER = new DefaultTankContainer();
|
||||
private static final DefaultPower DEFAULT_POWER = new DefaultPower();
|
||||
|
||||
public IInventoryMachine getInventory() {
|
||||
IInventoryMachine inv = Machine.getInterface(IInventoryMachine.class, this);
|
||||
return (inv == null || inv == this) ? new DefaultInventory() : inv;
|
||||
return (inv == null || inv == this) ? DEFAULT_INVENTORY : inv;
|
||||
}
|
||||
|
||||
public ITankMachine getTankContainer() {
|
||||
ITankMachine inv = Machine.getInterface(ITankMachine.class, this);
|
||||
return (inv == null || inv == this) ? new DefaultTankContainer() : inv;
|
||||
return (inv == null || inv == this) ? DEFAULT_TANK_CONTAINER : inv;
|
||||
}
|
||||
|
||||
public IPoweredMachine getPower() {
|
||||
IPoweredMachine inv = Machine.getInterface(IPoweredMachine.class, this);
|
||||
return (inv == null || inv == this) ? new DefaultPower() : inv;
|
||||
return (inv == null || inv == this) ? DEFAULT_POWER : inv;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@@ -152,7 +153,8 @@ public class ComponentPowerReceptor extends MachineComponent
|
||||
}
|
||||
|
||||
private void addToEnergyNet() {
|
||||
if (getMachine().getWorld() == null) {
|
||||
World world = getMachine().getWorld();
|
||||
if (world == null || world.isRemote) {
|
||||
return;
|
||||
}
|
||||
if (Mods.ic2.active()) {
|
||||
@@ -161,7 +163,8 @@ public class ComponentPowerReceptor extends MachineComponent
|
||||
}
|
||||
|
||||
private void removeFromEnergyNet() {
|
||||
if (getMachine().getWorld() == null) {
|
||||
World world = getMachine().getWorld();
|
||||
if (world == null || world.isRemote) {
|
||||
return;
|
||||
}
|
||||
if (Mods.ic2.active()) {
|
||||
|
||||
@@ -49,6 +49,11 @@ enum Compartment implements IMachineType {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTickable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTick) {
|
||||
MachineRendererCompartment.instance.renderMachine(machine, renderTexture, x, y, z);
|
||||
|
||||
@@ -37,6 +37,7 @@ import binnie.core.craftgui.events.EventMouse;
|
||||
import binnie.core.craftgui.events.EventTextEdit;
|
||||
import binnie.core.craftgui.events.EventValueChanged;
|
||||
import binnie.core.craftgui.geometry.CraftGUIUtil;
|
||||
import binnie.core.craftgui.geometry.IArea;
|
||||
import binnie.core.craftgui.geometry.IBorder;
|
||||
import binnie.core.craftgui.geometry.IPoint;
|
||||
import binnie.core.craftgui.geometry.Position;
|
||||
@@ -372,7 +373,20 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
.texture(CraftGUITexture.Outline, getArea().inset(new IBorder(0.0f, 6.0f, 0.0f, 0.0f)));
|
||||
}
|
||||
};
|
||||
slotGrid = new Control(scroll, 1.0f, 1.0f, 108.0f, 18.0f);
|
||||
slotGrid = new Control(scroll, 1.0f, 1.0f, 108.0f, 18.0f) {
|
||||
|
||||
@Override
|
||||
public boolean isChildVisible(IWidget child) {
|
||||
IArea visible = getCroppedZone();
|
||||
if (visible == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
float top = -getOffset().y();
|
||||
float childTop = child.getOriginalPosition().y() + child.getOffset().y();
|
||||
return childTop + child.getSize().y() > top && childTop < top + visible.h();
|
||||
}
|
||||
};
|
||||
scroll.setScrollableContent(slotGrid);
|
||||
new ControlPlayerInventory(this, true).createAndRegister();
|
||||
new ControlTextEdit(this, 16.0f, 16.0f, 100.0f, 14.0f).addEventHandler(new EventTextEdit.Handler() {
|
||||
|
||||
@@ -9,6 +9,8 @@ public class BinnieResource {
|
||||
String mod;
|
||||
private final ResourceType type;
|
||||
String path;
|
||||
private final String shortPath;
|
||||
private final ResourceLocation resourceLocation;
|
||||
|
||||
public BinnieResource(AbstractMod mod, ResourceType type, String path) {
|
||||
this(mod.getModID(), type, path);
|
||||
@@ -18,13 +20,15 @@ public class BinnieResource {
|
||||
mod = modid;
|
||||
this.type = type;
|
||||
this.path = path;
|
||||
shortPath = "textures/" + type + "/" + path;
|
||||
resourceLocation = new ResourceLocation(modid, shortPath);
|
||||
}
|
||||
|
||||
public ResourceLocation getResourceLocation() {
|
||||
return new ResourceLocation(mod, "textures/" + type.toString() + "/" + path);
|
||||
return resourceLocation;
|
||||
}
|
||||
|
||||
public String getShortPath() {
|
||||
return "textures/" + type.toString() + "/" + path;
|
||||
return shortPath;
|
||||
}
|
||||
}
|
||||
@@ -108,7 +108,11 @@ public enum ExtraBeeItems implements IItemMisc {
|
||||
if (!OreDictionary.getOres("ingot" + item.metalString).isEmpty()) {
|
||||
ingot = OreDictionary.getOres("ingot" + item.metalString).get(0).copy();
|
||||
}
|
||||
if (!OreDictionary.getOres("dust" + item.metalString).isEmpty()) {
|
||||
if (item == ExtraBeeItems.PlatinumDust
|
||||
&& !OreDictionary.getOres("dustPlatinumMetallicPowder").isEmpty()) {
|
||||
dust = OreDictionary.getOres("dustPlatinumMetallicPowder").get(0).copy();
|
||||
dust.stackSize = 2;
|
||||
} else if (!OreDictionary.getOres("dust" + item.metalString).isEmpty()) {
|
||||
dust = OreDictionary.getOres("dust" + item.metalString).get(0).copy();
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ import binnie.extrabees.genetics.ExtraBeesFlowers;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IArmorApiarist;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
@@ -111,43 +110,6 @@ public enum ExtraBeesEffect implements IAlleleBeeEffect {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean wearsHelmet(EntityPlayer player) {
|
||||
ItemStack armorItem = player.inventory.armorInventory[3];
|
||||
return armorItem != null && armorItem.getItem() instanceof IArmorApiarist;
|
||||
}
|
||||
|
||||
public static boolean wearsChest(EntityPlayer player) {
|
||||
ItemStack armorItem = player.inventory.armorInventory[2];
|
||||
return armorItem != null && armorItem.getItem() instanceof IArmorApiarist;
|
||||
}
|
||||
|
||||
public static boolean wearsLegs(EntityPlayer player) {
|
||||
ItemStack armorItem = player.inventory.armorInventory[1];
|
||||
return armorItem != null && armorItem.getItem() instanceof IArmorApiarist;
|
||||
}
|
||||
|
||||
public static boolean wearsBoots(EntityPlayer player) {
|
||||
ItemStack armorItem = player.inventory.armorInventory[0];
|
||||
return armorItem != null && armorItem.getItem() instanceof IArmorApiarist;
|
||||
}
|
||||
|
||||
public static int wearsItems(EntityPlayer player) {
|
||||
int count = 0;
|
||||
if (wearsHelmet(player)) {
|
||||
count++;
|
||||
}
|
||||
if (wearsChest(player)) {
|
||||
count++;
|
||||
}
|
||||
if (wearsLegs(player)) {
|
||||
count++;
|
||||
}
|
||||
if (wearsBoots(player)) {
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public void register() {
|
||||
AlleleManager.alleleRegistry.registerAllele(this);
|
||||
}
|
||||
@@ -371,7 +333,7 @@ public enum ExtraBeesEffect implements IAlleleBeeEffect {
|
||||
for (EntityLivingBase entity : getEntities(EntityLivingBase.class, genome, housing)) {
|
||||
int damage = 4;
|
||||
if (entity instanceof EntityPlayer) {
|
||||
int count = wearsItems((EntityPlayer) entity);
|
||||
int count = BeeManager.armorApiaristHelper.wearsItems(entity, getUID(), true);
|
||||
if (count > 3) {
|
||||
continue;
|
||||
}
|
||||
@@ -396,7 +358,8 @@ public enum ExtraBeesEffect implements IAlleleBeeEffect {
|
||||
|
||||
private void onHungerEffect(IBeeGenome genome, IBeeHousing housing, World world) {
|
||||
for (EntityPlayer player : getEntities(EntityPlayer.class, genome, housing)) {
|
||||
if (world.rand.nextInt(4) < wearsItems(player)) {
|
||||
if (world.rand.nextInt(4)
|
||||
< BeeManager.armorApiaristHelper.wearsItems((EntityLivingBase) player, getUID(), true)) {
|
||||
continue;
|
||||
}
|
||||
player.addExhaustion(4.0f);
|
||||
@@ -406,7 +369,8 @@ public enum ExtraBeesEffect implements IAlleleBeeEffect {
|
||||
|
||||
private void onPotionEffect(IBeeGenome genome, IBeeHousing housing, World world, PotionEffect potion) {
|
||||
for (EntityPlayer player : getEntities(EntityPlayer.class, genome, housing)) {
|
||||
if (world.rand.nextInt(4) < wearsItems(player)) {
|
||||
if (world.rand.nextInt(4)
|
||||
< BeeManager.armorApiaristHelper.wearsItems((EntityLivingBase) player, getUID(), true)) {
|
||||
continue;
|
||||
}
|
||||
player.addPotionEffect(potion);
|
||||
|
||||
@@ -82,7 +82,7 @@ public enum EnumHoneyDrop implements IItemEnum {
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return liquidName == null || FluidRegistry.isFluidRegistered(liquidName);
|
||||
return liquidName == null || liquidName.isEmpty() || FluidRegistry.isFluidRegistered(liquidName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,14 +34,14 @@ public class ItemHoneyComb extends ItemProduct {
|
||||
OreDictionary.registerOre("gemEmerald", Items.emerald);
|
||||
OreDictionary.registerOre("gemLapis", new ItemStack(Items.dye, 1, 4));
|
||||
|
||||
EnumHoneyComb.BARREN.addProduct(beeswax, 1.00f);
|
||||
EnumHoneyComb.BARREN.tryAddProduct(beeswax, 1.00f);
|
||||
EnumHoneyComb.BARREN.addProduct(honeyDrop, 0.50f);
|
||||
|
||||
EnumHoneyComb.ROTTEN.addProduct(beeswax, 0.20f);
|
||||
EnumHoneyComb.ROTTEN.tryAddProduct(beeswax, 0.20f);
|
||||
EnumHoneyComb.ROTTEN.addProduct(honeyDrop, 0.20f);
|
||||
EnumHoneyComb.ROTTEN.addProduct(new ItemStack(Items.rotten_flesh, 1, 0), 0.80f);
|
||||
|
||||
EnumHoneyComb.BONE.addProduct(beeswax, 0.20f);
|
||||
EnumHoneyComb.BONE.tryAddProduct(beeswax, 0.20f);
|
||||
EnumHoneyComb.BONE.addProduct(honeyDrop, 0.20f);
|
||||
EnumHoneyComb.BONE.addProduct(new ItemStack(Items.dye, 1, 15), 0.80f);
|
||||
|
||||
@@ -55,7 +55,7 @@ public class ItemHoneyComb extends ItemProduct {
|
||||
EnumHoneyComb.WATER.tryAddProduct(EnumPropolis.WATER, 1.00f);
|
||||
EnumHoneyComb.WATER.addProduct(honeyDrop, 0.90f);
|
||||
|
||||
EnumHoneyComb.STONE.addProduct(beeswax, 0.50f);
|
||||
EnumHoneyComb.STONE.tryAddProduct(beeswax, 0.50f);
|
||||
EnumHoneyComb.STONE.addProduct(honeyDrop, 0.25f);
|
||||
|
||||
EnumHoneyComb.MILK.tryAddProduct(EnumHoneyDrop.MILK, 1.00f);
|
||||
@@ -84,7 +84,7 @@ public class ItemHoneyComb extends ItemProduct {
|
||||
EnumHoneyComb.LATEX.active = false;
|
||||
}
|
||||
|
||||
EnumHoneyComb.REDSTONE.addProduct(beeswax, 0.80f);
|
||||
EnumHoneyComb.REDSTONE.tryAddProduct(beeswax, 0.80f);
|
||||
EnumHoneyComb.REDSTONE.addProduct(new ItemStack(Items.redstone, 1, 0), 1.00f);
|
||||
EnumHoneyComb.REDSTONE.addProduct(honeyDrop, 0.50f);
|
||||
|
||||
@@ -119,14 +119,14 @@ public class ItemHoneyComb extends ItemProduct {
|
||||
EnumHoneyComb.URANIUM.tryAddProduct(OreDictionary.getOres("crushedUranium").get(0), 0.50f);
|
||||
}
|
||||
|
||||
EnumHoneyComb.CLAY.addProduct(beeswax, 0.25f);
|
||||
EnumHoneyComb.CLAY.tryAddProduct(beeswax, 0.25f);
|
||||
EnumHoneyComb.CLAY.addProduct(honeyDrop, 0.80f);
|
||||
EnumHoneyComb.CLAY.addProduct(new ItemStack(Items.clay_ball), 0.80f);
|
||||
|
||||
EnumHoneyComb.OLD.addProduct(beeswax, 1.00f);
|
||||
EnumHoneyComb.OLD.tryAddProduct(beeswax, 1.00f);
|
||||
EnumHoneyComb.OLD.addProduct(honeyDrop, 0.90f);
|
||||
|
||||
EnumHoneyComb.FUNGAL.addProduct(beeswax, 0.90f);
|
||||
EnumHoneyComb.FUNGAL.tryAddProduct(beeswax, 0.90f);
|
||||
EnumHoneyComb.FUNGAL.addProduct(new ItemStack(Blocks.brown_mushroom_block, 1, 0), 1.00f);
|
||||
EnumHoneyComb.FUNGAL.addProduct(new ItemStack(Blocks.red_mushroom_block, 1, 0), 0.75f);
|
||||
|
||||
@@ -139,11 +139,11 @@ public class ItemHoneyComb extends ItemProduct {
|
||||
EnumHoneyComb.VENOMOUS.addProduct(beeswax, 0.80f);
|
||||
EnumHoneyComb.VENOMOUS.tryAddProduct(EnumHoneyDrop.POISON, 0.80f);
|
||||
|
||||
EnumHoneyComb.SLIME.addProduct(beeswax, 1.00f);
|
||||
EnumHoneyComb.SLIME.tryAddProduct(beeswax, 1.00f);
|
||||
EnumHoneyComb.SLIME.addProduct(honeyDrop, 0.75f);
|
||||
EnumHoneyComb.SLIME.addProduct(new ItemStack(Items.slime_ball, 1, 0), 0.75f);
|
||||
|
||||
EnumHoneyComb.BLAZE.addProduct(beeswax, 0.75f);
|
||||
EnumHoneyComb.BLAZE.tryAddProduct(beeswax, 0.75f);
|
||||
EnumHoneyComb.BLAZE.addProduct(new ItemStack(Items.blaze_powder, 1, 0), 1.00f);
|
||||
|
||||
EnumHoneyComb.COFFEE.addProduct(beeswax, 0.90f);
|
||||
@@ -178,7 +178,7 @@ public class ItemHoneyComb extends ItemProduct {
|
||||
EnumHoneyComb.PLATINUM.tryAddProduct(ExtraBeeItems.PlatinumDust, 1.00f);
|
||||
|
||||
EnumHoneyComb.LAPIS.copyProducts(EnumHoneyComb.STONE);
|
||||
EnumHoneyComb.LAPIS.addProduct(new ItemStack(Items.dye, 6, 4), 1.00f);
|
||||
EnumHoneyComb.LAPIS.tryAddProduct(new ItemStack(Items.dye, 6, 4), 1.00f);
|
||||
|
||||
EnumHoneyComb.EMERALD.copyProducts(EnumHoneyComb.STONE);
|
||||
EnumHoneyComb.EMERALD.tryAddProduct(ExtraBeeItems.EmeraldShard, 1.00f);
|
||||
@@ -195,7 +195,7 @@ public class ItemHoneyComb extends ItemProduct {
|
||||
EnumHoneyComb.RED.addProduct(honeyDrop, 0.80f);
|
||||
EnumHoneyComb.RED.addProduct(beeswax, 0.80f);
|
||||
|
||||
EnumHoneyComb.GLOWSTONE.addProduct(honeyDrop, 0.25f);
|
||||
EnumHoneyComb.GLOWSTONE.tryAddProduct(honeyDrop, 0.25f);
|
||||
EnumHoneyComb.GLOWSTONE.addProduct(new ItemStack(Items.glowstone_dust), 1.00f);
|
||||
|
||||
EnumHoneyComb.SALTPETER.addProduct(honeyDrop, 0.25f);
|
||||
@@ -254,7 +254,7 @@ public class ItemHoneyComb extends ItemProduct {
|
||||
case 15 -> ExtraBeeItems.WhiteDye.get(1);
|
||||
default -> new ItemStack(Items.dye, 1, k);
|
||||
};
|
||||
type.addProduct(drop.get(1), 1.00f);
|
||||
type.tryAddProduct(drop.get(1), 1.00f);
|
||||
drop.addRemenant(dye);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -902,7 +902,7 @@ public enum ExtraTreeSpecies implements IAlleleTreeSpecies, IIconProvider, IGerm
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
for (SaplingType type : SaplingType.values()) {
|
||||
for (SaplingType type : SaplingType.VALUES) {
|
||||
type.icon = new IIcon[2];
|
||||
type.icon[0] = ExtraTrees.proxy.getIcon(register, "saplings/" + type.toString().toLowerCase() + ".trunk");
|
||||
type.icon[1] = ExtraTrees.proxy.getIcon(register, "saplings/" + type.toString().toLowerCase() + ".leaves");
|
||||
|
||||
@@ -12,5 +12,7 @@ public enum SaplingType {
|
||||
PALM,
|
||||
SHRUB;
|
||||
|
||||
public static final SaplingType[] VALUES = values();
|
||||
|
||||
public IIcon[] icon;
|
||||
}
|
||||
@@ -39,6 +39,13 @@ public class Inoculator {
|
||||
NBTTagList chromosomes = genomeNBT.getTagList("Chromosomes", 10);
|
||||
NBTTagCompound chromosomeNBT = chromosomes.getCompoundTagAt(chromosomeID);
|
||||
chromosomeNBT.setString("UID" + chromoN, gene.getAllele().getUID());
|
||||
if (gene.getChromosome() == EnumBeeChromosome.LIFESPAN && gene.getSpeciesRoot() instanceof IBeeRoot beeRoot) {
|
||||
int lifespan = beeRoot.getMember(target).getGenome().getLifespan();
|
||||
beeNBT.setInteger(
|
||||
"Health",
|
||||
Math.max(0, beeNBT.getInteger("Health") + lifespan - beeNBT.getInteger("MaxH")));
|
||||
beeNBT.setInteger("MaxH", lifespan);
|
||||
}
|
||||
target.setTagCompound(beeNBT);
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,13 @@ public class Splicer {
|
||||
NBTTagList chromosomes = genomeNBT.getTagList("Chromosomes", 10);
|
||||
NBTTagCompound chromosomeNBT = chromosomes.getCompoundTagAt(chromosomeID);
|
||||
chromosomeNBT.setString("UID" + chromoN, gene.getAllele().getUID());
|
||||
if (gene.getChromosome() == EnumBeeChromosome.LIFESPAN && gene.getSpeciesRoot() instanceof IBeeRoot beeRoot) {
|
||||
int lifespan = beeRoot.getMember(target).getGenome().getLifespan();
|
||||
beeNBT.setInteger(
|
||||
"Health",
|
||||
Math.max(0, beeNBT.getInteger("Health") + lifespan - beeNBT.getInteger("MaxH")));
|
||||
beeNBT.setInteger("MaxH", lifespan);
|
||||
}
|
||||
target.setTagCompound(beeNBT);
|
||||
}
|
||||
}
|
||||
@@ -366,7 +366,7 @@ for.extratrees.item.food.gooseberry=Gooseberry
|
||||
for.extratrees.item.food.goldenraspberry=Golden Raspberry
|
||||
for.extratrees.item.food.coconut=Coconut
|
||||
for.extratrees.item.food.cashew=Cashew
|
||||
for.extratrees.item.food.avacado=Avacado
|
||||
for.extratrees.item.food.avacado=Avocado
|
||||
for.extratrees.item.food.nutmeg=Nutmeg
|
||||
for.extratrees.item.food.allspice=Allspice
|
||||
for.extratrees.item.food.chilli=Chilli
|
||||
|
||||
@@ -282,7 +282,7 @@ extratrees.species.goldenraspberry.name=Golden Raspberry
|
||||
extratrees.species.cinnamon.name=Cinnamon
|
||||
extratrees.species.coconut.name=Coconut
|
||||
extratrees.species.cashew.name=Cashew
|
||||
extratrees.species.avacado.name=Avacado
|
||||
extratrees.species.avacado.name=Avocado
|
||||
extratrees.species.nutmeg.name=Nutmeg
|
||||
extratrees.species.allspice.name=Allspice
|
||||
extratrees.species.chilli.name=Chilli Pepper
|
||||
@@ -386,7 +386,7 @@ for.extratrees.item.food.gooseberry=Gooseberry
|
||||
for.extratrees.item.food.goldenraspberry=Golden Raspberry
|
||||
for.extratrees.item.food.coconut=Coconut
|
||||
for.extratrees.item.food.cashew=Cashew
|
||||
for.extratrees.item.food.avacado=Avacado
|
||||
for.extratrees.item.food.avacado=Avocado
|
||||
for.extratrees.item.food.nutmeg=Nutmeg
|
||||
for.extratrees.item.food.allspice=Allspice
|
||||
for.extratrees.item.food.chilli=Chilli
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
fluid.binnie.dna.raw=Liquid DNA
|
||||
fluid.binnie.dna.raw=Raw DNA
|
||||
fluid.binnie.bacteria=Bacteria
|
||||
fluid.binnie.growthMedium=Growth Medium
|
||||
fluid.binnie.bacteriaPoly=Polymerizing Bacteria
|
||||
|
||||
Reference in new issue
Block a user