Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52e99c9b67 | ||
|
|
3154726eb8 | ||
|
|
4beab15846 | ||
|
|
7e331c0bd8 | ||
|
|
31a4e593b3 | ||
|
|
2e159f1983 | ||
|
|
7029d05c65 | ||
|
|
dde6c79f9e | ||
|
|
577a198cb6 | ||
|
|
d6f724dd23 | ||
|
|
938e33bfab | ||
|
|
6478c25ea7 | ||
|
|
2ce1328e3b | ||
|
|
03614866a4 | ||
|
|
60605d06c1 | ||
|
|
7c8d913724 | ||
|
|
718f0661df | ||
|
|
a936e2fa64 | ||
|
|
fb8edb5738 | ||
|
|
5f5dcda1a0 |
No files matched your search
@@ -32,7 +32,6 @@
|
||||
*.[dD][lL][lL] binary
|
||||
*.[dD][yY][lL][iI][bB] binary
|
||||
*.[pP][sS][dD] binary
|
||||
*.[pP][dD][nN] binary
|
||||
*.[tT][tT][fF] binary
|
||||
*.[oO][tT][fF] binary
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
name: Optimize images
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master, main, release/** ]
|
||||
paths:
|
||||
- "**/*.png"
|
||||
|
||||
push:
|
||||
branches: [ master, main, release/** ]
|
||||
paths:
|
||||
- "**/*.png"
|
||||
|
||||
jobs:
|
||||
optimize-images:
|
||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/optimize-images.yml@master
|
||||
secrets: inherit
|
||||
|
Before Width: | Height: | Size: 231 B |
|
Before Width: | Height: | Size: 204 B |
|
Before Width: | Height: | Size: 220 B |
|
Before Width: | Height: | Size: 220 B |
|
Before Width: | Height: | Size: 200 B |
|
Before Width: | Height: | Size: 222 B |
|
Before Width: | Height: | Size: 219 B |
@@ -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.0:dev')
|
||||
implementation('com.github.GTNewHorizons:GTNHLib:0.7.3:dev')
|
||||
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.118-GTNH:dev')
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.26-GTNH:dev')
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.63:api')
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.45:api')
|
||||
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
|
||||
compileOnly("curse.maven:extrabiomesxl-60041:2273301")
|
||||
}
|
||||
@@ -39,34 +39,14 @@ remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/co
|
||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||
developmentEnvironmentUserName = Developer
|
||||
|
||||
# Enables modern Java syntax support. Valid values:
|
||||
# - false: No modern syntax, Java 8 only
|
||||
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
|
||||
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
|
||||
# - modern: Native modern Java bytecode, no downgrading
|
||||
enableModernJavaSyntax = jabel
|
||||
# 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 = true
|
||||
|
||||
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
|
||||
# and should *not* be used in most situations. -1 disables this.
|
||||
# forceToolchainVersion = -1
|
||||
|
||||
# Target JVM version for JVM Downgrader bytecode downgrading.
|
||||
# Only used when enableModernJavaSyntax = jvmDowngrader
|
||||
# downgradeTargetVersion = 8
|
||||
|
||||
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
|
||||
# Classes will be available in META-INF/versions/N/ for each version N in this list.
|
||||
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
|
||||
# jvmDowngraderMultiReleaseVersions = 21,25
|
||||
|
||||
# Specifies how JVM Downgrader API stubs are provided. Options:
|
||||
# - shade: Shade minimized stubs into the jar
|
||||
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
|
||||
# - external: Another dependency provides stubs (no constraint, no warning)
|
||||
# - (empty): Warning reminding you to configure stubs
|
||||
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
|
||||
# jvmDowngraderStubsProvider =
|
||||
|
||||
# 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 = true
|
||||
|
||||
@@ -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/c5ee947fbfb70bc347d8d531e3a578c4/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/5ee463876563a46fff651cce1bc53a4c/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c5ee947fbfb70bc347d8d531e3a578c4/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/5ee463876563a46fff651cce1bc53a4c/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/e1118b4c7c2858d28154d086dbff010e/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/59a9771cad43219260d9aac9a8ec4d6a/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c5ee947fbfb70bc347d8d531e3a578c4/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/5ee463876563a46fff651cce1bc53a4c/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/832229f0f6f0be60ed817c5a5e5848eb/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/b96cb7670c095245220e7d01d5927b58/redirect
|
||||
toolchainVersion=25
|
||||
@@ -1,6 +1,6 @@
|
||||
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.2.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -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/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/.
|
||||
|
||||
@@ -17,5 +17,5 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.27'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.6'
|
||||
}
|
||||
@@ -271,7 +271,7 @@ public class Botany extends AbstractMod {
|
||||
EnumSoilType type = soil.getType(event.world, event.x, y, event.z);
|
||||
int next = Math
|
||||
.min(type.ordinal() + Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 2);
|
||||
if (soil.fertilise(event.world, event.x, y, event.z, EnumSoilType.VALUES[next])
|
||||
if (soil.fertilise(event.world, event.x, y, event.z, EnumSoilType.values()[next])
|
||||
&& !event.entityPlayer.capabilities.isCreativeMode) {
|
||||
ItemStack heldItem = event.entityPlayer.getHeldItem();
|
||||
heldItem.stackSize--;
|
||||
@@ -284,7 +284,7 @@ public class Botany extends AbstractMod {
|
||||
EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
|
||||
int next = Math
|
||||
.max(pH.ordinal() - Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 0);
|
||||
if (soil.setPH(event.world, event.x, y, event.z, EnumAcidity.VALUES[next])
|
||||
if (soil.setPH(event.world, event.x, y, event.z, EnumAcidity.values()[next])
|
||||
&& !event.entityPlayer.capabilities.isCreativeMode) {
|
||||
ItemStack heldItem2 = event.entityPlayer.getHeldItem();
|
||||
heldItem2.stackSize--;
|
||||
@@ -297,7 +297,7 @@ public class Botany extends AbstractMod {
|
||||
EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
|
||||
int next = Math
|
||||
.min(pH.ordinal() + Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 2);
|
||||
if (soil.setPH(event.world, event.x, y, event.z, EnumAcidity.VALUES[next])
|
||||
if (soil.setPH(event.world, event.x, y, event.z, EnumAcidity.values()[next])
|
||||
&& !event.entityPlayer.capabilities.isCreativeMode) {
|
||||
ItemStack heldItem3 = event.entityPlayer.getHeldItem();
|
||||
heldItem3.stackSize--;
|
||||
|
||||
@@ -6,11 +6,6 @@ public enum EnumAcidity {
|
||||
NEUTRAL,
|
||||
ALKALINE;
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumAcidity[] VALUES = values();
|
||||
|
||||
public String getID() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
|
||||
@@ -24,10 +24,6 @@ public enum EnumFlowerChromosome implements IChromosomeType {
|
||||
SAPPINESS(IAlleleFloat.class),
|
||||
STEM(IAlleleInteger.class);
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumFlowerChromosome[] VALUES = values();
|
||||
private final Class<? extends IAllele> cls;
|
||||
|
||||
EnumFlowerChromosome(Class<? extends IAllele> cls) {
|
||||
|
||||
@@ -6,11 +6,6 @@ public enum EnumMoisture {
|
||||
NORMAL,
|
||||
DAMP;
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumMoisture[] VALUES = values();
|
||||
|
||||
public String getID() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
|
||||
@@ -6,11 +6,6 @@ public enum EnumSoilType {
|
||||
LOAM,
|
||||
FLOWERBED;
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumSoilType[] VALUES = values();
|
||||
|
||||
public String getID() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class BlockCeramic extends Block implements IBlockMetadata {
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List<ItemStack> itemList) {
|
||||
for (EnumFlowerColor c : EnumFlowerColor.VALUES) {
|
||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,12 +102,12 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> itemList) {
|
||||
for (EnumFlowerColor c : EnumFlowerColor.VALUES) {
|
||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
BlockType type = new BlockType(c, c, TileType.Tile);
|
||||
itemList.add(TileEntityMetadata.getItemStack(this, type.ordinal()));
|
||||
}
|
||||
|
||||
for (TileType type2 : TileType.VALUES) {
|
||||
for (TileType type2 : TileType.values()) {
|
||||
if (type2.canDouble()) {
|
||||
itemList.add(new BlockType(EnumFlowerColor.BROWN, EnumFlowerColor.GOLD, type2).getStack(1));
|
||||
}
|
||||
@@ -130,13 +130,13 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return TileType.get(meta >>> 16 & 0xFF).icons[MultipassBlockRenderer.getLayer()];
|
||||
return getType(meta).getIcon(MultipassBlockRenderer.getLayer());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
for (TileType type : TileType.VALUES) {
|
||||
for (TileType type : TileType.values()) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
type.icons[i] = Botany.proxy.getIcon(register, "ceramic." + type.id + "." + i);
|
||||
}
|
||||
@@ -167,9 +167,6 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderColor(int meta) {
|
||||
if (!MultipassBlockRenderer.isRendering()) {
|
||||
return EnumFlowerColor.get(meta & 0xFF).getColor(false);
|
||||
}
|
||||
return colorMultiplier(meta);
|
||||
}
|
||||
|
||||
@@ -180,14 +177,14 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
||||
|
||||
@Override
|
||||
public int colorMultiplier(int meta) {
|
||||
int layer = MultipassBlockRenderer.getLayer();
|
||||
if (layer == 0) {
|
||||
BlockType type = getType(meta);
|
||||
if (MultipassBlockRenderer.getLayer() == 0) {
|
||||
return 0xffffff;
|
||||
}
|
||||
if (layer == 1) {
|
||||
return EnumFlowerColor.get(meta & 0xFF).getColor(false);
|
||||
if (MultipassBlockRenderer.getLayer() == 1) {
|
||||
return type.color1.getColor(false);
|
||||
}
|
||||
return EnumFlowerColor.get(meta >>> 8 & 0xFF).getColor(false);
|
||||
return type.color2.getColor(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -208,10 +205,6 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
||||
VerticalStripeBrick("verticalbrickstripe", "verticalStripedCeramicBricks"),
|
||||
VerticalLargeBrick("verticalbricklarge", "largeVerticalCeramicBricks");
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final TileType[] VALUES = values();
|
||||
private final String id;
|
||||
private final String name;
|
||||
private final IIcon[] icons;
|
||||
@@ -223,7 +216,7 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
||||
}
|
||||
|
||||
public static TileType get(int id) {
|
||||
return VALUES[id % VALUES.length];
|
||||
return values()[id % values().length];
|
||||
}
|
||||
|
||||
public boolean canDouble() {
|
||||
|
||||
@@ -124,7 +124,7 @@ public class BlockStained extends Block implements IBlockMetadata {
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> itemList) {
|
||||
for (EnumFlowerColor c : EnumFlowerColor.VALUES) {
|
||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public class CeramicColor implements IDesignMaterial {
|
||||
|
||||
static {
|
||||
CeramicColor.map = new LinkedHashMap<>();
|
||||
for (EnumFlowerColor c : EnumFlowerColor.VALUES) {
|
||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
CeramicColor.map.put(c, new CeramicColor(c));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class CeramicDesignSystem implements IDesignSystem {
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
for (EnumPattern pattern : EnumPattern.VALUES) {
|
||||
for (EnumPattern pattern : EnumPattern.values()) {
|
||||
primary.put(
|
||||
pattern.ordinal(),
|
||||
BinnieCore.proxy.getIcon(
|
||||
|
||||
@@ -52,7 +52,7 @@ public class CeramicTileRecipe implements IRecipe {
|
||||
}
|
||||
}
|
||||
|
||||
for (BlockCeramicBrick.TileType type : BlockCeramicBrick.TileType.VALUES) {
|
||||
for (BlockCeramicBrick.TileType type : BlockCeramicBrick.TileType.values()) {
|
||||
ItemStack stack2 = type.getRecipe(stacks);
|
||||
if (stack2 != null) {
|
||||
return stack2;
|
||||
|
||||
@@ -91,7 +91,7 @@ public class WindowBotanistDatabase extends WindowAbstractDatabase {
|
||||
}
|
||||
};
|
||||
List<IFlowerColor> colors = new ArrayList<>();
|
||||
Collections.addAll(colors, EnumFlowerColor.VALUES);
|
||||
Collections.addAll(colors, EnumFlowerColor.values());
|
||||
listBox.setOptions(colors);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ public class GardenLogic extends FarmLogic {
|
||||
if (pH.ordinal() < acidity.ordinal()) {
|
||||
ItemStack stack = getAvailableAlkaline();
|
||||
if (stack != null && soil
|
||||
.setPH(world, position.x, position.y, position.z, EnumAcidity.VALUES[pH.ordinal() + 1])) {
|
||||
.setPH(world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() + 1])) {
|
||||
housing.getFarmInventory().removeResources(new ItemStack[] { stack });
|
||||
continue;
|
||||
}
|
||||
@@ -138,7 +138,7 @@ public class GardenLogic extends FarmLogic {
|
||||
if (pH.ordinal() > acidity.ordinal()) {
|
||||
ItemStack stack = getAvailableAcid();
|
||||
if (stack != null && soil
|
||||
.setPH(world, position.x, position.y, position.z, EnumAcidity.VALUES[pH.ordinal() - 1])) {
|
||||
.setPH(world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() - 1])) {
|
||||
housing.getFarmInventory().removeResources(new ItemStack[] { stack });
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class BlockFlower extends BlockContainer {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
for (EnumFlowerType type : EnumFlowerType.VALUES) {
|
||||
for (EnumFlowerType type : EnumFlowerType.values()) {
|
||||
type.registerIcons(register);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,8 +97,6 @@ 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;
|
||||
|
||||
@@ -108,7 +106,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() {
|
||||
@@ -129,8 +127,6 @@ 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;
|
||||
|
||||
@@ -140,7 +136,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,7 +135,6 @@ public class BlockPlant extends BlockBush {
|
||||
DeadFlower("deadFlower"),
|
||||
DecayingFlower("decayingFlower");
|
||||
|
||||
public static final Type[] VALUES = values();
|
||||
public IIcon icon;
|
||||
|
||||
private final String name;
|
||||
@@ -145,7 +144,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() {
|
||||
|
||||
@@ -81,8 +81,8 @@ public class BlockSoil extends Block implements IBlockSoil {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
for (EnumMoisture moisture : EnumMoisture.VALUES) {
|
||||
for (EnumAcidity pH : EnumAcidity.VALUES) {
|
||||
for (EnumMoisture moisture : EnumMoisture.values()) {
|
||||
for (EnumAcidity pH : EnumAcidity.values()) {
|
||||
int index = moisture.ordinal() + pH.ordinal() * 3;
|
||||
String id = "soil/" + getType().getID() + "." + pH.getID() + "." + moisture.getID();
|
||||
iconsTop[index] = Botany.proxy.getIcon(register, id + ".0");
|
||||
@@ -104,8 +104,8 @@ public class BlockSoil extends Block implements IBlockSoil {
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random random) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
EnumMoisture moisture = EnumMoisture.VALUES[meta % 3];
|
||||
EnumAcidity acidity = EnumAcidity.VALUES[meta / 3];
|
||||
EnumMoisture moisture = EnumMoisture.values()[meta % 3];
|
||||
EnumAcidity acidity = EnumAcidity.values()[meta / 3];
|
||||
EnumMoisture desiredMoisture = Gardening.getNaturalMoisture(world, x, y, z);
|
||||
if (desiredMoisture.ordinal() > moisture.ordinal()) {
|
||||
moisture = ((moisture == EnumMoisture.DRY) ? EnumMoisture.NORMAL : EnumMoisture.DAMP);
|
||||
@@ -141,12 +141,12 @@ public class BlockSoil extends Block implements IBlockSoil {
|
||||
|
||||
@Override
|
||||
public EnumAcidity getPH(World world, int x, int y, int z) {
|
||||
return EnumAcidity.VALUES[world.getBlockMetadata(x, y, z) / 3];
|
||||
return EnumAcidity.values()[world.getBlockMetadata(x, y, z) / 3];
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumMoisture getMoisture(World world, int x, int y, int z) {
|
||||
return EnumMoisture.VALUES[world.getBlockMetadata(x, y, z) % 3];
|
||||
return EnumMoisture.values()[world.getBlockMetadata(x, y, z) % 3];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -233,8 +233,8 @@ public class Gardening {
|
||||
BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
|
||||
return canTolerate(
|
||||
flower,
|
||||
EnumAcidity.VALUES[soilMeta / 3 % 3],
|
||||
EnumMoisture.VALUES[soilMeta % 3],
|
||||
EnumAcidity.values()[soilMeta / 3 % 3],
|
||||
EnumMoisture.values()[soilMeta % 3],
|
||||
EnumTemperature.getFromValue(biome.temperature));
|
||||
}
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@ public class ItemSoil extends ItemBlock {
|
||||
@SideOnly(Side.CLIENT)
|
||||
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];
|
||||
EnumMoisture moisture = EnumMoisture.values()[stack.getItemDamage() % 3];
|
||||
EnumAcidity acidity = EnumAcidity.values()[stack.getItemDamage() / 3];
|
||||
String info = "";
|
||||
|
||||
if (moisture == EnumMoisture.DRY) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -109,7 +109,7 @@ public class ModuleGardening implements IInitializable {
|
||||
|
||||
for (boolean manual : new boolean[] { true, false }) {
|
||||
for (boolean fertilised : new boolean[] { true, false }) {
|
||||
for (EnumMoisture moist : EnumMoisture.VALUES) {
|
||||
for (EnumMoisture moist : EnumMoisture.values()) {
|
||||
ItemStack icon = (moist == EnumMoisture.DRY) ? yellow
|
||||
: ((moist == EnumMoisture.NORMAL) ? red : blue);
|
||||
int insulate = 2 - moist.ordinal();
|
||||
@@ -258,7 +258,7 @@ public class ModuleGardening implements IInitializable {
|
||||
GameRegistry
|
||||
.addRecipe(BotanyItems.Mortar.get(6), " c ", "cgc", " c ", 'c', Items.clay_ball, 'g', Blocks.gravel);
|
||||
|
||||
for (EnumFlowerColor c : EnumFlowerColor.VALUES) {
|
||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
ItemStack clay = new ItemStack(Botany.clay, 1, c.ordinal());
|
||||
ItemStack pigment = new ItemStack(Botany.pigment, 1, c.ordinal());
|
||||
GameRegistry.addShapelessRecipe(clay, Items.clay_ball, Items.clay_ball, Items.clay_ball, pigment);
|
||||
@@ -276,9 +276,9 @@ public class ModuleGardening implements IInitializable {
|
||||
return null;
|
||||
}
|
||||
return new ItemStack(
|
||||
Gardening.getSoilBlock(EnumSoilType.VALUES[type]),
|
||||
Gardening.getSoilBlock(EnumSoilType.values()[type]),
|
||||
1,
|
||||
BlockSoil.getMeta(EnumAcidity.VALUES[pH], EnumMoisture.VALUES[moisture]));
|
||||
BlockSoil.getMeta(EnumAcidity.values()[pH], EnumMoisture.values()[moisture]));
|
||||
}
|
||||
|
||||
private void addAcidFertiliser(ItemStack stack, int strengthMax) {
|
||||
|
||||
@@ -92,10 +92,7 @@ public enum EnumFlowerColor implements IFlowerColor {
|
||||
YELLOW("yellow", 0xffff00),
|
||||
YELLOW_GREEN("yellowGreen", 0x9acd32);
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumFlowerColor[] VALUES = values();
|
||||
private static final EnumFlowerColor[] ALL_VALUES = values();
|
||||
private final int color;
|
||||
private final int colorDis;
|
||||
private final String name;
|
||||
@@ -2967,7 +2964,7 @@ public enum EnumFlowerColor implements IFlowerColor {
|
||||
}
|
||||
|
||||
public static EnumFlowerColor get(int i) {
|
||||
return VALUES[Math.max(0, i) % VALUES.length];
|
||||
return ALL_VALUES[Math.max(0, i) % ALL_VALUES.length];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -57,10 +57,6 @@ public enum EnumFlowerType implements IFlowerType {
|
||||
DELPHINIUM(2),
|
||||
HOLLYHOCK(2);
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumFlowerType[] VALUES = values();
|
||||
private final int sections;
|
||||
private final IIcon[] stem;
|
||||
private final IIcon[] petal;
|
||||
|
||||
@@ -232,7 +232,7 @@ public class FlowerHelper extends SpeciesRoot implements IFlowerRoot {
|
||||
|
||||
@Override
|
||||
public IChromosomeType[] getKaryotype() {
|
||||
return EnumFlowerChromosome.VALUES;
|
||||
return EnumFlowerChromosome.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -496,7 +496,7 @@ public enum FlowerSpecies implements IAlleleFlowerSpecies {
|
||||
|
||||
@Override
|
||||
public EnumHumidity getHumidity() {
|
||||
return EnumHumidity.VALUES[getMoisture().ordinal()];
|
||||
return EnumHumidity.values()[getMoisture().ordinal()];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,7 +9,7 @@ import forestry.core.genetics.alleles.EnumAllele;
|
||||
public class FlowerTemplates {
|
||||
|
||||
public static IAllele[] getDefaultTemplate() {
|
||||
IAllele[] alleles = new IAllele[EnumFlowerChromosome.VALUES.length];
|
||||
IAllele[] alleles = new IAllele[EnumFlowerChromosome.values().length];
|
||||
alleles[EnumFlowerChromosome.SPECIES.ordinal()] = FlowerSpecies.POPPY;
|
||||
alleles[EnumFlowerChromosome.PRIMARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED);
|
||||
alleles[EnumFlowerChromosome.SECONDARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED);
|
||||
|
||||
@@ -42,7 +42,7 @@ public class ModuleGenetics implements IInitializable {
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
for (EnumFlowerColor color : EnumFlowerColor.VALUES) {
|
||||
for (EnumFlowerColor color : EnumFlowerColor.values()) {
|
||||
AlleleManager.alleleRegistry.registerAllele(color.getAllele());
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public class ItemClay extends Item {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
|
||||
for (EnumFlowerColor c : EnumFlowerColor.VALUES) {
|
||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
list.add(new ItemStack(this, 1, c.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class ItemPigment extends Item {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
|
||||
for (EnumFlowerColor c : EnumFlowerColor.VALUES) {
|
||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
list.add(new ItemStack(this, 1, c.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,10 +39,10 @@ public class MessageFlowerUpdate extends MessageCoordinates {
|
||||
public void readData(ByteBuf data) throws IOException {
|
||||
super.readData(data);
|
||||
render = new TileEntityFlower.RenderInfo();
|
||||
render.primary = EnumFlowerColor.get(data.readByte());
|
||||
render.secondary = EnumFlowerColor.get(data.readByte());
|
||||
render.stem = EnumFlowerColor.get(data.readByte());
|
||||
render.type = EnumFlowerType.VALUES[data.readByte()];
|
||||
render.primary = EnumFlowerColor.values()[data.readByte()];
|
||||
render.secondary = EnumFlowerColor.values()[data.readByte()];
|
||||
render.stem = EnumFlowerColor.values()[data.readByte()];
|
||||
render.type = EnumFlowerType.values()[data.readByte()];
|
||||
render.age = data.readByte();
|
||||
render.section = data.readByte();
|
||||
render.wilted = data.readBoolean();
|
||||
|
||||
@@ -12,7 +12,6 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import binnie.Binnie;
|
||||
import binnie.core.block.MultipassBlockRenderer;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.core.config.BCConfig;
|
||||
import binnie.core.craftgui.minecraft.ModuleCraftGUI;
|
||||
import binnie.core.gui.BinnieCoreGUI;
|
||||
import binnie.core.gui.BinnieGUIHandler;
|
||||
@@ -79,9 +78,7 @@ public class BinnieCore extends AbstractMod {
|
||||
}
|
||||
|
||||
addModule(new ModuleCraftGUI());
|
||||
if (!BCConfig.disableCompartments) {
|
||||
addModule(new ModuleStorage());
|
||||
}
|
||||
addModule(new ModuleStorage());
|
||||
addModule(new ModuleItems());
|
||||
if (Loader.isModLoaded("BuildCraft|Silicon")) {
|
||||
addModule(new ModuleTrigger());
|
||||
|
||||
@@ -17,8 +17,6 @@ public class ItemMetadata extends ItemBlock {
|
||||
|
||||
public ItemMetadata(Block block) {
|
||||
super(block);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,7 +14,6 @@ public class MultipassBlockRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static MultipassBlockRenderer instance;
|
||||
private static int layer = 0;
|
||||
private static boolean rendering = false;
|
||||
|
||||
public MultipassBlockRenderer() {
|
||||
MultipassBlockRenderer.instance = this;
|
||||
@@ -24,49 +23,31 @@ public class MultipassBlockRenderer implements ISimpleBlockRenderingHandler {
|
||||
return MultipassBlockRenderer.layer;
|
||||
}
|
||||
|
||||
public static boolean isRendering() {
|
||||
return MultipassBlockRenderer.rendering;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
|
||||
IMultipassBlock multipassBlock = (IMultipassBlock) block;
|
||||
int passes = multipassBlock.getNumberOfPasses();
|
||||
|
||||
block.setBlockBoundsForItemRender();
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||
|
||||
MultipassBlockRenderer.rendering = true;
|
||||
try {
|
||||
for (int pass = 0; pass < passes; ++pass) {
|
||||
MultipassBlockRenderer.layer = pass;
|
||||
renderItem(block, multipassBlock, renderer, meta);
|
||||
}
|
||||
} finally {
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
MultipassBlockRenderer.rendering = false;
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
while (MultipassBlockRenderer.layer < ((IMultipassBlock) block).getNumberOfPasses()) {
|
||||
renderItem(block, renderer, meta);
|
||||
MultipassBlockRenderer.layer++;
|
||||
}
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
|
||||
RenderBlocks renderer) {
|
||||
IMultipassBlock multipassBlock = (IMultipassBlock) block;
|
||||
int passes = multipassBlock.getNumberOfPasses();
|
||||
boolean rendered = true;
|
||||
|
||||
MultipassBlockRenderer.rendering = true;
|
||||
try {
|
||||
for (int pass = 0; pass < passes; ++pass) {
|
||||
MultipassBlockRenderer.layer = pass;
|
||||
rendered = renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
return rendered;
|
||||
} finally {
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
MultipassBlockRenderer.rendering = false;
|
||||
boolean r = true;
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
while (MultipassBlockRenderer.layer < ((IMultipassBlock) block).getNumberOfPasses()) {
|
||||
r = renderer.renderStandardBlock(block, x, y, z);
|
||||
MultipassBlockRenderer.layer++;
|
||||
}
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -79,8 +60,8 @@ public class MultipassBlockRenderer implements ISimpleBlockRenderingHandler {
|
||||
return BinnieCore.multipassRenderID;
|
||||
}
|
||||
|
||||
private void renderItem(Block block, IMultipassBlock multipassBlock, RenderBlocks renderer, int meta) {
|
||||
setColor(multipassBlock.colorMultiplier(meta));
|
||||
public void renderItem(Block block, RenderBlocks renderer, int meta) {
|
||||
setColor(((IMultipassBlock) block).colorMultiplier(meta));
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, -1.0f, 0.0f);
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package binnie.core.config;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.config.Config;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
|
||||
@Config(modid = BinnieCore.CORE_MODID)
|
||||
public class BCConfig {
|
||||
|
||||
@Config.Comment("If true, disables all compartment storage machines (no blocks/recipes will be registered).")
|
||||
@Config.DefaultBoolean(false)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean disableCompartments;
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
package binnie.core.craftgui;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Deque;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
@@ -165,14 +168,17 @@ public abstract class TopLevelWidget extends Widget implements ITopLevelWidget {
|
||||
}
|
||||
|
||||
public Deque<IWidget> calculateMousedOverWidgets() {
|
||||
Deque<IWidget> widgets = new ArrayDeque<>();
|
||||
addMousedOverWidgets(this, widgets);
|
||||
return widgets;
|
||||
Deque<IWidget> list = new ArrayDeque<>();
|
||||
for (IWidget widget : getQueuedWidgets(this)) {
|
||||
if (widget.calculateIsMouseOver()) {
|
||||
list.addLast(widget);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private void addMousedOverWidgets(IWidget widget, Deque<IWidget> widgets) {
|
||||
if (!widget.isVisible()) return;
|
||||
|
||||
private Collection<IWidget> getQueuedWidgets(IWidget widget) {
|
||||
List<IWidget> widgets = new ArrayList<>();
|
||||
boolean addChildren = true;
|
||||
if (widget.isCroppedWidget()) {
|
||||
addChildren = widget.getCroppedZone().contains(widget.getCropWidget().getRelativeMousePosition());
|
||||
@@ -182,12 +188,11 @@ public abstract class TopLevelWidget extends Widget implements ITopLevelWidget {
|
||||
ListIterator<IWidget> li = widget.getWidgets().listIterator(widget.getWidgets().size());
|
||||
while (li.hasPrevious()) {
|
||||
IWidget child = li.previous();
|
||||
addMousedOverWidgets(child, widgets);
|
||||
widgets.addAll(getQueuedWidgets(child));
|
||||
}
|
||||
}
|
||||
if (widget.calculateIsMouseOver()) {
|
||||
widgets.addLast(widget);
|
||||
}
|
||||
widgets.add(widget);
|
||||
return widgets;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -306,22 +306,17 @@ public class Widget implements IWidget {
|
||||
}
|
||||
|
||||
onUpdateClient();
|
||||
List<IWidget> deletedWidgets = null;
|
||||
List<IWidget> deletedWidgets = new ArrayList<>();
|
||||
for (IWidget widget : getWidgets()) {
|
||||
if (widget.hasAttribute(WidgetAttribute.NEEDS_DELETION)) {
|
||||
if (deletedWidgets == null) {
|
||||
deletedWidgets = new ArrayList<>();
|
||||
}
|
||||
deletedWidgets.add(widget);
|
||||
} else {
|
||||
widget.updateClient();
|
||||
}
|
||||
}
|
||||
|
||||
if (deletedWidgets != null) {
|
||||
for (IWidget widget : deletedWidgets) {
|
||||
deleteChild(widget);
|
||||
}
|
||||
for (IWidget widget : deletedWidgets) {
|
||||
deleteChild(widget);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -188,9 +188,7 @@ public class WindowFieldKit extends Window {
|
||||
glassOffsetX *= 1.0f - analyseProgress;
|
||||
glassOffsetY += glassVY;
|
||||
glassOffsetY *= 1.0f - analyseProgress;
|
||||
if (GlassControl != null) {
|
||||
GlassControl.setOffset(new IPoint(glassOffsetX, glassOffsetY));
|
||||
}
|
||||
GlassControl.setOffset(new IPoint(glassOffsetX, glassOffsetY));
|
||||
}
|
||||
|
||||
private void refreshSpecies() {
|
||||
|
||||
@@ -201,22 +201,22 @@ public class ContainerCraftGUI extends Container {
|
||||
Slot shiftClickedSlot = inventorySlots.get(index);
|
||||
ItemStack itemstack = null;
|
||||
if (shiftClickedSlot.getHasStack()) {
|
||||
itemstack = shiftClickedSlot.getStack();
|
||||
itemstack = shiftClickedSlot.getStack().copy();
|
||||
}
|
||||
|
||||
IInventory playerInventory = player.inventory;
|
||||
IInventory entityInventory = window.getInventory();
|
||||
IInventory windowInventory = window.getWindowInventory();
|
||||
IInventory fromPlayer = (entityInventory == null) ? windowInventory : entityInventory;
|
||||
int[] target = new int[36];
|
||||
for (int i = 0; i < target.length; ++i) {
|
||||
target[i] = i;
|
||||
}
|
||||
|
||||
TransferRequest request;
|
||||
if (shiftClickedSlot.inventory == playerInventory) {
|
||||
request = new TransferRequest(itemstack, fromPlayer).setOrigin(shiftClickedSlot.inventory);
|
||||
} else {
|
||||
int[] target = new int[36];
|
||||
for (int i = 0; i < target.length; ++i) {
|
||||
target[i] = i;
|
||||
}
|
||||
request = new TransferRequest(itemstack, playerInventory).setOrigin(shiftClickedSlot.inventory)
|
||||
.setTargetSlots(target);
|
||||
}
|
||||
@@ -234,7 +234,7 @@ public class ContainerCraftGUI extends Container {
|
||||
ItemStack heldItem = player.inventory.getItemStack().copy();
|
||||
IInventory entityInventory = window.getInventory();
|
||||
heldItem = new TransferRequest(heldItem, entityInventory).setOrigin(player.inventory).setTargetSlots(new int[0])
|
||||
.setTargetTanks(new int[] { slotID }).dropOverflow(player).transfer(true);
|
||||
.setTargetTanks(new int[] { slotID }).transfer(true);
|
||||
|
||||
player.inventory.setItemStack(heldItem);
|
||||
|
||||
@@ -246,14 +246,7 @@ public class ContainerCraftGUI extends Container {
|
||||
}
|
||||
|
||||
public void handleNBT(Side side, EntityPlayer player, NBTTagCompound action) {
|
||||
if (handleNBTAction(side, player, action)) {
|
||||
sendContainerContents();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean handleNBTAction(Side side, EntityPlayer player, NBTTagCompound action) {
|
||||
final String actionType = action.getString(ACTION_TYPE);
|
||||
boolean slotRegistered = false;
|
||||
|
||||
if (side == Side.SERVER) {
|
||||
switch (actionType) {
|
||||
@@ -263,7 +256,11 @@ public class ContainerCraftGUI extends Container {
|
||||
final int slotIndex = action.getShort(SLOT_INDEX);
|
||||
final int slotNumber = action.getShort(SLOT_NUMBER);
|
||||
|
||||
slotRegistered = createSlot(InventoryType.values()[slotType % 4], slotIndex, slotNumber);
|
||||
createSlot(InventoryType.values()[slotType % 4], slotIndex, slotNumber);
|
||||
|
||||
for (ICrafting crafterObject : crafters) {
|
||||
crafterObject.sendContainerAndContentsToPlayer(this, getInventory());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -278,7 +275,6 @@ public class ContainerCraftGUI extends Container {
|
||||
if (actionType.contains(TANK_UPDATE)) onTankUpdate(action);
|
||||
}
|
||||
}
|
||||
return slotRegistered;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -311,7 +307,8 @@ public class ContainerCraftGUI extends Container {
|
||||
|
||||
if (machineSync != null) machineSync.sendGuiNBT(syncedNBT);
|
||||
|
||||
NBTTagList actions = null;
|
||||
Map<String, NBTTagCompound> sentThisTime = new HashMap<>();
|
||||
NBTTagList actions = new NBTTagList();
|
||||
|
||||
for (Map.Entry<String, NBTTagCompound> entry : syncedNBT.entrySet()) {
|
||||
final String actionType = entry.getKey();
|
||||
@@ -322,16 +319,10 @@ public class ContainerCraftGUI extends Container {
|
||||
|
||||
if (action.equals(actionPrev)) continue;
|
||||
|
||||
if (actions == null) {
|
||||
actions = new NBTTagList();
|
||||
}
|
||||
actions.appendTag(action);
|
||||
sentNBT.put(actionType, action);
|
||||
sentThisTime.put(actionType, action);
|
||||
}
|
||||
|
||||
syncedNBT.clear();
|
||||
if (actions == null) return;
|
||||
|
||||
NBTTagCompound actionsBatch = new NBTTagCompound();
|
||||
actionsBatch.setString(ACTION_TYPE, ACTION_BATCH);
|
||||
actionsBatch.setTag(ACTIONS, actions);
|
||||
@@ -342,6 +333,9 @@ public class ContainerCraftGUI extends Container {
|
||||
BinnieCore.proxy.sendToPlayer(packet, playerMP);
|
||||
}
|
||||
}
|
||||
|
||||
sentNBT.putAll(sentThisTime);
|
||||
syncedNBT.clear();
|
||||
}
|
||||
|
||||
private NBTTagCompound createErrorNBT(IErrorStateSource error) {
|
||||
@@ -492,34 +486,19 @@ public class ContainerCraftGUI extends Container {
|
||||
}
|
||||
|
||||
public void receiveNBT(Side side, EntityPlayer player, NBTTagCompound action) {
|
||||
if (receiveNBTAction(side, player, action)) {
|
||||
sendContainerContents();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean receiveNBTAction(Side side, EntityPlayer player, NBTTagCompound action) {
|
||||
String actionType = action.getString(ACTION_TYPE);
|
||||
if (actionType.equals(ACTION_BATCH)) {
|
||||
boolean slotRegistered = false;
|
||||
NBTTagList actionsBatch = action.getTagList(ACTIONS, TAG_COMPOUND);
|
||||
for (int i = 0; i < actionsBatch.tagCount(); i++) {
|
||||
slotRegistered |= receiveNBTAction(side, player, actionsBatch.getCompoundTagAt(i));
|
||||
receiveNBT(side, player, actionsBatch.getCompoundTagAt(i));
|
||||
}
|
||||
return slotRegistered;
|
||||
return;
|
||||
}
|
||||
boolean slotRegistered = handleNBTAction(side, player, action);
|
||||
handleNBT(side, player, action);
|
||||
window.receiveGuiNBT(getSide(), player, actionType, action);
|
||||
INetwork.ReceiveGuiNBT machine = Machine.getInterface(INetwork.ReceiveGuiNBT.class, window.getInventory());
|
||||
if (machine != null) {
|
||||
machine.receiveGuiNBT(getSide(), player, actionType, action);
|
||||
}
|
||||
return slotRegistered;
|
||||
}
|
||||
|
||||
private void sendContainerContents() {
|
||||
for (ICrafting crafter : crafters) {
|
||||
crafter.sendContainerAndContentsToPlayer(this, getInventory());
|
||||
}
|
||||
if (machine == null) return;
|
||||
machine.receiveGuiNBT(getSide(), player, actionType, action);
|
||||
}
|
||||
|
||||
public Slot getOrCreateSlot(InventoryType inventoryType, int slotIndex) {
|
||||
@@ -543,15 +522,13 @@ public class ContainerCraftGUI extends Container {
|
||||
};
|
||||
}
|
||||
|
||||
private boolean createSlot(InventoryType type, int index, int slotNumber) {
|
||||
if (inventorySlots.get(slotNumber) != null) return false;
|
||||
private void createSlot(InventoryType type, int index, int slotNumber) {
|
||||
if (inventorySlots.get(slotNumber) != null) return;
|
||||
|
||||
IInventory inventory = getInventory(type);
|
||||
Slot slot = new CustomSlot(inventory, index);
|
||||
slot.slotNumber = slotNumber;
|
||||
inventorySlots.add(slotNumber, slot);
|
||||
ItemStack stack = slot.getStack();
|
||||
inventoryItemStacks.add(slotNumber, stack == null ? null : stack.copy());
|
||||
return true;
|
||||
inventoryItemStacks.add(slotNumber, null);
|
||||
}
|
||||
}
|
||||
@@ -20,10 +20,6 @@ public enum EnumColor {
|
||||
Yellow("Yellow", 16777045, 'e'),
|
||||
White("White", 16777215, 'f');
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumColor[] VALUES = values();
|
||||
private final int colour;
|
||||
private final String name;
|
||||
private final char code;
|
||||
|
||||
@@ -90,7 +90,6 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
zLevel = 10.0f;
|
||||
GuiScreen.itemRender.zLevel = zLevel;
|
||||
|
||||
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
|
||||
window.render();
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
@@ -103,7 +102,7 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
InventoryPlayer playerInventory = mc.thePlayer.inventory;
|
||||
draggedItem = playerInventory.getItemStack();
|
||||
if (draggedItem != null) {
|
||||
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
|
||||
renderItem(new IPoint(mouseX - 8, mouseY - 8), draggedItem, false);
|
||||
renderItem(new IPoint(mouseX - 8, mouseY - 8), draggedItem, false);
|
||||
}
|
||||
GL11.glDisable(32826); // GL_RESCALE_NORMAL_EXT
|
||||
@@ -117,6 +116,7 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
} else {
|
||||
tooltip.setType(Tooltip.Type.STANDARD);
|
||||
window.getTooltip(tooltip);
|
||||
NEIHook.renderToolTips(mouseX, mouseY);
|
||||
}
|
||||
|
||||
if (tooltip.exists()) {
|
||||
@@ -240,16 +240,12 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char c, int key) {
|
||||
boolean noFocusedWidget = window.getFocusedWidget() == null;
|
||||
NEIHook.lastKeyTyped(key, c);
|
||||
|
||||
if (noFocusedWidget) {
|
||||
NEIHook.lastKeyTyped(key, c);
|
||||
}
|
||||
|
||||
if (key == 1 || (key == mc.gameSettings.keyBindInventory.getKeyCode() && noFocusedWidget)) {
|
||||
if (key == 1 || (key == mc.gameSettings.keyBindInventory.getKeyCode() && window.getFocusedWidget() == null)) {
|
||||
mc.thePlayer.closeScreen();
|
||||
}
|
||||
IWidget origin = noFocusedWidget ? window : window.getFocusedWidget();
|
||||
IWidget origin = (window.getFocusedWidget() == null) ? window : window.getFocusedWidget();
|
||||
window.callEvent(new EventKey.Down(origin, c, key));
|
||||
}
|
||||
|
||||
@@ -448,6 +444,7 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
}
|
||||
|
||||
GuiScreen.itemRender.renderItemOverlayIntoGUI(font, mc.renderEngine, item, (int) pos.x(), (int) pos.y(), null);
|
||||
GL11.glClear(256);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.util.Map;
|
||||
class ListMap<T> implements List<T> {
|
||||
|
||||
private final LinkedHashMap<Integer, T> map;
|
||||
private int size;
|
||||
|
||||
ListMap() {
|
||||
map = new LinkedHashMap<>();
|
||||
@@ -18,7 +17,13 @@ class ListMap<T> implements List<T> {
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return size;
|
||||
int i = -1;
|
||||
for (int k : map.keySet()) {
|
||||
if (k > i) {
|
||||
i = k;
|
||||
}
|
||||
}
|
||||
return i + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -88,7 +93,6 @@ class ListMap<T> implements List<T> {
|
||||
@Override
|
||||
public void clear() {
|
||||
map.clear();
|
||||
size = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -99,14 +103,12 @@ class ListMap<T> implements List<T> {
|
||||
@Override
|
||||
public T set(int index, T element) {
|
||||
map.put(index, element);
|
||||
size = Math.max(size, index + 1);
|
||||
return element;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(int index, T element) {
|
||||
map.put(index, element);
|
||||
size = Math.max(size, index + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -53,7 +53,6 @@ public abstract class Window extends TopLevelWidget implements INetwork.ReceiveG
|
||||
protected float titleButtonLeft;
|
||||
protected float titleButtonRight;
|
||||
private GuiCraftGUI gui;
|
||||
private Renderer renderer;
|
||||
private final ContainerCraftGUI container;
|
||||
private final WindowInventory windowInventory;
|
||||
private ControlText title;
|
||||
@@ -84,8 +83,8 @@ public abstract class Window extends TopLevelWidget implements INetwork.ReceiveG
|
||||
ControlSlot.highlighting.put(h, new ArrayList<>());
|
||||
}
|
||||
|
||||
renderer = new Renderer(gui);
|
||||
renderer.stylesheet(StyleSheetManager.getDefault());
|
||||
CraftGUI.render = new Renderer(gui);
|
||||
CraftGUI.render.stylesheet(StyleSheetManager.getDefault());
|
||||
titleButtonLeft = -14.0f;
|
||||
|
||||
if (showHelpButton()) {
|
||||
@@ -196,9 +195,6 @@ public abstract class Window extends TopLevelWidget implements INetwork.ReceiveG
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
|
||||
CraftGUI.render = renderer;
|
||||
|
||||
if (hasBeenInitialised) {
|
||||
return;
|
||||
}
|
||||
@@ -271,9 +267,7 @@ public abstract class Window extends TopLevelWidget implements INetwork.ReceiveG
|
||||
entityInventory = inventory;
|
||||
}
|
||||
|
||||
public void onClose() {
|
||||
CraftGUI.render = null;
|
||||
}
|
||||
public void onClose() {}
|
||||
|
||||
public boolean isServer() {
|
||||
return !isClient();
|
||||
|
||||
@@ -113,7 +113,7 @@ class FlowerBreedingSystem extends BreedingSystem {
|
||||
case PRIMARY:
|
||||
case SECONDARY:
|
||||
case STEM:
|
||||
for (EnumFlowerColor color : EnumFlowerColor.VALUES) {
|
||||
for (EnumFlowerColor color : EnumFlowerColor.values()) {
|
||||
alleles.add(color.getAllele());
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package binnie.core.liquid;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
@@ -11,62 +9,32 @@ import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.ManagerBase;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ManagerLiquid extends ManagerBase {
|
||||
|
||||
private static final Set<String> EXTERNAL_FLUIDS = new HashSet<>();
|
||||
|
||||
static {
|
||||
EXTERNAL_FLUIDS.add("liquidnitrogen");
|
||||
}
|
||||
|
||||
private static boolean isExternalFluid(String identifier) {
|
||||
return EXTERNAL_FLUIDS.contains(identifier) && Loader.isModLoaded("gregtech_nh");
|
||||
}
|
||||
|
||||
public Map<String, IFluidType> fluids;
|
||||
private final Set<String> ownedFluids;
|
||||
|
||||
public ManagerLiquid() {
|
||||
fluids = new LinkedHashMap<>();
|
||||
ownedFluids = new HashSet<>();
|
||||
}
|
||||
|
||||
public void createLiquids(IFluidType[] liquids, int startID) {
|
||||
for (IFluidType liquid : liquids) {
|
||||
String identifier = liquid.getIdentifier().toLowerCase();
|
||||
Fluid fluid = createOrGetLiquid(liquid, startID++);
|
||||
if (fluid == null && !isExternalFluid(identifier)) {
|
||||
BinnieFluid fluid = createLiquid(liquid, startID++);
|
||||
if (fluid == null) {
|
||||
throw new RuntimeException("Liquid registered incorrectly - " + liquid.getIdentifier());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public BinnieFluid createLiquid(IFluidType fluid, int id) {
|
||||
Fluid registeredFluid = createOrGetLiquid(fluid, id);
|
||||
return (registeredFluid instanceof BinnieFluid) ? (BinnieFluid) registeredFluid : null;
|
||||
}
|
||||
|
||||
private Fluid createOrGetLiquid(IFluidType fluid, int id) {
|
||||
String identifier = fluid.getIdentifier().toLowerCase();
|
||||
fluids.put(identifier, fluid);
|
||||
Fluid registeredFluid = FluidRegistry.getFluid(identifier);
|
||||
if (registeredFluid == null && !isExternalFluid(identifier)) {
|
||||
BinnieFluid binnieFluid = new BinnieFluid(fluid);
|
||||
FluidRegistry.registerFluid(binnieFluid);
|
||||
registeredFluid = FluidRegistry.getFluid(identifier);
|
||||
ownedFluids.add(identifier);
|
||||
} else if (registeredFluid == null) {
|
||||
FMLLog.warning(
|
||||
"[Binnie] External liquid %s is not registered yet. Waiting for the owning mod to register it before postInit.",
|
||||
identifier);
|
||||
}
|
||||
fluids.put(fluid.getIdentifier().toLowerCase(), fluid);
|
||||
BinnieFluid binnieFluid = new BinnieFluid(fluid);
|
||||
FluidRegistry.registerFluid(binnieFluid);
|
||||
ItemFluidContainer.registerFluid(fluid, id);
|
||||
return registeredFluid;
|
||||
return binnieFluid;
|
||||
}
|
||||
|
||||
public FluidStack getLiquidStack(String name, int amount) {
|
||||
@@ -76,26 +44,18 @@ public class ManagerLiquid extends ManagerBase {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void reloadIcons(IIconRegister register) {
|
||||
for (IFluidType type : fluids.values()) {
|
||||
String identifier = type.getIdentifier().toLowerCase();
|
||||
FluidStack stack = getLiquidStack(identifier, 1);
|
||||
Fluid fluid = stack == null ? null : stack.getFluid();
|
||||
Fluid fluid = getLiquidStack(type.getIdentifier(), 1).getFluid();
|
||||
type.registerIcon(register);
|
||||
if (fluid == null) {
|
||||
throw new RuntimeException("[Binnie] Liquid not registered properly - " + type.getIdentifier());
|
||||
}
|
||||
if (ownedFluids.contains(identifier)) {
|
||||
fluid.setIcons(type.getIcon());
|
||||
}
|
||||
fluid.setIcons(type.getIcon());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
for (IFluidType fluid : fluids.values()) {
|
||||
String identifier = fluid.getIdentifier().toLowerCase();
|
||||
if (isExternalFluid(identifier) && FluidRegistry.getFluid(identifier) == null) {
|
||||
throw new RuntimeException("[Binnie] External liquid not registered - " + identifier);
|
||||
}
|
||||
for (FluidContainer container : FluidContainer.values()) {
|
||||
if (container.isActive() && fluid.canPlaceIn(container)) {
|
||||
container.registerContainerData(fluid);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package binnie.core.machines;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import binnie.core.util.I18N;
|
||||
@@ -52,7 +53,8 @@ public abstract class MachinePackage {
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
public abstract void renderMachine(Machine machine, double x, double y, double z, float partialTick);
|
||||
public abstract void renderMachine(Machine machine, double x, double y, double z, float partialTick,
|
||||
RenderBlocks renderer);
|
||||
|
||||
public boolean isActive() {
|
||||
return active;
|
||||
|
||||
@@ -5,6 +5,7 @@ import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import binnie.Binnie;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
@@ -12,27 +13,30 @@ import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
// Hmm. It's used class
|
||||
public class RendererMachine extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
RenderBlocks blockRenderer;
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float partialTick) {
|
||||
renderTileEntity((TileEntityMachine) entity, x, y, z, partialTick);
|
||||
renderTileEntity((TileEntityMachine) entity, x, y, z, partialTick, blockRenderer);
|
||||
}
|
||||
|
||||
private void renderTileEntity(TileEntityMachine entity, double x, double y, double z, float partialTick) {
|
||||
public void renderTileEntity(TileEntityMachine entity, double x, double y, double z, float partialTick,
|
||||
RenderBlocks renderer) {
|
||||
if (entity != null && entity.getMachine() != null) {
|
||||
MachinePackage machinePackage = entity.getMachine().getPackage();
|
||||
machinePackage.renderMachine(entity.getMachine(), x, y, z, partialTick);
|
||||
machinePackage.renderMachine(entity.getMachine(), x, y, z, partialTick, renderer);
|
||||
}
|
||||
}
|
||||
|
||||
private void renderInvBlock(Block block, int i, int j) {
|
||||
public void renderInvBlock(RenderBlocks renderblocks, Block block, int i, int j) {
|
||||
TileEntity entity = block.createTileEntity(null, i);
|
||||
renderTileEntity((TileEntityMachine) entity, 0.0, -0.1, 0.0, 0.0625f);
|
||||
renderTileEntity((TileEntityMachine) entity, 0.0, -0.1, 0.0, 0.0625f, renderblocks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
if (modelID == Binnie.Machine.getMachineRenderID()) {
|
||||
renderInvBlock(block, metadata, modelID);
|
||||
renderInvBlock(renderer, block, metadata, modelID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +48,7 @@ public class RendererMachine extends TileEntitySpecialRenderer implements ISimpl
|
||||
&& tile.getMachine().getPackage() != null
|
||||
&& tile.getMachine().getPackage().getGroup() != null
|
||||
&& !tile.getMachine().getPackage().getGroup().customRenderer) {
|
||||
renderTileEntity(tile, x, y, z, 1.0f);
|
||||
renderTileEntity(tile, x, y, z, 1.0f, renderer);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -58,4 +62,9 @@ public class RendererMachine extends TileEntitySpecialRenderer implements ISimpl
|
||||
public int getRenderId() {
|
||||
return Binnie.Machine.getMachineRenderID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_147496_a(World par1World) {
|
||||
blockRenderer = new RenderBlocks(par1World);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package binnie.core.machines.inventory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
@@ -15,13 +16,10 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import binnie.core.machines.IMachine;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap;
|
||||
|
||||
public class ComponentInventorySlots extends ComponentInventory implements IInventoryMachine, IInventorySlots {
|
||||
|
||||
private final Int2ObjectLinkedOpenHashMap<InventorySlot> inventory = new Int2ObjectLinkedOpenHashMap<>();
|
||||
private int cachedSize = 0;
|
||||
private int[] cachedAccessibleSlots = null;
|
||||
private final Map<Integer, InventorySlot> inventory = new LinkedHashMap<>();
|
||||
|
||||
public ComponentInventorySlots(IMachine machine) {
|
||||
super(machine);
|
||||
@@ -29,20 +27,25 @@ public class ComponentInventorySlots extends ComponentInventory implements IInve
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return cachedSize;
|
||||
int size = 0;
|
||||
for (Integer index : inventory.keySet()) {
|
||||
size = Math.max(size, index + 1);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int index) {
|
||||
InventorySlot slot = inventory.get(index);
|
||||
return slot != null ? slot.getContent() : null;
|
||||
if (inventory.containsKey(index)) {
|
||||
return inventory.get(index).getContent();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int index, int amount) {
|
||||
InventorySlot slot = inventory.get(index);
|
||||
if (slot != null) {
|
||||
ItemStack stack = slot.decrStackSize(amount);
|
||||
if (inventory.containsKey(index)) {
|
||||
ItemStack stack = inventory.get(index).decrStackSize(amount);
|
||||
markDirty();
|
||||
return stack;
|
||||
}
|
||||
@@ -56,9 +59,8 @@ public class ComponentInventorySlots extends ComponentInventory implements IInve
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int index, ItemStack itemStack) {
|
||||
InventorySlot slot = inventory.get(index);
|
||||
if (slot != null && (itemStack == null || slot.isValid(itemStack))) {
|
||||
slot.setContent(itemStack);
|
||||
if (inventory.containsKey(index) && (itemStack == null || inventory.get(index).isValid(itemStack))) {
|
||||
inventory.get(index).setContent(itemStack);
|
||||
}
|
||||
markDirty();
|
||||
}
|
||||
@@ -111,7 +113,7 @@ public class ComponentInventorySlots extends ComponentInventory implements IInve
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
NBTTagList inventoryNBT = new NBTTagList();
|
||||
for (Map.Entry<Integer, InventorySlot> entry : inventory.int2ObjectEntrySet()) {
|
||||
for (Map.Entry<Integer, InventorySlot> entry : inventory.entrySet()) {
|
||||
NBTTagCompound slotNBT = new NBTTagCompound();
|
||||
slotNBT.setInteger("id", entry.getKey());
|
||||
entry.getValue().writeToNBT(slotNBT);
|
||||
@@ -123,8 +125,6 @@ public class ComponentInventorySlots extends ComponentInventory implements IInve
|
||||
@Override
|
||||
public InventorySlot addSlot(int index, String unlocalizedName) {
|
||||
inventory.put(index, new InventorySlot(index, unlocalizedName));
|
||||
cachedSize = Math.max(cachedSize, index + 1);
|
||||
cachedAccessibleSlots = null;
|
||||
return getSlot(index);
|
||||
}
|
||||
|
||||
@@ -138,7 +138,10 @@ public class ComponentInventorySlots extends ComponentInventory implements IInve
|
||||
|
||||
@Override
|
||||
public InventorySlot getSlot(int index) {
|
||||
return inventory.get(index);
|
||||
if (inventory.containsKey(index)) {
|
||||
return inventory.get(index);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -148,7 +151,7 @@ public class ComponentInventorySlots extends ComponentInventory implements IInve
|
||||
|
||||
@Override
|
||||
public InventorySlot[] getSlots(int[] indexes) {
|
||||
List<InventorySlot> list = new ArrayList<>(indexes.length);
|
||||
List<InventorySlot> list = new ArrayList<>();
|
||||
for (int i : indexes) {
|
||||
if (getSlot(i) != null) {
|
||||
list.add(getSlot(i));
|
||||
@@ -210,20 +213,18 @@ public class ComponentInventorySlots extends ComponentInventory implements IInve
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int var1) {
|
||||
if (cachedAccessibleSlots == null) {
|
||||
List<Integer> slots = new ArrayList<>();
|
||||
for (InventorySlot slot : inventory.values()) {
|
||||
if (slot.canInsert() || slot.canExtract()) {
|
||||
slots.add(slot.getIndex());
|
||||
}
|
||||
}
|
||||
|
||||
cachedAccessibleSlots = new int[slots.size()];
|
||||
for (int i = 0; i < slots.size(); ++i) {
|
||||
cachedAccessibleSlots[i] = slots.get(i);
|
||||
List<Integer> slots = new ArrayList<>();
|
||||
for (InventorySlot slot : inventory.values()) {
|
||||
if (slot.canInsert() || slot.canExtract()) {
|
||||
slots.add(slot.getIndex());
|
||||
}
|
||||
}
|
||||
return cachedAccessibleSlots;
|
||||
|
||||
int[] ids = new int[slots.size()];
|
||||
for (int i = 0; i < slots.size(); ++i) {
|
||||
ids[i] = slots.get(i);
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -233,7 +234,6 @@ public class ComponentInventorySlots extends ComponentInventory implements IInve
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack itemstack, int direction) {
|
||||
InventorySlot iSlot = getSlot(slot);
|
||||
return iSlot != null && iSlot.canExtract(ForgeDirection.getOrientation(direction));
|
||||
return getSlot(slot).canExtract(ForgeDirection.getOrientation(direction));
|
||||
}
|
||||
}
|
||||
@@ -164,7 +164,7 @@ public class ComponentTankContainer extends MachineComponent implements ITankMac
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
int index = getTankIndexToDrain(from, resource);
|
||||
int index = getTankIndexToDrain(from, null);
|
||||
if (!tanks.containsKey(index)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ 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;
|
||||
|
||||
@@ -153,8 +152,7 @@ public class ComponentPowerReceptor extends MachineComponent
|
||||
}
|
||||
|
||||
private void addToEnergyNet() {
|
||||
World world = getMachine().getWorld();
|
||||
if (world == null || world.isRemote) {
|
||||
if (getMachine().getWorld() == null) {
|
||||
return;
|
||||
}
|
||||
if (Mods.ic2.active()) {
|
||||
@@ -163,8 +161,7 @@ public class ComponentPowerReceptor extends MachineComponent
|
||||
}
|
||||
|
||||
private void removeFromEnergyNet() {
|
||||
World world = getMachine().getWorld();
|
||||
if (world == null || world.isRemote) {
|
||||
if (getMachine().getWorld() == null) {
|
||||
return;
|
||||
}
|
||||
if (Mods.ic2.active()) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package binnie.core.machines.storage;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
@@ -50,7 +51,8 @@ enum Compartment implements IMachineType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTick) {
|
||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTick,
|
||||
RenderBlocks renderer) {
|
||||
MachineRendererCompartment.instance.renderMachine(machine, renderTexture, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ class CompartmentTab implements INBTTagable {
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
name = nbt.getString("name");
|
||||
icon = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("icon"));
|
||||
color = EnumColor.VALUES[nbt.getByte("color")];
|
||||
color = EnumColor.values()[nbt.getByte("color")];
|
||||
id = nbt.getByte("id");
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ class ComponentCompartmentInventory extends ComponentInventorySlots implements I
|
||||
private final int numberOfTabs;
|
||||
private final int slotsPerPage;
|
||||
private final Map<Integer, CompartmentTab> tabs;
|
||||
private NBTTagCompound cachedGuiNBT;
|
||||
|
||||
public ComponentCompartmentInventory(IMachine machine, int sections) {
|
||||
this(machine, sections, 4);
|
||||
@@ -52,24 +51,21 @@ class ComponentCompartmentInventory extends ComponentInventorySlots implements I
|
||||
public CompartmentTab getTab(int i) {
|
||||
if (!tabs.containsKey(i)) {
|
||||
tabs.put(i, new CompartmentTab(i));
|
||||
cachedGuiNBT = null;
|
||||
}
|
||||
return tabs.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendGuiNBT(Map<String, NBTTagCompound> nbts) {
|
||||
if (cachedGuiNBT == null) {
|
||||
NBTTagList list = new NBTTagList();
|
||||
for (int i = 0; i < numberOfTabs; ++i) {
|
||||
NBTTagCompound tabNBT = new NBTTagCompound();
|
||||
getTab(i).writeToNBT(tabNBT);
|
||||
list.appendTag(tabNBT);
|
||||
}
|
||||
cachedGuiNBT = new NBTTagCompound();
|
||||
cachedGuiNBT.setTag("tabs", list);
|
||||
NBTTagList list = new NBTTagList();
|
||||
for (int i = 0; i < numberOfTabs; ++i) {
|
||||
NBTTagCompound nbt2 = new NBTTagCompound();
|
||||
getTab(i).writeToNBT(nbt2);
|
||||
list.appendTag(nbt2);
|
||||
}
|
||||
nbts.put("comp-tabs", cachedGuiNBT);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setTag("tabs", list);
|
||||
nbts.put("comp-tabs", tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,13 +78,11 @@ class ComponentCompartmentInventory extends ComponentInventorySlots implements I
|
||||
tab.readFromNBT(tag);
|
||||
tabs.put(tab.getId(), tab);
|
||||
}
|
||||
cachedGuiNBT = null;
|
||||
}
|
||||
if (name.equals("comp-change-tab")) {
|
||||
CompartmentTab tab2 = new CompartmentTab(0);
|
||||
tab2.readFromNBT(nbt);
|
||||
tabs.put(tab2.getId(), tab2);
|
||||
cachedGuiNBT = null;
|
||||
getMachine().getTileEntity().markDirty();
|
||||
}
|
||||
}
|
||||
@@ -103,7 +97,6 @@ class ComponentCompartmentInventory extends ComponentInventorySlots implements I
|
||||
tab.readFromNBT(tag);
|
||||
tabs.put(tab.getId(), tab);
|
||||
}
|
||||
cachedGuiNBT = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -173,7 +173,6 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
}
|
||||
CraftGUIUtil.linkWidgets(tab, compartmentPages);
|
||||
int i = 0;
|
||||
final NBTTagList actions = new NBTTagList();
|
||||
for (int p2 = 0; p2 < inv.getTabNumber(); ++p2) {
|
||||
ControlPage thisPage = page[p2];
|
||||
Panel panel = new Panel(thisPage, 0.0f, 0.0f, thisPage.w(), thisPage.h(), MinecraftGUI.PanelType.Black) {
|
||||
@@ -192,10 +191,11 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
slotsIDs[k] = i++;
|
||||
}
|
||||
|
||||
final NBTTagList actions = new NBTTagList();
|
||||
new ControlSlotArray(thisPage, 8, 8, inv.getPageSize() / 5, 5)
|
||||
.create(actions, InventoryType.Machine, slotsIDs);
|
||||
MessageCraftGUI.sendToServer(actions);
|
||||
}
|
||||
MessageCraftGUI.sendToServer(actions);
|
||||
x += compartmentPageWidth;
|
||||
if (tabs2.length > 0) {
|
||||
ControlTabBar<Integer> tab2 = new ControlTabBar<Integer>(
|
||||
@@ -256,8 +256,8 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
ControlSlide slide = new ControlSlide(this, 0.0f, 134.0f, 136.0f, 92.0f, Position.LEFT);
|
||||
slide.setLabel(I18N.localise("binniecore.machine.storage.tab.properties"));
|
||||
slide.setSlide(false);
|
||||
slide.addHelp(I18N.localise("binniecore.machine.storage.tab.properties"));
|
||||
slide.addHelp(I18N.localise("binniecore.machine.storage.tab.properties.desc"));
|
||||
slide.addHelp(I18N.localise("binniecore.machine.storage.tooltip.properties"));
|
||||
slide.addHelp(I18N.localise("binniecore.machine.storage.tooltip.properties.desc"));
|
||||
Panel tabPropertyPanel = new Panel(slide, 16.0f, 8.0f, 112.0f, 76.0f, MinecraftGUI.PanelType.Gray);
|
||||
int y2 = 4;
|
||||
new ControlText(tabPropertyPanel, new IPoint(4.0f, y2), I18N.localise("binniecore.machine.storage.tab.name"));
|
||||
@@ -320,7 +320,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
1 + cw * (cc / 8),
|
||||
cw,
|
||||
cw,
|
||||
EnumColor.VALUES[cc]);
|
||||
EnumColor.values()[cc]);
|
||||
color.addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,7 +3,6 @@ package binnie.core.machines.transfer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
@@ -26,20 +25,23 @@ public class TransferRequest {
|
||||
private int[] targetTanks;
|
||||
private boolean transferLiquids;
|
||||
private boolean ignoreReadOnly;
|
||||
private EntityPlayer overflowPlayer;
|
||||
private List<TransferSlot> insertedSlots;
|
||||
private List<Integer> insertedTanks;
|
||||
private final List<TransferSlot> insertedSlots;
|
||||
private final List<Integer> insertedTanks;
|
||||
|
||||
public TransferRequest(ItemStack toTransfer, IInventory destination) {
|
||||
itemToTransfer = null;
|
||||
returnItem = null;
|
||||
targetSlots = null;
|
||||
targetSlots = new int[0];
|
||||
targetTanks = new int[0];
|
||||
transferLiquids = true;
|
||||
ignoreReadOnly = false;
|
||||
overflowPlayer = null;
|
||||
insertedSlots = null;
|
||||
insertedTanks = null;
|
||||
insertedSlots = new ArrayList<>();
|
||||
insertedTanks = new ArrayList<>();
|
||||
int[] target = new int[destination.getSizeInventory()];
|
||||
|
||||
for (int i = 0; i < target.length; ++i) {
|
||||
target[i] = i;
|
||||
}
|
||||
|
||||
int[] targetTanks = new int[0];
|
||||
if (destination instanceof ITankMachine) {
|
||||
@@ -56,6 +58,7 @@ public class TransferRequest {
|
||||
|
||||
setOrigin(null);
|
||||
setDestination(destination);
|
||||
setTargetSlots(target);
|
||||
setTargetTanks(targetTanks);
|
||||
transferLiquids = true;
|
||||
}
|
||||
@@ -92,71 +95,59 @@ public class TransferRequest {
|
||||
return this;
|
||||
}
|
||||
|
||||
public TransferRequest dropOverflow(EntityPlayer player) {
|
||||
overflowPlayer = player;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemStack getReturnItem() {
|
||||
return returnItem;
|
||||
}
|
||||
|
||||
public ItemStack transfer(boolean doAdd) {
|
||||
ItemStack item = doAdd || returnItem == null ? returnItem : returnItem.copy();
|
||||
ItemStack item = returnItem;
|
||||
if (item == null || destination == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (transferLiquids && destination instanceof ITankMachine) {
|
||||
for (int tankID : targetTanks) {
|
||||
ItemStack itemBeforeTransfer = item.copy();
|
||||
item = transferToTank(item, origin, (ITankMachine) destination, tankID, doAdd);
|
||||
if (item == null || !ItemStack.areItemStacksEqual(item, itemBeforeTransfer)) {
|
||||
break;
|
||||
}
|
||||
|
||||
item = transferFromTank(item, origin, (ITankMachine) destination, tankID, doAdd);
|
||||
if (item == null || !ItemStack.areItemStacksEqual(item, itemBeforeTransfer)) {
|
||||
break;
|
||||
if (item != null) {
|
||||
item = transferFromTank(item, origin, (ITankMachine) destination, tankID, doAdd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO simplify
|
||||
if (item != null) {
|
||||
int[] slots = getTargetSlots();
|
||||
for (int slot : slots) {
|
||||
for (int slot : targetSlots) {
|
||||
if (destination.isItemValidForSlot(slot, item) || ignoreReadOnly) {
|
||||
if (!(destination instanceof IInventorySlots)
|
||||
|| ((IInventorySlots) destination).getSlot(slot) == null
|
||||
|| !((IInventorySlots) destination).getSlot(slot).isRecipe()) {
|
||||
ItemStack merged = destination.getStackInSlot(slot);
|
||||
if (merged != null && item.isStackable()
|
||||
&& destination.getInventoryStackLimit() > 1
|
||||
&& areItemsEqual(item, merged)) {
|
||||
int amount = Math.min(item.stackSize, merged.getMaxStackSize() - merged.stackSize);
|
||||
if (amount > 0) {
|
||||
getInsertedSlots().add(new TransferSlot(slot, destination));
|
||||
if (doAdd) {
|
||||
ItemStack newStack = merged.copy();
|
||||
newStack.stackSize += amount;
|
||||
destination.setInventorySlotContents(slot, newStack);
|
||||
if (destination.getStackInSlot(slot) != null) {
|
||||
if (item.isStackable() && destination.getInventoryStackLimit() > 1) {
|
||||
ItemStack merged = destination.getStackInSlot(slot).copy();
|
||||
ItemStack[] newStacks = mergeStacks(item.copy(), merged.copy());
|
||||
item = newStacks[0];
|
||||
if (!areItemsEqual(merged, newStacks[1])) {
|
||||
insertedSlots.add(new TransferSlot(slot, destination));
|
||||
}
|
||||
if (doAdd) {
|
||||
destination.setInventorySlotContents(slot, newStacks[1]);
|
||||
}
|
||||
if (item == null) {
|
||||
return null;
|
||||
}
|
||||
item.stackSize -= amount;
|
||||
if (item.stackSize <= 0) return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int slot : slots) {
|
||||
for (int slot : targetSlots) {
|
||||
if (destination.isItemValidForSlot(slot, item) || ignoreReadOnly) {
|
||||
if (!(destination instanceof IInventorySlots)
|
||||
|| ((IInventorySlots) destination).getSlot(slot) == null
|
||||
|| !((IInventorySlots) destination).getSlot(slot).isRecipe()) {
|
||||
if (destination.getStackInSlot(slot) == null) {
|
||||
getInsertedSlots().add(new TransferSlot(slot, destination));
|
||||
insertedSlots.add(new TransferSlot(slot, destination));
|
||||
if (doAdd) {
|
||||
ItemStack movedStack = item.copy();
|
||||
if (movedStack.stackSize > destination.getInventoryStackLimit()) {
|
||||
@@ -209,13 +200,11 @@ public class TransferRequest {
|
||||
|
||||
private ItemStack transferToTankUsingFluidContainer(ItemStack item, IInventory origin, ITankMachine destination,
|
||||
int tankID, boolean doAdd) {
|
||||
if (item == null || origin == null || !(item.getItem() instanceof IFluidContainerItem fluidContainer)) {
|
||||
if (item == null || !(item.getItem() instanceof IFluidContainerItem fluidContainer)) {
|
||||
return item;
|
||||
}
|
||||
|
||||
ItemStack singleContainer = item.copy();
|
||||
singleContainer.stackSize = 1;
|
||||
FluidStack fluid = fluidContainer.getFluid(singleContainer);
|
||||
FluidStack fluid = fluidContainer.getFluid(item);
|
||||
if (fluid == null) {
|
||||
return item;
|
||||
}
|
||||
@@ -227,22 +216,11 @@ public class TransferRequest {
|
||||
}
|
||||
|
||||
int maxFill = tank.fill(fluid, false);
|
||||
FluidStack toTake = fluidContainer.drain(singleContainer, maxFill, true);
|
||||
if (toTake == null || toTake.amount <= 0) {
|
||||
return item;
|
||||
}
|
||||
|
||||
TransferRequest containerDump = createContainerDump(singleContainer, origin);
|
||||
boolean dropContainer = containerDump.transfer(false) != null;
|
||||
if (dropContainer && overflowPlayer == null) {
|
||||
return item;
|
||||
}
|
||||
|
||||
FluidStack toTake = fluidContainer.drain(item, maxFill, true);
|
||||
if (doAdd) {
|
||||
tank.fill(toTake, true);
|
||||
dumpContainer(singleContainer, containerDump, dropContainer);
|
||||
}
|
||||
return removeSingleContainer(item);
|
||||
return item;
|
||||
}
|
||||
|
||||
private ItemStack transferToTankUsingContainerData(ItemStack item, IInventory origin, ITankMachine destination,
|
||||
@@ -327,69 +305,24 @@ public class TransferRequest {
|
||||
|
||||
private ItemStack transferFromTankUsingFluidContainer(ItemStack item, IInventory origin, ITankMachine destination,
|
||||
int tankID, boolean doAdd) {
|
||||
if (item == null || origin == null || !(item.getItem() instanceof IFluidContainerItem fluidContainer)) {
|
||||
if (item == null || !(item.getItem() instanceof IFluidContainerItem fluidContainer)) {
|
||||
return item;
|
||||
}
|
||||
|
||||
ItemStack singleContainer = item.copy();
|
||||
singleContainer.stackSize = 1;
|
||||
IFluidTank tank = destination.getTanks()[tankID];
|
||||
FluidStack fluid = tank.getFluid();
|
||||
if (fluid == null) {
|
||||
return item;
|
||||
}
|
||||
|
||||
int amount = fluidContainer.fill(singleContainer, fluid, false);
|
||||
FluidStack drained = tank.drain(amount, false);
|
||||
if (drained == null || drained.amount <= 0) {
|
||||
int amount = fluidContainer.fill(item, fluid, false);
|
||||
amount = Math.min(amount, (tank.drain(amount, false) == null) ? 0 : tank.drain(amount, false).amount);
|
||||
if (amount <= 0) {
|
||||
return item;
|
||||
}
|
||||
|
||||
int amountFilled = fluidContainer.fill(singleContainer, drained, true);
|
||||
if (amountFilled <= 0) {
|
||||
return item;
|
||||
}
|
||||
|
||||
TransferRequest containerDump = createContainerDump(singleContainer, origin);
|
||||
boolean dropContainer = containerDump.transfer(false) != null;
|
||||
if (dropContainer && overflowPlayer == null) {
|
||||
return item;
|
||||
}
|
||||
|
||||
if (doAdd) {
|
||||
tank.drain(amountFilled, true);
|
||||
dumpContainer(singleContainer, containerDump, dropContainer);
|
||||
}
|
||||
return removeSingleContainer(item);
|
||||
}
|
||||
|
||||
private TransferRequest createContainerDump(ItemStack container, IInventory origin) {
|
||||
TransferRequest containerDump = new TransferRequest(container, origin).setTargetTanks(new int[0]);
|
||||
if (overflowPlayer != null && origin == overflowPlayer.inventory) {
|
||||
int[] mainInventorySlots = new int[overflowPlayer.inventory.mainInventory.length];
|
||||
for (int i = 0; i < mainInventorySlots.length; ++i) {
|
||||
mainInventorySlots[i] = i;
|
||||
}
|
||||
containerDump.setTargetSlots(mainInventorySlots);
|
||||
}
|
||||
return containerDump;
|
||||
}
|
||||
|
||||
private void dumpContainer(ItemStack container, TransferRequest containerDump, boolean dropContainer) {
|
||||
if (dropContainer) {
|
||||
overflowPlayer.dropPlayerItemWithRandomChoice(container.copy(), false);
|
||||
} else {
|
||||
containerDump.transfer(true);
|
||||
}
|
||||
}
|
||||
|
||||
private static ItemStack removeSingleContainer(ItemStack item) {
|
||||
if (item.stackSize <= 1) {
|
||||
return null;
|
||||
}
|
||||
ItemStack leftover = item.copy();
|
||||
--leftover.stackSize;
|
||||
return leftover;
|
||||
fluidContainer.fill(item, tank.drain(amount, doAdd), doAdd);
|
||||
return item;
|
||||
}
|
||||
|
||||
private ItemStack transferFromTankUsingContainerData(ItemStack item, IInventory origin, ITankMachine destination,
|
||||
@@ -466,16 +399,10 @@ public class TransferRequest {
|
||||
}
|
||||
|
||||
public List<TransferSlot> getInsertedSlots() {
|
||||
if (insertedSlots == null) {
|
||||
insertedSlots = new ArrayList<>();
|
||||
}
|
||||
return insertedSlots;
|
||||
}
|
||||
|
||||
public List<Integer> getInsertedTanks() {
|
||||
if (insertedTanks == null) {
|
||||
insertedTanks = new ArrayList<>();
|
||||
}
|
||||
return insertedTanks;
|
||||
}
|
||||
|
||||
@@ -492,12 +419,6 @@ public class TransferRequest {
|
||||
}
|
||||
|
||||
public int[] getTargetSlots() {
|
||||
if (targetSlots == null) {
|
||||
targetSlots = new int[destination.getSizeInventory()];
|
||||
for (int i = 0; i < targetSlots.length; ++i) {
|
||||
targetSlots[i] = i;
|
||||
}
|
||||
}
|
||||
return targetSlots;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package binnie.extrabees.apiary.machine;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
@@ -65,7 +66,8 @@ public enum AlvearyMachine implements IMachineType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTick) {
|
||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTick,
|
||||
RenderBlocks renderer) {
|
||||
MachineRendererBlock.instance.renderMachine(machineTexture, x, y, z, partialTick);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package binnie.genetics.config;
|
||||
package binnie.extrabees.config;
|
||||
|
||||
import static binnie.genetics.Genetics.GENETICS_MODID;
|
||||
import static binnie.extrabees.ExtraBees.EB_MODID;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.config.Config;
|
||||
|
||||
@Config(modid = GENETICS_MODID)
|
||||
public class GeneticsConfig {
|
||||
@Config(modid = EB_MODID)
|
||||
public class EBConfigMachines {
|
||||
|
||||
@Config.Comment("Percentage chance of Isolator consuming bee. 0 never consumes, 1 always does.")
|
||||
@Config.RangeFloat(min = 0f, max = 1f)
|
||||
@@ -54,9 +54,9 @@ public class ControlClimateBar extends Control implements ITooltip {
|
||||
}
|
||||
|
||||
if (isHumidity) {
|
||||
tooltip.add(EnumHumidity.VALUES[type].name);
|
||||
tooltip.add(EnumHumidity.values()[type].name);
|
||||
} else {
|
||||
tooltip.add(EnumTemperature.VALUES[type + 1].name);
|
||||
tooltip.add(EnumTemperature.values()[type + 1].name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -101,10 +101,6 @@ public enum EnumHoneyComb implements IItemEnum {
|
||||
CYANITE(new Color(0x27204d), new Color(0x86ed)),
|
||||
BLUTONIUM(new Color(0x27204d), new Color(0x1b00e6));
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumHoneyComb[] VALUES = values();
|
||||
public final Map<ItemStack, Float> products;
|
||||
public final int primaryColor;
|
||||
public final int secondaryColor;
|
||||
@@ -121,10 +117,10 @@ public enum EnumHoneyComb implements IItemEnum {
|
||||
|
||||
public static EnumHoneyComb get(ItemStack itemStack) {
|
||||
int i = itemStack.getItemDamage();
|
||||
if (i >= 0 && i < VALUES.length) {
|
||||
return VALUES[i];
|
||||
if (i >= 0 && i < values().length) {
|
||||
return values()[i];
|
||||
}
|
||||
return VALUES[0];
|
||||
return values()[0];
|
||||
}
|
||||
|
||||
public void addRecipe() {
|
||||
|
||||
@@ -44,10 +44,6 @@ public enum EnumHoneyDrop implements IItemEnum {
|
||||
MAGENTA(new Color(0xe57fd8), new Color(0xff00cc), "for.honey"),
|
||||
LIGHTGRAY(new Color(0x999999), new Color(0xc9c9c9), "for.honey");
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumHoneyDrop[] VALUES = values();
|
||||
public final int primaryColor;
|
||||
public final int secondaryColor;
|
||||
|
||||
@@ -62,10 +58,10 @@ public enum EnumHoneyDrop implements IItemEnum {
|
||||
|
||||
public static EnumHoneyDrop get(ItemStack itemStack) {
|
||||
int i = itemStack.getItemDamage();
|
||||
if (i >= 0 && i < VALUES.length) {
|
||||
return VALUES[i];
|
||||
if (i >= 0 && i < values().length) {
|
||||
return values()[i];
|
||||
}
|
||||
return VALUES[0];
|
||||
return values()[0];
|
||||
}
|
||||
|
||||
public void addRemenant(ItemStack stack) {
|
||||
|
||||
@@ -24,10 +24,6 @@ public enum EnumPropolis implements IItemEnum {
|
||||
// GLACIAL,
|
||||
// PEAT
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumPropolis[] VALUES = values();
|
||||
public final int secondaryColor;
|
||||
public final int primaryColor;
|
||||
public final String liquidName;
|
||||
@@ -40,10 +36,10 @@ public enum EnumPropolis implements IItemEnum {
|
||||
|
||||
public static EnumPropolis get(ItemStack itemStack) {
|
||||
int i = itemStack.getItemDamage();
|
||||
if (i >= 0 && i < VALUES.length) {
|
||||
return VALUES[i];
|
||||
if (i >= 0 && i < values().length) {
|
||||
return values()[i];
|
||||
}
|
||||
return VALUES[0];
|
||||
return values()[0];
|
||||
}
|
||||
|
||||
public void addRecipe() {
|
||||
|
||||
@@ -21,7 +21,7 @@ public class ItemHoneyComb extends ItemProduct {
|
||||
protected IIcon icon2;
|
||||
|
||||
public ItemHoneyComb() {
|
||||
super("honeyComb", EnumHoneyComb.VALUES);
|
||||
super("honeyComb", EnumHoneyComb.values());
|
||||
setCreativeTab(Tabs.tabApiculture);
|
||||
}
|
||||
|
||||
@@ -148,9 +148,7 @@ public class ItemHoneyComb extends ItemProduct {
|
||||
|
||||
EnumHoneyComb.COFFEE.addProduct(beeswax, 0.90f);
|
||||
EnumHoneyComb.COFFEE.addProduct(honeyDrop, 0.75f);
|
||||
if (!OreDictionary.getOres("dustCoffee").isEmpty()) {
|
||||
EnumHoneyComb.COFFEE.tryAddProduct(OreDictionary.getOres("dustCoffee").get(0), 0.75f);
|
||||
}
|
||||
EnumHoneyComb.COFFEE.tryAddProduct(Mods.ic2.stack("itemCofeePowder"), 0.75f);
|
||||
|
||||
EnumHoneyComb.GLACIAL.tryAddProduct(EnumHoneyDrop.ICE, 0.80f);
|
||||
EnumHoneyComb.GLACIAL.addProduct(honeyDrop, 0.75f);
|
||||
@@ -233,15 +231,15 @@ public class ItemHoneyComb extends ItemProduct {
|
||||
OreDictionary.registerOre("beeComb", new ItemStack(ExtraBees.comb, 1, 32767));
|
||||
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
EnumHoneyComb type = EnumHoneyComb.VALUES[EnumHoneyComb.RED.ordinal() + i];
|
||||
EnumHoneyComb type = EnumHoneyComb.values()[EnumHoneyComb.RED.ordinal() + i];
|
||||
if (type != EnumHoneyComb.RED) {
|
||||
type.copyProducts(EnumHoneyComb.RED);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
EnumHoneyComb type = EnumHoneyComb.VALUES[EnumHoneyComb.RED.ordinal() + i];
|
||||
EnumHoneyDrop drop = EnumHoneyDrop.VALUES[EnumHoneyDrop.RED.ordinal() + i];
|
||||
EnumHoneyComb type = EnumHoneyComb.values()[EnumHoneyComb.RED.ordinal() + i];
|
||||
EnumHoneyDrop drop = EnumHoneyDrop.values()[EnumHoneyDrop.RED.ordinal() + i];
|
||||
int[] dyeC = { 1, 11, 4, 2, 0, 15, 3, 14, 6, 5, 8, 12, 9, 10, 13, 7 };
|
||||
int k = dyeC[i];
|
||||
ItemStack dye = switch (k) {
|
||||
|
||||
@@ -15,7 +15,7 @@ public class ItemHoneyDrop extends ItemProduct {
|
||||
protected IIcon icon2;
|
||||
|
||||
public ItemHoneyDrop() {
|
||||
super("honeyDrop", EnumHoneyDrop.VALUES);
|
||||
super("honeyDrop", EnumHoneyDrop.values());
|
||||
setCreativeTab(Tabs.tabApiculture);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import forestry.api.core.Tabs;
|
||||
public class ItemPropolis extends ItemProduct {
|
||||
|
||||
public ItemPropolis() {
|
||||
super("propolis", EnumPropolis.VALUES);
|
||||
super("propolis", EnumPropolis.values());
|
||||
setCreativeTab(Tabs.tabApiculture);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,13 +25,13 @@ public class ModuleProducts implements IInitializable {
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
for (EnumHoneyComb info : EnumHoneyComb.VALUES) {
|
||||
for (EnumHoneyComb info : EnumHoneyComb.values()) {
|
||||
info.addRecipe();
|
||||
}
|
||||
for (EnumHoneyDrop info2 : EnumHoneyDrop.VALUES) {
|
||||
for (EnumHoneyDrop info2 : EnumHoneyDrop.values()) {
|
||||
info2.addRecipe();
|
||||
}
|
||||
for (EnumPropolis info3 : EnumPropolis.VALUES) {
|
||||
for (EnumPropolis info3 : EnumPropolis.values()) {
|
||||
info3.addRecipe();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class BlockExtraBeeHive extends Block {
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
if (metadata >= EnumHiveType.VALUES.length) {
|
||||
if (metadata >= EnumHiveType.values().length) {
|
||||
return null;
|
||||
}
|
||||
if (side < 2) {
|
||||
@@ -56,8 +56,8 @@ public class BlockExtraBeeHive extends Block {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
icons = new IIcon[EnumHiveType.VALUES.length][2];
|
||||
for (EnumHiveType hive : EnumHiveType.VALUES) {
|
||||
icons = new IIcon[EnumHiveType.values().length][2];
|
||||
for (EnumHiveType hive : EnumHiveType.values()) {
|
||||
icons[hive.ordinal()][0] = ExtraBees.proxy
|
||||
.getIcon(register, "hive/" + hive.toString().toLowerCase() + ".0");
|
||||
icons[hive.ordinal()][1] = ExtraBees.proxy
|
||||
@@ -68,7 +68,7 @@ public class BlockExtraBeeHive extends Block {
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ArrayList<ItemStack> ret = new ArrayList<>();
|
||||
List<IHiveDrop> dropList = EnumHiveType.VALUES[metadata].drops;
|
||||
List<IHiveDrop> dropList = EnumHiveType.values()[metadata].drops;
|
||||
Collections.shuffle(dropList);
|
||||
int tries = 0;
|
||||
|
||||
|
||||
@@ -12,10 +12,6 @@ public enum EnumHiveType {
|
||||
NETHER,
|
||||
MARBLE;
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumHiveType[] VALUES = values();
|
||||
public final List<IHiveDrop> drops;
|
||||
|
||||
EnumHiveType() {
|
||||
|
||||
@@ -40,8 +40,8 @@ public class BlockETDoor extends BlockDoor implements IBlockMetadata {
|
||||
|
||||
public static DoorType getDoorType(int tileMeta) {
|
||||
int type = (tileMeta & 0xF00) >> 8;
|
||||
if (type < DoorType.VALUES.length) {
|
||||
return DoorType.VALUES[type];
|
||||
if (type < DoorType.values().length) {
|
||||
return DoorType.values()[type];
|
||||
}
|
||||
return DoorType.STANDARD;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ public class BlockETDoor extends BlockDoor implements IBlockMetadata {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
for (DoorType type : DoorType.VALUES) {
|
||||
for (DoorType type : DoorType.values()) {
|
||||
type.iconDoorLower = ExtraTrees.proxy.getIcon(register, "door." + type.id + ".lower");
|
||||
type.iconDoorUpper = ExtraTrees.proxy.getIcon(register, "door." + type.id + ".upper");
|
||||
type.iconDoorLowerFlip = new IconFlipped(type.iconDoorLower, true, false);
|
||||
@@ -237,18 +237,18 @@ public class BlockETDoor extends BlockDoor implements IBlockMetadata {
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> itemList) {
|
||||
for (IPlankType type : PlankType.ExtraTreePlanks.VALUES) {
|
||||
for (IPlankType type : PlankType.ExtraTreePlanks.values()) {
|
||||
itemList.add(WoodManager.getDoor(type, DoorType.STANDARD));
|
||||
}
|
||||
for (IPlankType type : PlankType.ForestryPlanks.VALUES) {
|
||||
for (IPlankType type : PlankType.ForestryPlanks.values()) {
|
||||
itemList.add(WoodManager.getDoor(type, DoorType.STANDARD));
|
||||
}
|
||||
for (IPlankType type : PlankType.ExtraBiomesPlank.VALUES) {
|
||||
for (IPlankType type : PlankType.ExtraBiomesPlank.values()) {
|
||||
if (type.getStack() != null) {
|
||||
itemList.add(WoodManager.getDoor(type, DoorType.STANDARD));
|
||||
}
|
||||
}
|
||||
for (IPlankType type : PlankType.VanillaPlanks.VALUES) {
|
||||
for (IPlankType type : PlankType.VanillaPlanks.values()) {
|
||||
itemList.add(WoodManager.getDoor(type, DoorType.STANDARD));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class BlockETLog extends BlockLog implements IBlockMetadata {
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> list) {
|
||||
for (int i = 0; i < ILogType.ExtraTreeLog.VALUES.length; ++i) {
|
||||
for (int i = 0; i < ILogType.ExtraTreeLog.values().length; ++i) {
|
||||
list.add(TileEntityMetadata.getItemStack(this, i));
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public class BlockETLog extends BlockLog implements IBlockMetadata {
|
||||
|
||||
public IIcon getIcon(int side, int tileMeta, int blockMeta) {
|
||||
int oriented = blockMeta & 0xC;
|
||||
ILogType.ExtraTreeLog log = ILogType.ExtraTreeLog.VALUES[tileMeta];
|
||||
ILogType.ExtraTreeLog log = ILogType.ExtraTreeLog.values()[tileMeta];
|
||||
switch (oriented) {
|
||||
case 4:
|
||||
if (side > 3) {
|
||||
@@ -125,7 +125,7 @@ public class BlockETLog extends BlockLog implements IBlockMetadata {
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||
ILogType.ExtraTreeLog[] logs = ILogType.ExtraTreeLog.VALUES;
|
||||
ILogType.ExtraTreeLog[] logs = ILogType.ExtraTreeLog.values();
|
||||
if (meta < 0 || meta >= logs.length) {
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class BlockETPlanks extends BlockWood implements IBlockMetadata {
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||
return I18N.localise("extratrees.block.plank.name", PlankType.ExtraTreePlanks.VALUES[meta].getName());
|
||||
return I18N.localise("extratrees.block.plank.name", PlankType.ExtraTreePlanks.values()[meta].getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -90,7 +90,7 @@ public class BlockETPlanks extends BlockWood implements IBlockMetadata {
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> list) {
|
||||
for (int i = 0; i < PlankType.ExtraTreePlanks.VALUES.length; ++i) {
|
||||
for (int i = 0; i < PlankType.ExtraTreePlanks.values().length; ++i) {
|
||||
list.add(TileEntityMetadata.getItemStack(this, i));
|
||||
}
|
||||
}
|
||||
@@ -107,13 +107,13 @@ public class BlockETPlanks extends BlockWood implements IBlockMetadata {
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return PlankType.ExtraTreePlanks.VALUES[meta].getIcon();
|
||||
return PlankType.ExtraTreePlanks.values()[meta].getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
for (PlankType.ExtraTreePlanks plank : PlankType.ExtraTreePlanks.VALUES) {
|
||||
for (PlankType.ExtraTreePlanks plank : PlankType.ExtraTreePlanks.values()) {
|
||||
plank.loadIcon(register);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public class BlockETSlab extends BlockWoodSlab implements IBlockMetadata {
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||
return I18N.localise("extratrees.block.woodslab.name", PlankType.ExtraTreePlanks.VALUES[meta].getName());
|
||||
return I18N.localise("extratrees.block.woodslab.name", PlankType.ExtraTreePlanks.values()[meta].getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -106,7 +106,7 @@ public class BlockETSlab extends BlockWoodSlab implements IBlockMetadata {
|
||||
if (field_150004_a) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < PlankType.ExtraTreePlanks.VALUES.length; ++i) {
|
||||
for (int i = 0; i < PlankType.ExtraTreePlanks.values().length; ++i) {
|
||||
list.add(TileEntityMetadata.getItemStack(this, i));
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ public class BlockETSlab extends BlockWoodSlab implements IBlockMetadata {
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return PlankType.ExtraTreePlanks.VALUES[meta].getIcon();
|
||||
return PlankType.ExtraTreePlanks.values()[meta].getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,7 +43,7 @@ public class BlockETStairs extends BlockStairs implements IBlockMetadata {
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List<ItemStack> list) {
|
||||
for (int i = 0; i < PlankType.ExtraTreePlanks.VALUES.length; ++i) {
|
||||
for (int i = 0; i < PlankType.ExtraTreePlanks.values().length; ++i) {
|
||||
list.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,10 +11,6 @@ public enum DoorType {
|
||||
DOUBLE("double"),
|
||||
FULL("full");
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final DoorType[] VALUES = values();
|
||||
final String id;
|
||||
IIcon iconDoorLower;
|
||||
IIcon iconDoorUpper;
|
||||
|
||||
@@ -58,7 +58,7 @@ public interface ILogType {
|
||||
Rosewood("rosewood", 0x998666, PlankType.ExtraTreePlanks.Rosewood),
|
||||
Purpleheart("purpleheart", 0x9392a2, PlankType.ExtraTreePlanks.Purpleheart),
|
||||
Iroko("iroko", 0x605c5b, PlankType.ExtraTreePlanks.Iroko),
|
||||
Ginkgo("ginkgo", 0xadae9c, PlankType.ExtraTreePlanks.Ginkgo),
|
||||
Gingko("gingko", 0xadae9c, PlankType.ExtraTreePlanks.Gingko),
|
||||
Eucalyptus("eucalyptus", 0xeadeda, PlankType.ExtraTreePlanks.Eucalyptus),
|
||||
Eucalyptus2("eucalyptus", 0x867e65, PlankType.ExtraTreePlanks.Eucalyptus),
|
||||
Box("box", 0xab6f57, PlankType.ExtraTreePlanks.Box),
|
||||
@@ -67,10 +67,6 @@ public interface ILogType {
|
||||
Cinnamon("cinnamon", 0x86583c, PlankType.VanillaPlanks.JUNGLE),
|
||||
PinkIvory("pinkivory", 0x7f6554, PlankType.ExtraTreePlanks.PinkIvory);
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final ExtraTreeLog[] VALUES = values();
|
||||
private final String name;
|
||||
private final int color;
|
||||
private final IDesignMaterial plank;
|
||||
@@ -90,7 +86,7 @@ public interface ILogType {
|
||||
}
|
||||
|
||||
public static void registerIcons(IIconRegister register) {
|
||||
for (ExtraTreeLog log : VALUES) {
|
||||
for (ExtraTreeLog log : values()) {
|
||||
log.trunk = ExtraTrees.proxy.getIcon(register, "logs/" + log.toString().toLowerCase() + "Trunk");
|
||||
log.bark = ExtraTrees.proxy.getIcon(register, "logs/" + log.toString().toLowerCase() + "Bark");
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class ItemETDoor extends ItemMetadata {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
for (DoorType type : DoorType.VALUES) {
|
||||
for (DoorType type : DoorType.values()) {
|
||||
type.iconItem = ExtraTrees.proxy.getIcon(register, "door." + type.id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ public class ItemETSlab extends ItemMetadata {
|
||||
theHalfSlab = (BlockETSlab) ExtraTrees.blockSlab;
|
||||
doubleSlab = (BlockETSlab) ExtraTrees.blockDoubleSlab;
|
||||
isFullBlock = (block != theHalfSlab);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,14 +19,12 @@ public class ItemETStairs extends ItemBlock {
|
||||
super(block);
|
||||
setCreativeTab(CreativeTabs.tabBlock);
|
||||
setUnlocalizedName("stairs");
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int par1) {
|
||||
return PlankType.ExtraTreePlanks.VALUES[par1].getIcon();
|
||||
return PlankType.ExtraTreePlanks.values()[par1].getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -67,12 +67,12 @@ public class ModuleBlocks implements IInitializable {
|
||||
.registerCustomItemRenderer(Item.getItemFromBlock(ExtraTrees.blockStairs), new StairItemRenderer());
|
||||
BinnieCore.proxy
|
||||
.registerCustomItemRenderer(Item.getItemFromBlock(ExtraTrees.blockGate), new GateItemRenderer());
|
||||
for (ILogType plank : ILogType.ExtraTreeLog.VALUES) {
|
||||
for (ILogType plank : ILogType.ExtraTreeLog.values()) {
|
||||
OreDictionary.registerOre("logWood", plank.getItemStack());
|
||||
}
|
||||
|
||||
GameRegistry.addSmelting(ExtraTrees.blockLog, new ItemStack(Items.coal, 1, 1), 0.15f);
|
||||
for (IPlankType plank2 : PlankType.ExtraTreePlanks.VALUES) {
|
||||
for (IPlankType plank2 : PlankType.ExtraTreePlanks.values()) {
|
||||
OreDictionary.registerOre("plankWood", plank2.getStack());
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class ModuleBlocks implements IInitializable {
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
for (PlankType.ExtraTreePlanks plank : PlankType.ExtraTreePlanks.VALUES) {
|
||||
for (PlankType.ExtraTreePlanks plank : PlankType.ExtraTreePlanks.values()) {
|
||||
ItemStack planks = plank.getStack();
|
||||
ItemStack slabs = TileEntityMetadata.getItemStack(ExtraTrees.blockSlab, plank.ordinal());
|
||||
ItemStack stairs = TileEntityMetadata.getItemStack(ExtraTrees.blockStairs, plank.ordinal());
|
||||
|
||||
@@ -18,16 +18,16 @@ import extrabiomes.api.Stuff;
|
||||
public class PlankType {
|
||||
|
||||
public static void setup() {
|
||||
for (VanillaPlanks plank : VanillaPlanks.VALUES) {
|
||||
for (VanillaPlanks plank : VanillaPlanks.values()) {
|
||||
CarpentryManager.carpentryInterface.registerCarpentryWood(plank.ordinal(), plank);
|
||||
}
|
||||
for (ExtraTreePlanks plank2 : ExtraTreePlanks.VALUES) {
|
||||
for (ExtraTreePlanks plank2 : ExtraTreePlanks.values()) {
|
||||
CarpentryManager.carpentryInterface.registerCarpentryWood(plank2.ordinal() + 32, plank2);
|
||||
}
|
||||
for (ForestryPlanks plank3 : ForestryPlanks.VALUES) {
|
||||
for (ForestryPlanks plank3 : ForestryPlanks.values()) {
|
||||
CarpentryManager.carpentryInterface.registerCarpentryWood(plank3.ordinal() + 128, plank3);
|
||||
}
|
||||
for (ExtraBiomesPlank plank4 : ExtraBiomesPlank.VALUES) {
|
||||
for (ExtraBiomesPlank plank4 : ExtraBiomesPlank.values()) {
|
||||
CarpentryManager.carpentryInterface.registerCarpentryWood(plank4.ordinal() + 192, plank4);
|
||||
}
|
||||
}
|
||||
@@ -67,13 +67,9 @@ public class PlankType {
|
||||
Olive(0xb0ad88),
|
||||
Sweetgum(0xd59658),
|
||||
Rosewood(0x761500),
|
||||
Ginkgo(0xf4e7ba),
|
||||
Gingko(0xf4e7ba),
|
||||
PinkIvory(0xec8ca0);
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final ExtraTreePlanks[] VALUES = values();
|
||||
private final int color;
|
||||
private IIcon icon;
|
||||
|
||||
@@ -125,10 +121,6 @@ public class PlankType {
|
||||
ACACIA(0xba6337),
|
||||
DARKOAK(0x462d15);
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final VanillaPlanks[] VALUES = values();
|
||||
private final int color;
|
||||
|
||||
VanillaPlanks(int color) {
|
||||
@@ -200,10 +192,6 @@ public class PlankType {
|
||||
COCOBOLO(0x731302),
|
||||
ZEBRAWOOD(0xa6824e);
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final ForestryPlanks[] VALUES = values();
|
||||
private final int color;
|
||||
|
||||
ForestryPlanks(int color) {
|
||||
@@ -253,10 +241,6 @@ public class PlankType {
|
||||
Fir(0x7e774a),
|
||||
Acacia(0xbfaa7e);
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final ExtraBiomesPlank[] VALUES = values();
|
||||
private final int color;
|
||||
|
||||
ExtraBiomesPlank(int color) {
|
||||
|
||||
@@ -15,7 +15,7 @@ public class StairItemRenderer implements IItemRenderer {
|
||||
private void renderStairBlock(RenderBlocks renderBlocks, ItemStack item, float f, float g, float h) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
Block block = ((ItemBlock) item.getItem()).field_150939_a;
|
||||
IIcon textureIndex = PlankType.ExtraTreePlanks.VALUES[item.getItemDamage()].getIcon();
|
||||
IIcon textureIndex = PlankType.ExtraTreePlanks.values()[item.getItemDamage()].getIcon();
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
if (i == 0) {
|
||||
|
||||
@@ -105,12 +105,12 @@ public class WoodManager {
|
||||
}
|
||||
|
||||
List<IPlankType> list = new ArrayList<>();
|
||||
Collections.addAll(list, PlankType.ExtraTreePlanks.VALUES);
|
||||
Collections.addAll(list, PlankType.ForestryPlanks.VALUES);
|
||||
Collections.addAll(list, PlankType.ExtraTreePlanks.values());
|
||||
Collections.addAll(list, PlankType.ForestryPlanks.values());
|
||||
if (Mods.extraBiomes.active()) {
|
||||
Collections.addAll(list, PlankType.ExtraBiomesPlank.VALUES);
|
||||
Collections.addAll(list, PlankType.ExtraBiomesPlank.values());
|
||||
}
|
||||
Collections.addAll(list, PlankType.VanillaPlanks.VALUES);
|
||||
Collections.addAll(list, PlankType.VanillaPlanks.values());
|
||||
allPlankTypes = list;
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@ public class BlockFence extends net.minecraft.block.BlockFence implements IBlock
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> list) {
|
||||
for (IFenceProvider type : PlankType.ExtraTreePlanks.VALUES) {
|
||||
for (IFenceProvider type : PlankType.ExtraTreePlanks.values()) {
|
||||
list.add(type.getFence());
|
||||
}
|
||||
|
||||
for (IFenceProvider type : PlankType.VanillaPlanks.VALUES) {
|
||||
for (IFenceProvider type : PlankType.VanillaPlanks.values()) {
|
||||
if (type != PlankType.VanillaPlanks.OAK) {
|
||||
list.add(type.getFence());
|
||||
}
|
||||
|
||||
@@ -408,9 +408,6 @@ public enum EnumPattern implements IPattern {
|
||||
|
||||
private ILayout leftRotation;
|
||||
private ILayout horizontalFlip;
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumPattern[] VALUES = values();
|
||||
|
||||
EnumPattern() {
|
||||
|
||||
@@ -20,7 +20,7 @@ public class GlassType implements IDesignMaterial {
|
||||
for (StandardColor c : StandardColor.values()) {
|
||||
GlassType.types.put(c.ordinal(), new GlassType(c.ordinal(), c.name, c.color));
|
||||
}
|
||||
for (EnumFlowerColor c2 : EnumFlowerColor.VALUES) {
|
||||
for (EnumFlowerColor c2 : EnumFlowerColor.values()) {
|
||||
GlassType.types
|
||||
.put(128 + c2.ordinal(), new GlassType(128 + c2.ordinal(), c2.getName(), c2.getColor(false)));
|
||||
}
|
||||
|
||||
@@ -46,10 +46,10 @@ public class ModuleCore implements IInitializable {
|
||||
Collections.addAll(speciesQueue, ExtraTreeSpecies.values());
|
||||
|
||||
Queue<ILogType> logQueue = new LinkedList<>();
|
||||
Collections.addAll(logQueue, ILogType.ExtraTreeLog.VALUES);
|
||||
Collections.addAll(logQueue, ILogType.ExtraTreeLog.values());
|
||||
|
||||
Queue<IDesignMaterial> plankQueue = new LinkedList<>();
|
||||
Collections.addAll(plankQueue, PlankType.ExtraTreePlanks.VALUES);
|
||||
Collections.addAll(plankQueue, PlankType.ExtraTreePlanks.values());
|
||||
|
||||
Queue<ExtraTreeFruitGene> fruitQueue = new LinkedList<>();
|
||||
Collections.addAll(fruitQueue, ExtraTreeFruitGene.values());
|
||||
|
||||