Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3470c6c7d1 | ||
|
|
b1377d5642 | ||
|
|
b50910496e | ||
|
|
cc4b16e2a5 | ||
|
|
3b63133790 | ||
|
|
6d8d7110e1 | ||
|
|
98fa57844e | ||
|
|
adbb300523 | ||
|
|
839882b783 | ||
|
|
2635d036aa | ||
|
|
cf8f2f54c5 | ||
|
|
4844bc937b | ||
|
|
88f50d91e1 | ||
|
|
3bc6720dec | ||
|
|
1083f52a30 | ||
|
|
3fb58ad6a5 |
No files matched your search
@@ -0,0 +1,17 @@
|
||||
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
|
||||
@@ -1,11 +1,12 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.9.54:dev")
|
||||
api('curse.maven:cofh-lib-220333:2388748')
|
||||
compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-beta68a:api')
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.70-GTNH:dev')
|
||||
compileOnlyApi('com.github.GTNewHorizons:Angelica:2.1.19:api')
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.93-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:inventory-tweaks:1.7.1:api')
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.55:api')
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.57:api')
|
||||
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
|
||||
compileOnly('curse.maven:craftguide-75557:2459320')
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/93aeea858331bd6bb00ba94759830234/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/93aeea858331bd6bb00ba94759830234/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/3426ffcaa54c3f62406beb1f1ab8b179/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/f636c800fdb3f9ae33f019dfa048ba72/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/93aeea858331bd6bb00ba94759830234/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/3cd7045fca9a72cd9bc7d14a385e594c/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/0ef34dd9312b12d61ba1b8e66126d140/redirect
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c2dd35c9d0aaf0ba6ad0791320f99dfc/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/e5810bd7fd1f8a586644409d395a7e55/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/7b3c4877c0749019e6805bb61e421497/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/8e1d9ee5d0f13e442218f6884a306da1/redirect
|
||||
toolchainVersion=25
|
||||
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-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/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/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,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.20'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.24'
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,8 @@ import forestry.plugins.PluginManager;
|
||||
name = Constants.MOD,
|
||||
version = Constants.VERSION,
|
||||
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
|
||||
dependencies = "required-after:Forge@[10.13.4.1566,);" + "after:Buildcraft|Core@[6.1.7,);"
|
||||
dependencies = "required-after:Forge@[10.13.4.1566,);" + "required-after:gtnhlib@[0.9.41,);"
|
||||
+ "after:Buildcraft|Core@[6.1.7,);"
|
||||
+ "after:ExtrabiomesXL;"
|
||||
+ "after:BiomesOPlenty;"
|
||||
+ "after:IC2@[2.0.140,);"
|
||||
|
||||
@@ -84,7 +84,12 @@ public enum EnumBeeChromosome implements IChromosomeType {
|
||||
*/
|
||||
EFFECT(IAlleleBeeEffect.class);
|
||||
|
||||
Class<? extends IAllele> clss;
|
||||
final Class<? extends IAllele> clss;
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumBeeChromosome[] VALUES = values();
|
||||
|
||||
EnumBeeChromosome(Class<? extends IAllele> clss) {
|
||||
this.clss = clss;
|
||||
|
||||
@@ -17,9 +17,12 @@ public enum EnumBeeType implements ISpeciesType {
|
||||
LARVAE,
|
||||
NONE;
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumBeeType[] VALUES = values();
|
||||
|
||||
String name;
|
||||
private final String name;
|
||||
|
||||
EnumBeeType() {
|
||||
this.name = this.toString().toLowerCase(Locale.ENGLISH);
|
||||
@@ -28,4 +31,8 @@ public enum EnumBeeType implements ISpeciesType {
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public static EnumBeeType fromOrdinal(int ordinal) {
|
||||
return VALUES[ordinal];
|
||||
}
|
||||
}
|
||||
@@ -73,9 +73,14 @@ public enum EnumTreeChromosome implements IChromosomeType {
|
||||
/**
|
||||
* Determines if the tree can burn.
|
||||
*/
|
||||
FIREPROOF(IAlleleBoolean.class),;
|
||||
FIREPROOF(IAlleleBoolean.class);
|
||||
|
||||
Class<? extends IAllele> clss;
|
||||
final Class<? extends IAllele> clss;
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumTreeChromosome[] VALUES = values();
|
||||
|
||||
EnumTreeChromosome(Class<? extends IAllele> clss) {
|
||||
this.clss = clss;
|
||||
|
||||
@@ -17,9 +17,14 @@ public enum EnumHumidity {
|
||||
NORMAL("Normal"),
|
||||
DAMP("Damp");
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumHumidity[] VALUES = values();
|
||||
|
||||
public final String name;
|
||||
|
||||
private EnumHumidity(String name) {
|
||||
EnumHumidity(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,10 +27,15 @@ public enum EnumTemperature {
|
||||
HOT("Hot", "habitats/desert"),
|
||||
HELLISH("Hellish", "habitats/nether");
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumTemperature[] VALUES = values();
|
||||
|
||||
public final String name;
|
||||
public final String iconIndex;
|
||||
|
||||
private EnumTemperature(String name, String iconIndex) {
|
||||
EnumTemperature(String name, String iconIndex) {
|
||||
this.name = name;
|
||||
this.iconIndex = iconIndex;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,11 @@ public enum FarmDirection {
|
||||
|
||||
private final ForgeDirection forgeDirection;
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final FarmDirection[] VALUES = values();
|
||||
|
||||
FarmDirection(ForgeDirection forgeDirection) {
|
||||
this.forgeDirection = forgeDirection;
|
||||
}
|
||||
@@ -25,17 +30,16 @@ public enum FarmDirection {
|
||||
}
|
||||
|
||||
public static FarmDirection getFarmDirection(ForgeDirection forgeDirection) {
|
||||
switch (forgeDirection) {
|
||||
case NORTH:
|
||||
return NORTH;
|
||||
case EAST:
|
||||
return EAST;
|
||||
case SOUTH:
|
||||
return SOUTH;
|
||||
case WEST:
|
||||
return WEST;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
return switch (forgeDirection) {
|
||||
case NORTH -> NORTH;
|
||||
case EAST -> EAST;
|
||||
case SOUTH -> SOUTH;
|
||||
case WEST -> WEST;
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
public static FarmDirection fromOrdinal(int ordinal) {
|
||||
return VALUES[ordinal];
|
||||
}
|
||||
}
|
||||
@@ -77,7 +77,12 @@ public enum EnumButterflyChromosome implements IChromosomeType {
|
||||
*/
|
||||
TERRITORY(IAlleleArea.class),;
|
||||
|
||||
Class<? extends IAllele> clss;
|
||||
final Class<? extends IAllele> clss;
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumButterflyChromosome[] VALUES = values();
|
||||
|
||||
EnumButterflyChromosome(Class<? extends IAllele> clss) {
|
||||
this.clss = clss;
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package forestry.api.multiblock;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IFarmFertilizerRegistry {
|
||||
|
||||
/**
|
||||
* Gets a list of all fertilizer stacks in the registry.
|
||||
*
|
||||
* @return The current fertilizer registry.
|
||||
*/
|
||||
Collection<ItemStack> getFertilizers();
|
||||
|
||||
/**
|
||||
* Adds a new fertilizer to the registry.
|
||||
*
|
||||
* @apiNote The stack size doesn't matter it always consumes 1.
|
||||
* @apiNote You can use OreDictionary.WILDCARD_VALUE to specific that any meta of the item will be ok.
|
||||
*
|
||||
* @param itemstack The item to add to the registry.
|
||||
*/
|
||||
void addFertilizer(ItemStack itemstack);
|
||||
|
||||
/**
|
||||
* Removes a fertilizer from the fretilizer registry.
|
||||
*
|
||||
* @param itemstack The item to remove from the registry.
|
||||
*/
|
||||
void removeFertilizer(ItemStack itemstack);
|
||||
|
||||
/**
|
||||
* Checks if an item is a usable multi-farm fertilizer.
|
||||
*
|
||||
* @param itemstack - The stack to check with.
|
||||
* @return True if the item is a fertilizer item.
|
||||
*/
|
||||
boolean isFertilizer(ItemStack itemstack);
|
||||
}
|
||||
@@ -8,4 +8,6 @@ package forestry.api.multiblock;
|
||||
public class MultiblockManager {
|
||||
|
||||
public static IMultiblockLogicFactory logicFactory;
|
||||
|
||||
public static IFarmFertilizerRegistry farmFertilizerRegistry;
|
||||
}
|
||||
@@ -38,7 +38,7 @@ public class CommandBeeGive extends SubCommand {
|
||||
setPermLevel(PermLevel.ADMIN);
|
||||
|
||||
List<String> beeTypeStrings = new ArrayList<>();
|
||||
for (EnumBeeType type : EnumBeeType.values()) {
|
||||
for (EnumBeeType type : EnumBeeType.VALUES) {
|
||||
if (type == EnumBeeType.NONE) {
|
||||
continue;
|
||||
}
|
||||
@@ -166,7 +166,7 @@ public class CommandBeeGive extends SubCommand {
|
||||
}
|
||||
|
||||
private static EnumBeeType getBeeType(String beeTypeName) {
|
||||
for (EnumBeeType beeType : EnumBeeType.values()) {
|
||||
for (EnumBeeType beeType : EnumBeeType.VALUES) {
|
||||
if (beeType.getName().equalsIgnoreCase(beeTypeName)) {
|
||||
return beeType;
|
||||
}
|
||||
|
||||
@@ -573,7 +573,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
// / Secondary Products
|
||||
for (Map.Entry<ItemStack, Float> entry : secondary.getProductChances().entrySet()) {
|
||||
if (housing.getWorld().rand.nextFloat() < getFinalChance(entry.getValue() / 2, speed, prodModifier, 1f)) {
|
||||
if (housing.getWorld().rand.nextFloat() < getFinalChance(entry.getValue() / 2f, speed, prodModifier, 1f)) {
|
||||
products.add(entry.getKey().copy());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ public enum BeeBranchDefinition implements IBranchDefinition {
|
||||
|
||||
private static IAllele[] getDefaultTemplate() {
|
||||
if (defaultTemplate == null) {
|
||||
defaultTemplate = new IAllele[EnumBeeChromosome.values().length];
|
||||
defaultTemplate = new IAllele[EnumBeeChromosome.VALUES.length];
|
||||
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWEST);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTER);
|
||||
|
||||
@@ -102,7 +102,7 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
IBee bee = (IBee) individual;
|
||||
|
||||
Item beeItem;
|
||||
switch (EnumBeeType.VALUES[type]) {
|
||||
switch (EnumBeeType.fromOrdinal(type)) {
|
||||
case QUEEN:
|
||||
beeItem = PluginApiculture.items.beeQueenGE;
|
||||
// ensure a queen is always mated
|
||||
@@ -353,7 +353,7 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
|
||||
@Override
|
||||
public IChromosomeType[] getKaryotype() {
|
||||
return EnumBeeChromosome.values();
|
||||
return EnumBeeChromosome.VALUES;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
@@ -22,24 +20,23 @@ import forestry.core.render.TextureManager;
|
||||
public class DefaultBeeIconProvider implements IBeeIconProvider {
|
||||
|
||||
public static final DefaultBeeIconProvider instance = new DefaultBeeIconProvider();
|
||||
private static final IIcon[][] icons = new IIcon[EnumBeeType.VALUES.length][3];
|
||||
|
||||
private DefaultBeeIconProvider() {}
|
||||
|
||||
private static final IIcon[][] icons = new IIcon[EnumBeeType.values().length][3];
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
String beeIconDir = "bees/default/";
|
||||
IIcon body1 = TextureManager.registerTex(register, beeIconDir + "body1");
|
||||
|
||||
for (int i = 0; i < EnumBeeType.values().length; i++) {
|
||||
EnumBeeType beeType = EnumBeeType.values()[i];
|
||||
for (int i = 0; i < EnumBeeType.VALUES.length; i++) {
|
||||
EnumBeeType beeType = EnumBeeType.VALUES[i];
|
||||
if (beeType == EnumBeeType.NONE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String beeTypeNameBase = beeIconDir + beeType.toString().toLowerCase(Locale.ENGLISH);
|
||||
String beeTypeNameBase = beeIconDir + beeType.getName();
|
||||
|
||||
icons[i][0] = TextureManager.registerTex(register, beeTypeNameBase + ".outline");
|
||||
if (beeType == EnumBeeType.LARVAE) {
|
||||
|
||||
@@ -250,8 +250,9 @@ public class AlvearyController extends RectangularMultiblockControllerBase
|
||||
|
||||
private float applyChange(float base, float currentChange, float extraChange, float boundaryDown,
|
||||
float boundaryUp) {
|
||||
float boundedNewChange = Math.max(boundaryDown, Math.min(base + currentChange + (extraChange * 20), boundaryUp))
|
||||
- base;
|
||||
float boundedNewChange = Math.round(
|
||||
(Math.max(boundaryDown, Math.min(base + currentChange + (extraChange * 20), boundaryUp)) - base) * 100)
|
||||
/ 100.0f;
|
||||
if (extraChange > 0) {
|
||||
return Math.max(currentChange, boundedNewChange);
|
||||
} else {
|
||||
@@ -355,12 +356,13 @@ public class AlvearyController extends RectangularMultiblockControllerBase
|
||||
@Override
|
||||
public float getExactTemperature() {
|
||||
ChunkCoordinates coords = getReferenceCoord();
|
||||
return getBiome().getFloatTemperature(coords.posX, coords.posY, coords.posZ) + tempChange;
|
||||
return Math.round((getBiome().getFloatTemperature(coords.posX, coords.posY, coords.posZ) + tempChange) * 100)
|
||||
/ 100.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getExactHumidity() {
|
||||
return getBiome().rainfall + humidChange;
|
||||
return Math.round((getBiome().rainfall + humidChange) * 100) / 100.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,145 +0,0 @@
|
||||
package forestry.arboriculture;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/** Based on vanilla leaf decay, but accepts leaves that are connected further from a trunk */
|
||||
public abstract class LeafDecayHelper {
|
||||
|
||||
private static final short SUSTAINS_LEAVES = 0;
|
||||
private static final short NOT_SUSTAINS_LEAVES = -1;
|
||||
private static final short IS_LEAVES = -2;
|
||||
private static int[] leafDecayValues;
|
||||
|
||||
public static void leafDecay(BlockLeaves leaves, World world, int x, int y, int z) {
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
int leafMeta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if ((leafMeta & 8) != 0 && (leafMeta & 4) == 0) {
|
||||
byte radius = 4;
|
||||
byte yArrayMult = 32;
|
||||
int xArrayMult = yArrayMult * yArrayMult;
|
||||
int arrayOffset = yArrayMult / 2;
|
||||
|
||||
if (leafDecayValues == null) {
|
||||
leafDecayValues = new int[yArrayMult * yArrayMult * yArrayMult];
|
||||
}
|
||||
|
||||
int radius1 = radius + 1;
|
||||
if (world.checkChunksExist(x - radius1, y - radius1, z - radius1, x + radius1, y + radius1, z + radius1)) {
|
||||
for (int xOffset = -radius; xOffset <= radius; ++xOffset) {
|
||||
for (int yOffset = -radius; yOffset <= radius; ++yOffset) {
|
||||
for (int zOffset = -radius; zOffset <= radius; ++zOffset) {
|
||||
Block block = world.getBlock(x + xOffset, y + yOffset, z + zOffset);
|
||||
|
||||
if (!block.canSustainLeaves(world, x + xOffset, y + yOffset, z + zOffset)) {
|
||||
if (block.isLeaves(world, x + xOffset, y + yOffset, z + zOffset)) {
|
||||
leafDecayValues[(xOffset + arrayOffset) * xArrayMult
|
||||
+ (yOffset + arrayOffset) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset] = IS_LEAVES;
|
||||
} else {
|
||||
leafDecayValues[(xOffset + arrayOffset) * xArrayMult
|
||||
+ (yOffset + arrayOffset) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset] = NOT_SUSTAINS_LEAVES;
|
||||
}
|
||||
} else {
|
||||
leafDecayValues[(xOffset + arrayOffset) * xArrayMult
|
||||
+ (yOffset + arrayOffset) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset] = SUSTAINS_LEAVES;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int sustainedValue = 1; sustainedValue <= 8; ++sustainedValue) {
|
||||
for (int xOffset = -radius; xOffset <= radius; ++xOffset) {
|
||||
for (int yOffset = -radius; yOffset <= radius; ++yOffset) {
|
||||
for (int zOffset = -radius; zOffset <= radius; ++zOffset) {
|
||||
if (leafDecayValues[(xOffset + arrayOffset) * xArrayMult
|
||||
+ (yOffset + arrayOffset) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset] == sustainedValue - 1) {
|
||||
if (leafDecayValues[(xOffset + arrayOffset - 1) * xArrayMult
|
||||
+ (yOffset + arrayOffset) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset] == IS_LEAVES) {
|
||||
leafDecayValues[(xOffset + arrayOffset - 1) * xArrayMult
|
||||
+ (yOffset + arrayOffset) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset] = sustainedValue;
|
||||
}
|
||||
|
||||
if (leafDecayValues[(xOffset + arrayOffset + 1) * xArrayMult
|
||||
+ (yOffset + arrayOffset) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset] == IS_LEAVES) {
|
||||
leafDecayValues[(xOffset + arrayOffset + 1) * xArrayMult
|
||||
+ (yOffset + arrayOffset) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset] = sustainedValue;
|
||||
}
|
||||
|
||||
if (leafDecayValues[(xOffset + arrayOffset) * xArrayMult
|
||||
+ (yOffset + arrayOffset - 1) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset] == IS_LEAVES) {
|
||||
leafDecayValues[(xOffset + arrayOffset) * xArrayMult
|
||||
+ (yOffset + arrayOffset - 1) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset] = sustainedValue;
|
||||
}
|
||||
|
||||
if (leafDecayValues[(xOffset + arrayOffset) * xArrayMult
|
||||
+ (yOffset + arrayOffset + 1) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset] == IS_LEAVES) {
|
||||
leafDecayValues[(xOffset + arrayOffset) * xArrayMult
|
||||
+ (yOffset + arrayOffset + 1) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset] = sustainedValue;
|
||||
}
|
||||
|
||||
if (leafDecayValues[(xOffset + arrayOffset) * xArrayMult
|
||||
+ (yOffset + arrayOffset) * yArrayMult
|
||||
+ (zOffset + arrayOffset - 1)] == IS_LEAVES) {
|
||||
leafDecayValues[(xOffset + arrayOffset) * xArrayMult
|
||||
+ (yOffset + arrayOffset) * yArrayMult
|
||||
+ (zOffset + arrayOffset - 1)] = sustainedValue;
|
||||
}
|
||||
|
||||
if (leafDecayValues[(xOffset + arrayOffset) * xArrayMult
|
||||
+ (yOffset + arrayOffset) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset
|
||||
+ 1] == IS_LEAVES) {
|
||||
leafDecayValues[(xOffset + arrayOffset) * xArrayMult
|
||||
+ (yOffset + arrayOffset) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset
|
||||
+ 1] = sustainedValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int sustainValue = leafDecayValues[(arrayOffset * xArrayMult) + (arrayOffset * yArrayMult) + arrayOffset];
|
||||
|
||||
if (sustainValue >= 0) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, leafMeta & -9, 4); // stop trying to decay
|
||||
} else {
|
||||
leaves.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,7 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.blocks.util.BFSLeafDecay;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -48,7 +49,6 @@ import forestry.api.core.Tabs;
|
||||
import forestry.api.lepidopterology.ButterflyManager;
|
||||
import forestry.api.lepidopterology.EnumFlutterType;
|
||||
import forestry.api.lepidopterology.IButterfly;
|
||||
import forestry.arboriculture.LeafDecayHelper;
|
||||
import forestry.arboriculture.genetics.TreeDefinition;
|
||||
import forestry.arboriculture.items.ItemBlockLeaves;
|
||||
import forestry.arboriculture.render.TextureLeaves;
|
||||
@@ -230,7 +230,12 @@ public class BlockForestryLeaves extends BlockNewLeaf implements ITileEntityProv
|
||||
return;
|
||||
}
|
||||
|
||||
LeafDecayHelper.leafDecay(this, world, x, y, z);
|
||||
if (!world.isRemote) {
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
if ((meta & 8) != 0 && (meta & 4) == 0) {
|
||||
BFSLeafDecay.handleDecayChecked(this, world, x, y, z, meta, 4);
|
||||
}
|
||||
}
|
||||
|
||||
// check leaves tile again because they can decay in super.updateTick
|
||||
if (tileLeaves.isInvalid()) {
|
||||
|
||||
@@ -36,29 +36,29 @@ public class BlockFruitPod extends BlockCocoa {
|
||||
}
|
||||
|
||||
public static TileFruitPod getPodTile(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (!(tile instanceof TileFruitPod)) {
|
||||
return null;
|
||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileFruitPod) {
|
||||
return (TileFruitPod) tile;
|
||||
}
|
||||
|
||||
return (TileFruitPod) tile;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
|
||||
if (!world.checkChunksExist(x - 1, y, z - 1, x + 1, y, z + 1)) {
|
||||
return;
|
||||
}
|
||||
if (!canBlockStay(world, x, y, z)) {
|
||||
dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
this.dropBlockAsItem(world, x, y, z, meta, 0);
|
||||
world.setBlockToAir(x, y, z);
|
||||
return;
|
||||
}
|
||||
|
||||
TileFruitPod tile = getPodTile(world, x, y, z);
|
||||
if (tile == null) {
|
||||
return;
|
||||
final TileFruitPod tile = getPodTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
tile.onBlockTick();
|
||||
}
|
||||
|
||||
tile.onBlockTick();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
||||
@@ -82,7 +82,7 @@ public enum TreeBranchDefinition implements IBranchDefinition {
|
||||
@Override
|
||||
public IAllele[] getTemplate() {
|
||||
if (defaultTemplate == null) {
|
||||
defaultTemplate = new IAllele[EnumTreeChromosome.values().length];
|
||||
defaultTemplate = new IAllele[EnumTreeChromosome.VALUES.length];
|
||||
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumTreeChromosome.FRUITS, AlleleFruit.fruitNone);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumTreeChromosome.GROWTH, AlleleGrowth.growthLightLevel);
|
||||
|
||||
@@ -389,7 +389,7 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot {
|
||||
|
||||
@Override
|
||||
public IChromosomeType[] getKaryotype() {
|
||||
return EnumTreeChromosome.values();
|
||||
return EnumTreeChromosome.VALUES;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,6 +26,7 @@ public class ItemRegistryArboriculture extends ItemRegistry {
|
||||
OreDictionary.registerOre("treeSapling", sapling.getWildcard());
|
||||
|
||||
pollenFertile = registerItem(new ItemGermlingGE(EnumGermlingType.POLLEN), "pollenFertile");
|
||||
OreDictionary.registerOre("itemPollenFertile", pollenFertile.getWildcard());
|
||||
treealyzer = registerItem(new ItemTreealyzer(), "treealyzer");
|
||||
grafter = registerItem(new ItemGrafter(4), "grafter");
|
||||
grafterProven = registerItem(new ItemGrafter(149), "grafterProven");
|
||||
|
||||
@@ -95,8 +95,7 @@ public class TileWood extends TileEntity implements IStreamable {
|
||||
EnumWoodType woodType = wood.getWoodType();
|
||||
|
||||
int amount = 1;
|
||||
if (block instanceof BlockSlab) {
|
||||
BlockSlab blockSlab = (BlockSlab) block;
|
||||
if (block instanceof BlockSlab blockSlab) {
|
||||
if (blockSlab.isDoubleSlab()) {
|
||||
amount = 2;
|
||||
block = PluginArboriculture.blocks.slabs;
|
||||
@@ -104,6 +103,7 @@ public class TileWood extends TileEntity implements IStreamable {
|
||||
}
|
||||
|
||||
ItemStack itemStack = new ItemStack(block, amount);
|
||||
if (itemStack.getItem() == null) return null;
|
||||
ItemBlockWood.saveToItemStack(woodType, itemStack);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@@ -113,11 +113,7 @@ public final class AccessHandler implements IAccessHandler {
|
||||
if (!isOwner(player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int ordinal = (access.ordinal() + 1) % EnumAccess.values().length;
|
||||
EnumAccess newAccess = EnumAccess.values()[ordinal];
|
||||
setAccess(player.worldObj, newAccess);
|
||||
|
||||
setAccess(player.worldObj, access.next());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -156,7 +152,7 @@ public final class AccessHandler implements IAccessHandler {
|
||||
public void readData(DataInputStreamForestry data) throws IOException {
|
||||
byte accessOrdinal = data.readByte();
|
||||
if (accessOrdinal >= 0) {
|
||||
access = EnumAccess.values()[accessOrdinal];
|
||||
access = EnumAccess.fromOrdinal(accessOrdinal);
|
||||
GameProfile owner = new GameProfile(new UUID(data.readLong(), data.readLong()), data.readUTF());
|
||||
setOwner(owner);
|
||||
}
|
||||
@@ -164,8 +160,7 @@ public final class AccessHandler implements IAccessHandler {
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound data) {
|
||||
access = EnumAccess.values()[data.getInteger("Access")];
|
||||
|
||||
access = EnumAccess.fromOrdinal(data.getInteger("Access"));
|
||||
if (data.hasKey("owner")) {
|
||||
owner = NBTUtil.func_152459_a(data.getCompoundTag("owner"));
|
||||
}
|
||||
|
||||
@@ -8,22 +8,15 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.access;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public enum EnumAccess {
|
||||
|
||||
SHARED("gui.rule.shared"),
|
||||
VIEWABLE("gui.rule.restricted"),
|
||||
PRIVATE("gui.rule.private");
|
||||
|
||||
private static final EnumAccess[] VALUES = values();
|
||||
private final String name;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon icon;
|
||||
|
||||
EnumAccess(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
@@ -31,4 +24,13 @@ public enum EnumAccess {
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public EnumAccess next() {
|
||||
int ordinal = (this.ordinal() + 1) % VALUES.length;
|
||||
return VALUES[ordinal];
|
||||
}
|
||||
|
||||
public static EnumAccess fromOrdinal(int ordinal) {
|
||||
return VALUES[ordinal];
|
||||
}
|
||||
}
|
||||
@@ -84,31 +84,26 @@ public class BlockSoil extends Block implements IItemTyped {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int i, int j, int k, Random random) {
|
||||
public void updateTick(World world, int x, int y, int z, Random random) {
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
int meta = world.getBlockMetadata(i, j, k);
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
SoilType type = getTypeFromMeta(meta);
|
||||
|
||||
if (type == SoilType.HUMUS) {
|
||||
updateTickHumus(world, i, j, k);
|
||||
if (world.checkChunksExist(x - 1, y + 1, z - 1, x + 1, y + 1, z + 1)) {
|
||||
if (isEnrooted(world, x, y, z)) {
|
||||
degradeSoil(world, x, y, z);
|
||||
}
|
||||
}
|
||||
} else if (type == SoilType.BOG_EARTH) {
|
||||
updateTickBogEarth(world, i, j, k);
|
||||
}
|
||||
}
|
||||
|
||||
private static void updateTickHumus(World world, int i, int j, int k) {
|
||||
if (isEnrooted(world, i, j, k)) {
|
||||
degradeSoil(world, i, j, k);
|
||||
}
|
||||
}
|
||||
|
||||
private static void updateTickBogEarth(World world, int i, int j, int k) {
|
||||
if (isMoistened(world, i, j, k)) {
|
||||
matureBog(world, i, j, k);
|
||||
if (world.checkChunksExist(x - 2, y, z - 2, x + 2, y, z + 2)) {
|
||||
if (isMoistened(world, x, y, z)) {
|
||||
matureBog(world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +117,6 @@ public class BlockSoil extends Block implements IItemTyped {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -156,7 +150,6 @@ public class BlockSoil extends Block implements IItemTyped {
|
||||
}
|
||||
|
||||
private static boolean isMoistened(World world, int x, int y, int z) {
|
||||
|
||||
for (int i = -2; i < 3; i++) {
|
||||
for (int j = -2; j < 3; j++) {
|
||||
Block block = world.getBlock(x + i, y, z + j);
|
||||
@@ -165,7 +158,6 @@ public class BlockSoil extends Block implements IItemTyped {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ public class CircuitBoard<T> implements ICircuitBoard {
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
|
||||
type = EnumCircuitBoardType.values()[nbttagcompound.getShort("T")];
|
||||
type = EnumCircuitBoardType.VALUES[nbttagcompound.getShort("T")];
|
||||
|
||||
// Layout
|
||||
if (nbttagcompound.hasKey("LY")) {
|
||||
|
||||
@@ -15,6 +15,11 @@ public enum EnumCircuitBoardType {
|
||||
REFINED((short) 3, 0x191919, 0xc9c9c9),
|
||||
INTRICATE((short) 4, 0x191919, 0xe2cb6b);
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumCircuitBoardType[] VALUES = values();
|
||||
|
||||
private final short sockets;
|
||||
private final int primaryColor;
|
||||
private final int secondaryColor;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class GuiSolderingIron extends GuiForestry<ContainerSolderingIron, ItemIn
|
||||
try {
|
||||
ICircuitSocketType socketType = layout.getSocketType();
|
||||
if (CircuitSocketType.FARM.equals(socketType)) {
|
||||
FarmDirection farmDirection = FarmDirection.values()[i];
|
||||
FarmDirection farmDirection = FarmDirection.fromOrdinal(i);
|
||||
String farmDirectionString = farmDirection.toString().toLowerCase(Locale.ENGLISH);
|
||||
String localizedDirection = StringUtil.localize("gui.solder." + farmDirectionString);
|
||||
fontRendererObj.drawString(
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ItemCircuitBoard extends ItemForestryMultiPass {
|
||||
|
||||
@Override
|
||||
public int getColorFromItemStack(ItemStack itemstack, int pass) {
|
||||
EnumCircuitBoardType type = EnumCircuitBoardType.values()[itemstack.getItemDamage()];
|
||||
EnumCircuitBoardType type = EnumCircuitBoardType.VALUES[itemstack.getItemDamage()];
|
||||
if (pass == 0) {
|
||||
return type.getPrimaryColor();
|
||||
} else {
|
||||
@@ -60,7 +60,7 @@ public class ItemCircuitBoard extends ItemForestryMultiPass {
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
EnumCircuitBoardType type = EnumCircuitBoardType.values()[stack.getItemDamage()];
|
||||
EnumCircuitBoardType type = EnumCircuitBoardType.VALUES[stack.getItemDamage()];
|
||||
return "item.for.circuitboard." + type.toString().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ public class BlockForestryFluid extends BlockFluidClassic {
|
||||
super.updateTick(world, x, y, z, rand);
|
||||
|
||||
// Start fires if the fluid is lava-like
|
||||
if (getMaterial() == Material.lava) {
|
||||
if (getMaterial() == Material.lava && world.checkChunksExist(x - 4, y, z - 4, x + 4, y, z + 4)) {
|
||||
int rangeUp = rand.nextInt(3);
|
||||
|
||||
for (int i = 0; i < rangeUp; ++i) {
|
||||
|
||||
@@ -121,11 +121,11 @@ public class ItemInventorySolderingIron extends ItemInventory implements IErrorS
|
||||
}
|
||||
|
||||
// Illegal type
|
||||
if (blank.getItemDamage() < 0 || blank.getItemDamage() >= EnumCircuitBoardType.values().length) {
|
||||
if (blank.getItemDamage() < 0 || blank.getItemDamage() >= EnumCircuitBoardType.VALUES.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
EnumCircuitBoardType type = EnumCircuitBoardType.values()[blank.getItemDamage()];
|
||||
EnumCircuitBoardType type = EnumCircuitBoardType.VALUES[blank.getItemDamage()];
|
||||
if (getCircuitCount() != type.getSockets()) {
|
||||
return;
|
||||
}
|
||||
@@ -172,7 +172,7 @@ public class ItemInventorySolderingIron extends ItemInventory implements IErrorS
|
||||
if (blankCircuitBoard == null) {
|
||||
errorStates.add(EnumErrorCode.NO_CIRCUIT_BOARD);
|
||||
} else {
|
||||
EnumCircuitBoardType type = EnumCircuitBoardType.values()[blankCircuitBoard.getItemDamage()];
|
||||
EnumCircuitBoardType type = EnumCircuitBoardType.VALUES[blankCircuitBoard.getItemDamage()];
|
||||
|
||||
int circuitCount = 0;
|
||||
for (short i = 0; i < type.getSockets(); i++) {
|
||||
|
||||
@@ -34,6 +34,9 @@ public class ItemFruit extends ItemForestryFood {
|
||||
DATES("cropDate"),
|
||||
PAPAYA("cropPapaya"); // , COCONUT("cropCoconut");
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumFruit[] VALUES = values();
|
||||
|
||||
private final String oreDict;
|
||||
@@ -94,13 +97,13 @@ public class ItemFruit extends ItemForestryFood {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
return EnumFruit.values()[meta].getIcon();
|
||||
return EnumFruit.VALUES[meta].getIcon();
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
for (int i = 0; i < EnumFruit.values().length; i++) {
|
||||
for (int i = 0; i < EnumFruit.VALUES.length; i++) {
|
||||
itemList.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ public class ItemRegistryCore extends ItemRegistry {
|
||||
|
||||
// FRUITS
|
||||
fruits = registerItem(new ItemFruit(), "fruits");
|
||||
for (ItemFruit.EnumFruit def : ItemFruit.EnumFruit.values()) {
|
||||
for (ItemFruit.EnumFruit def : ItemFruit.EnumFruit.VALUES) {
|
||||
ItemStack fruit = new ItemStack(fruits, 1, def.ordinal());
|
||||
OreDictionary.registerOre(def.getOreDict(), fruit);
|
||||
}
|
||||
|
||||
@@ -60,8 +60,6 @@ public class RenderAnalyzer extends TileEntitySpecialRenderer implements IBlockR
|
||||
|
||||
private void render(ItemStack itemstack, World world, ForgeDirection orientation, double x, double y, double z) {
|
||||
|
||||
dummyEntityItem.worldObj = world;
|
||||
|
||||
model.render(orientation, (float) x, (float) y, (float) z);
|
||||
if (itemstack == null) {
|
||||
return;
|
||||
@@ -72,13 +70,18 @@ public class RenderAnalyzer extends TileEntitySpecialRenderer implements IBlockR
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
GL11.glTranslatef(0.5f, 0.2f, 0.5f);
|
||||
GL11.glScalef(renderScale, renderScale, renderScale);
|
||||
dummyEntityItem.setEntityItemStack(itemstack);
|
||||
|
||||
if (world.getTotalWorldTime() != lastTick) {
|
||||
lastTick = world.getTotalWorldTime();
|
||||
dummyEntityItem.onUpdate();
|
||||
try {
|
||||
dummyEntityItem.worldObj = world;
|
||||
dummyEntityItem.setEntityItemStack(itemstack);
|
||||
if (world.getTotalWorldTime() != lastTick) {
|
||||
lastTick = world.getTotalWorldTime();
|
||||
dummyEntityItem.onUpdate();
|
||||
}
|
||||
customRenderItem.doRender(dummyEntityItem, 0, 0, 0, 0, 0);
|
||||
} finally {
|
||||
dummyEntityItem.worldObj = null;
|
||||
}
|
||||
customRenderItem.doRender(dummyEntityItem, 0, 0, 0, 0, 0);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -22,8 +22,6 @@ import forestry.core.tiles.TileMill;
|
||||
|
||||
public class RenderMill extends TileEntitySpecialRenderer implements IBlockRenderer {
|
||||
|
||||
private final ModelBase model = new ModelBase() {};
|
||||
|
||||
private enum Textures {
|
||||
PEDESTAL,
|
||||
EXTENSION,
|
||||
@@ -41,6 +39,7 @@ public class RenderMill extends TileEntitySpecialRenderer implements IBlockRende
|
||||
private final ModelRenderer blade2;
|
||||
|
||||
public RenderMill() {
|
||||
ModelBase model = new ModelBase() {};
|
||||
pedestal = new ModelRenderer(model, 0, 0);
|
||||
pedestal.addBox(-8F, -8F, -8F, 16, 1, 16);
|
||||
pedestal.rotationPointX = 8;
|
||||
|
||||
@@ -45,18 +45,18 @@ public class ClimateUtil implements IClimateHelper {
|
||||
case BOTH_4:
|
||||
case BOTH_3:
|
||||
case BOTH_2:
|
||||
if (prefered.ordinal() + 2 < EnumHumidity.values().length) {
|
||||
tolerated.add(EnumHumidity.values()[prefered.ordinal() + 2]);
|
||||
if (prefered.ordinal() + 2 < EnumHumidity.VALUES.length) {
|
||||
tolerated.add(EnumHumidity.VALUES[prefered.ordinal() + 2]);
|
||||
}
|
||||
if (prefered.ordinal() - 2 >= 0) {
|
||||
tolerated.add(EnumHumidity.values()[prefered.ordinal() - 2]);
|
||||
tolerated.add(EnumHumidity.VALUES[prefered.ordinal() - 2]);
|
||||
}
|
||||
case BOTH_1:
|
||||
if (prefered.ordinal() + 1 < EnumHumidity.values().length) {
|
||||
tolerated.add(EnumHumidity.values()[prefered.ordinal() + 1]);
|
||||
if (prefered.ordinal() + 1 < EnumHumidity.VALUES.length) {
|
||||
tolerated.add(EnumHumidity.VALUES[prefered.ordinal() + 1]);
|
||||
}
|
||||
if (prefered.ordinal() - 1 >= 0) {
|
||||
tolerated.add(EnumHumidity.values()[prefered.ordinal() - 1]);
|
||||
tolerated.add(EnumHumidity.VALUES[prefered.ordinal() - 1]);
|
||||
}
|
||||
return tolerated;
|
||||
|
||||
@@ -64,12 +64,12 @@ public class ClimateUtil implements IClimateHelper {
|
||||
case UP_4:
|
||||
case UP_3:
|
||||
case UP_2:
|
||||
if (prefered.ordinal() + 2 < EnumHumidity.values().length) {
|
||||
tolerated.add(EnumHumidity.values()[prefered.ordinal() + 2]);
|
||||
if (prefered.ordinal() + 2 < EnumHumidity.VALUES.length) {
|
||||
tolerated.add(EnumHumidity.VALUES[prefered.ordinal() + 2]);
|
||||
}
|
||||
case UP_1:
|
||||
if (prefered.ordinal() + 1 < EnumHumidity.values().length) {
|
||||
tolerated.add(EnumHumidity.values()[prefered.ordinal() + 1]);
|
||||
if (prefered.ordinal() + 1 < EnumHumidity.VALUES.length) {
|
||||
tolerated.add(EnumHumidity.VALUES[prefered.ordinal() + 1]);
|
||||
}
|
||||
return tolerated;
|
||||
|
||||
@@ -78,11 +78,11 @@ public class ClimateUtil implements IClimateHelper {
|
||||
case DOWN_3:
|
||||
case DOWN_2:
|
||||
if (prefered.ordinal() - 2 >= 0) {
|
||||
tolerated.add(EnumHumidity.values()[prefered.ordinal() - 2]);
|
||||
tolerated.add(EnumHumidity.VALUES[prefered.ordinal() - 2]);
|
||||
}
|
||||
case DOWN_1:
|
||||
if (prefered.ordinal() - 1 >= 0) {
|
||||
tolerated.add(EnumHumidity.values()[prefered.ordinal() - 1]);
|
||||
tolerated.add(EnumHumidity.VALUES[prefered.ordinal() - 1]);
|
||||
}
|
||||
return tolerated;
|
||||
|
||||
@@ -96,85 +96,86 @@ public class ClimateUtil implements IClimateHelper {
|
||||
ArrayList<EnumTemperature> tolerated = new ArrayList<>();
|
||||
tolerated.add(prefered);
|
||||
|
||||
final EnumTemperature[] TEMP_VALUES = EnumTemperature.VALUES;
|
||||
switch (tolerance) {
|
||||
case BOTH_5:
|
||||
if (prefered.ordinal() + 5 < EnumTemperature.values().length) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() + 5]);
|
||||
if (prefered.ordinal() + 5 < TEMP_VALUES.length) {
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() + 5]);
|
||||
}
|
||||
if (prefered.ordinal() - 5 >= 0) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() - 5]);
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() - 5]);
|
||||
}
|
||||
case BOTH_4:
|
||||
if (prefered.ordinal() + 4 < EnumTemperature.values().length) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() + 4]);
|
||||
if (prefered.ordinal() + 4 < TEMP_VALUES.length) {
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() + 4]);
|
||||
}
|
||||
if (prefered.ordinal() - 4 >= 0) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() - 4]);
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() - 4]);
|
||||
}
|
||||
case BOTH_3:
|
||||
if (prefered.ordinal() + 3 < EnumTemperature.values().length) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() + 3]);
|
||||
if (prefered.ordinal() + 3 < TEMP_VALUES.length) {
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() + 3]);
|
||||
}
|
||||
if (prefered.ordinal() - 3 >= 0) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() - 3]);
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() - 3]);
|
||||
}
|
||||
case BOTH_2:
|
||||
if (prefered.ordinal() + 2 < EnumTemperature.values().length) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() + 2]);
|
||||
if (prefered.ordinal() + 2 < TEMP_VALUES.length) {
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() + 2]);
|
||||
}
|
||||
if (prefered.ordinal() - 2 >= 0) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() - 2]);
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() - 2]);
|
||||
}
|
||||
case BOTH_1:
|
||||
if (prefered.ordinal() + 1 < EnumTemperature.values().length) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() + 1]);
|
||||
if (prefered.ordinal() + 1 < TEMP_VALUES.length) {
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() + 1]);
|
||||
}
|
||||
if (prefered.ordinal() - 1 >= 0) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() - 1]);
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() - 1]);
|
||||
}
|
||||
return tolerated;
|
||||
|
||||
case UP_5:
|
||||
if (prefered.ordinal() + 5 < EnumTemperature.values().length) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() + 5]);
|
||||
if (prefered.ordinal() + 5 < TEMP_VALUES.length) {
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() + 5]);
|
||||
}
|
||||
case UP_4:
|
||||
if (prefered.ordinal() + 4 < EnumTemperature.values().length) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() + 4]);
|
||||
if (prefered.ordinal() + 4 < TEMP_VALUES.length) {
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() + 4]);
|
||||
}
|
||||
case UP_3:
|
||||
if (prefered.ordinal() + 3 < EnumTemperature.values().length) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() + 3]);
|
||||
if (prefered.ordinal() + 3 < TEMP_VALUES.length) {
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() + 3]);
|
||||
}
|
||||
case UP_2:
|
||||
if (prefered.ordinal() + 2 < EnumTemperature.values().length) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() + 2]);
|
||||
if (prefered.ordinal() + 2 < TEMP_VALUES.length) {
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() + 2]);
|
||||
}
|
||||
case UP_1:
|
||||
if (prefered.ordinal() + 1 < EnumTemperature.values().length) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() + 1]);
|
||||
if (prefered.ordinal() + 1 < TEMP_VALUES.length) {
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() + 1]);
|
||||
}
|
||||
return tolerated;
|
||||
|
||||
case DOWN_5:
|
||||
if (prefered.ordinal() - 5 >= 0) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() - 5]);
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() - 5]);
|
||||
}
|
||||
case DOWN_4:
|
||||
if (prefered.ordinal() - 4 >= 0) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() - 4]);
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() - 4]);
|
||||
}
|
||||
case DOWN_3:
|
||||
if (prefered.ordinal() - 3 >= 0) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() - 3]);
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() - 3]);
|
||||
}
|
||||
case DOWN_2:
|
||||
if (prefered.ordinal() - 2 >= 0) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() - 2]);
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() - 2]);
|
||||
}
|
||||
case DOWN_1:
|
||||
if (prefered.ordinal() - 1 >= 0) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() - 1]);
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() - 1]);
|
||||
}
|
||||
return tolerated;
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ public class GuiWorktable extends GuiForestryTitled<ContainerWorktable, TileWork
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glTranslatef(0, 0, 150);
|
||||
drawRect(left, top, left + 16, top + 16, 0x88ff0000);
|
||||
drawRect(left, top, left + 16, top + 16, 0x88000000 | getFontColor().get("gui.worktable.missing"));
|
||||
GL11.glTranslatef(0, 0, -150);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class BlockFarm extends BlockStructure {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (EnumFarmBlockTexture block : EnumFarmBlockTexture.values()) {
|
||||
for (EnumFarmBlockTexture block : EnumFarmBlockTexture.VALUES) {
|
||||
ItemStack stack = new ItemStack(item, 1, i);
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
block.saveToCompound(compound);
|
||||
|
||||
@@ -72,51 +72,54 @@ public class BlockMushroom extends BlockSapling implements IItemTyped {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int i, int j, int k, Random random) {
|
||||
|
||||
public void updateTick(World world, int x, int y, int z, Random random) {
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
int meta = world.getBlockMetadata(i, j, k);
|
||||
MushroomType type = getTypeFromMeta(meta);
|
||||
int maturity = meta >> 2;
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
final MushroomType type = getTypeFromMeta(meta);
|
||||
final int maturity = meta >> 2;
|
||||
|
||||
tickGermling(world, i, j, k, random, type, maturity);
|
||||
tickGermling(world, x, y, z, random, type, maturity);
|
||||
}
|
||||
|
||||
private void tickGermling(World world, int i, int j, int k, Random random, MushroomType type, int maturity) {
|
||||
|
||||
int lightvalue = world.getBlockLightValue(i, j + 1, k);
|
||||
|
||||
private void tickGermling(World world, int x, int y, int z, Random random, MushroomType type, int maturity) {
|
||||
if (random.nextInt(2) != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (maturity != 3) {
|
||||
maturity = 3;
|
||||
int matX = maturity << 2;
|
||||
int meta = (matX | type.ordinal());
|
||||
world.setBlockMetadataWithNotify(i, j, k, meta, Constants.FLAG_BLOCK_SYNCH);
|
||||
} else if (lightvalue <= 7) {
|
||||
func_149878_d(world, i, j, k, random);
|
||||
final int matX = maturity << 2;
|
||||
final int meta = (matX | type.ordinal());
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta, Constants.FLAG_BLOCK_SYNCH);
|
||||
} else {
|
||||
if (world.checkChunksExist(x - 1, y, z - 1, x + 1, y, z + 1)) {
|
||||
final int lightvalue = world.getBlockLightValue(x, y + 1, z);
|
||||
if (lightvalue <= 7) {
|
||||
func_149878_d(world, x, y, z, random);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_149878_d(World world, int i, int j, int k, Random random) {
|
||||
MushroomType type = getTypeFromMeta(world.getBlockMetadata(i, j, k));
|
||||
public void func_149878_d(World world, int x, int y, int z, Random random) {
|
||||
MushroomType type = getTypeFromMeta(world.getBlockMetadata(x, y, z));
|
||||
|
||||
world.setBlockToAir(i, j, k);
|
||||
if (!generators[type.ordinal()].generate(world, random, i, j, k)) {
|
||||
world.setBlock(i, j, k, this, type.ordinal(), 0);
|
||||
world.setBlockToAir(x, y, z);
|
||||
if (!generators[type.ordinal()].generate(world, random, x, y, z)) {
|
||||
world.setBlock(x, y, z, this, type.ordinal(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MushroomType getTypeFromMeta(int meta) {
|
||||
meta %= MushroomType.values().length;
|
||||
return MushroomType.values()[meta];
|
||||
return switch (meta % 2) {
|
||||
case 0 -> MushroomType.BROWN;
|
||||
case 1 -> MushroomType.RED;
|
||||
default -> throw new IllegalStateException("Unexpected value: " + meta);
|
||||
};
|
||||
}
|
||||
|
||||
/* ICONS */
|
||||
@@ -135,15 +138,10 @@ public class BlockMushroom extends BlockSapling implements IItemTyped {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
MushroomType type = getTypeFromMeta(meta);
|
||||
|
||||
switch (type) {
|
||||
case BROWN:
|
||||
return Blocks.brown_mushroom.getIcon(side, meta);
|
||||
case RED:
|
||||
return Blocks.red_mushroom.getIcon(side, meta);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
final MushroomType type = getTypeFromMeta(meta);
|
||||
return switch (type) {
|
||||
case BROWN -> Blocks.brown_mushroom.getIcon(side, meta);
|
||||
case RED -> Blocks.red_mushroom.getIcon(side, meta);
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class CircuitFarmLogic extends Circuit {
|
||||
} catch (Throwable e) {
|
||||
// uses older version of the API that doesn't implement setManual
|
||||
}
|
||||
housing.setFarmLogic(FarmDirection.values()[slot], logic);
|
||||
housing.setFarmLogic(FarmDirection.fromOrdinal(slot), logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,8 +75,7 @@ public class CircuitFarmLogic extends Circuit {
|
||||
if (farmHousing == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
farmHousing.resetFarmLogic(FarmDirection.values()[slot]);
|
||||
farmHousing.resetFarmLogic(FarmDirection.fromOrdinal(slot));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -372,7 +372,7 @@ public class FarmController extends RectangularMultiblockControllerBase
|
||||
}
|
||||
|
||||
private void refreshFarmLogics() {
|
||||
for (FarmDirection direction : FarmDirection.values()) {
|
||||
for (FarmDirection direction : FarmDirection.VALUES) {
|
||||
resetFarmLogic(direction);
|
||||
}
|
||||
|
||||
@@ -475,7 +475,7 @@ public class FarmController extends RectangularMultiblockControllerBase
|
||||
// Cultivation and collection
|
||||
FarmWorkStatus farmWorkStatus = new FarmWorkStatus();
|
||||
|
||||
for (FarmDirection farmSide : FarmDirection.values()) {
|
||||
for (FarmDirection farmSide : FarmDirection.VALUES) {
|
||||
|
||||
IFarmLogic logic = getFarmLogic(farmSide);
|
||||
if (logic == null) {
|
||||
@@ -541,7 +541,7 @@ public class FarmController extends RectangularMultiblockControllerBase
|
||||
private static void createTargets(World world, Map<FarmDirection, List<FarmTarget>> targets, Vect targetStart,
|
||||
final int allowedExtent, final int farmSizeNorthSouth, final int farmSizeEastWest) {
|
||||
|
||||
for (FarmDirection farmSide : FarmDirection.values()) {
|
||||
for (FarmDirection farmSide : FarmDirection.VALUES) {
|
||||
|
||||
final int farmWidth;
|
||||
if (farmSide == FarmDirection.NORTH || farmSide == FarmDirection.SOUTH) {
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package forestry.farming.multiblock;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.multiblock.IFarmFertilizerRegistry;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class FarmFertilizerRegistry implements IFarmFertilizerRegistry {
|
||||
|
||||
// the current list isn't big enough to require a hash map, and is faster as a list.
|
||||
private final List<ItemStack> fertilizers = new ArrayList<>(5);
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> getFertilizers() {
|
||||
return fertilizers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFertilizer(ItemStack itemstack) {
|
||||
// maybe throw warn? but could also be nice to leave as no warn for easier/cleaner optional mod dependencies
|
||||
if (itemstack == null || itemstack.getItem() == null || itemstack.stackSize <= 0) return;
|
||||
fertilizers.add(itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFertilizer(ItemStack itemstack) {
|
||||
// maybe throw warn? but could also be nice to leave as no warn for easier/cleaner optional mod dependencies
|
||||
if (itemstack == null || itemstack.getItem() == null) return;
|
||||
fertilizers.removeIf(fert -> {
|
||||
// in stack first so it wild card can be used for a wild-card clear.
|
||||
return ItemStackUtil.isIdenticalItem(itemstack, fert);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFertilizer(ItemStack itemstack) {
|
||||
if (itemstack == null) return false;
|
||||
for (ItemStack fert : this.fertilizers) {
|
||||
// fert first to allow for wild card checks
|
||||
if (ItemStackUtil.isIdenticalItem(fert, itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,6 @@ import java.util.Deque;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
@@ -21,6 +20,7 @@ import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.IFarmInventory;
|
||||
import forestry.api.farming.IFarmLogic;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import forestry.api.multiblock.MultiblockManager;
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.fluids.TankManager;
|
||||
import forestry.core.inventory.InventoryAdapterRestricted;
|
||||
@@ -28,9 +28,6 @@ import forestry.core.inventory.wrappers.InventoryMapper;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.core.utils.PlayerUtil;
|
||||
import forestry.core.utils.SlotUtil;
|
||||
import forestry.plugins.PluginCore;
|
||||
import forestry.plugins.PluginManager;
|
||||
import ic2.api.item.IC2Items;
|
||||
|
||||
public class InventoryFarm extends InventoryAdapterRestricted implements IFarmInventory {
|
||||
|
||||
@@ -106,7 +103,7 @@ public class InventoryFarm extends InventoryAdapterRestricted implements IFarmIn
|
||||
return false;
|
||||
}
|
||||
|
||||
for (FarmDirection farmDirection : FarmDirection.values()) {
|
||||
for (FarmDirection farmDirection : FarmDirection.VALUES) {
|
||||
IFarmLogic logic = farmController.getFarmLogic(farmDirection);
|
||||
if (logic.isAcceptedGermling(itemstack)) {
|
||||
return true;
|
||||
@@ -122,7 +119,7 @@ public class InventoryFarm extends InventoryAdapterRestricted implements IFarmIn
|
||||
return false;
|
||||
}
|
||||
|
||||
for (FarmDirection farmDirection : FarmDirection.values()) {
|
||||
for (FarmDirection farmDirection : FarmDirection.VALUES) {
|
||||
IFarmLogic logic = farmController.getFarmLogic(farmDirection);
|
||||
if (logic.isAcceptedResource(itemstack)) {
|
||||
return true;
|
||||
@@ -134,18 +131,8 @@ public class InventoryFarm extends InventoryAdapterRestricted implements IFarmIn
|
||||
|
||||
@Override
|
||||
public boolean acceptsAsFertilizer(ItemStack itemstack) {
|
||||
if (itemstack == null) {
|
||||
return false;
|
||||
}
|
||||
Item item = itemstack.getItem();
|
||||
if (PluginManager.Module.INDUSTRIALCRAFT.isEnabled()) {
|
||||
Item ic2fert = IC2Items.getItem("fertilizer").getItem();
|
||||
if (ic2fert == item) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return PluginCore.items.fertilizerCompound == item;
|
||||
// check if it's a fertilizer
|
||||
return MultiblockManager.farmFertilizerRegistry.isFertilizer(itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -45,8 +45,17 @@ public enum EnumFarmBlockTexture {
|
||||
private static final int TYPE_VALVE = 6;
|
||||
private static final int TYPE_CONTROL = 7;
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumFarmBlockTexture[] VALUES = values();
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static List<IIcon> icons;
|
||||
private final ItemStack base;
|
||||
|
||||
EnumFarmBlockTexture(ItemStack base) {
|
||||
this.base = base;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void registerIcons(IIconRegister register) {
|
||||
@@ -61,12 +70,6 @@ public enum EnumFarmBlockTexture {
|
||||
TextureManager.registerTex(register, "farm/control"));
|
||||
}
|
||||
|
||||
private final ItemStack base;
|
||||
|
||||
EnumFarmBlockTexture(ItemStack base) {
|
||||
this.base = base;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static IIcon getIcon(BlockFarmType type, int side) {
|
||||
switch (type) {
|
||||
@@ -109,11 +112,10 @@ public enum EnumFarmBlockTexture {
|
||||
public static EnumFarmBlockTexture getFromCompound(NBTTagCompound compound) {
|
||||
if (compound != null) {
|
||||
int farmBlockOrdinal = compound.getInteger("FarmBlock");
|
||||
if (farmBlockOrdinal < EnumFarmBlockTexture.values().length) {
|
||||
return EnumFarmBlockTexture.values()[farmBlockOrdinal];
|
||||
if (farmBlockOrdinal < EnumFarmBlockTexture.VALUES.length) {
|
||||
return EnumFarmBlockTexture.VALUES[farmBlockOrdinal];
|
||||
}
|
||||
}
|
||||
|
||||
return EnumFarmBlockTexture.BRICK_STONE;
|
||||
}
|
||||
}
|
||||
@@ -307,8 +307,7 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly
|
||||
size = genome.getSize();
|
||||
setSize(size, 0.4f);
|
||||
species = genome.getPrimary();
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
if (worldObj != null && !worldObj.isRemote) {
|
||||
dataWatcher.updateObject(DATAWATCHER_ID_SIZE, (int) (size * 100));
|
||||
dataWatcher.updateObject(DATAWATCHER_ID_SPECIES, species.getUID());
|
||||
} else {
|
||||
|
||||
@@ -57,7 +57,7 @@ public enum ButterflyBranchDefinition implements IBranchDefinition {
|
||||
@Override
|
||||
public IAllele[] getTemplate() {
|
||||
if (defaultTemplate == null) {
|
||||
defaultTemplate = new IAllele[EnumButterflyChromosome.values().length];
|
||||
defaultTemplate = new IAllele[EnumButterflyChromosome.VALUES.length];
|
||||
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumButterflyChromosome.SIZE, EnumAllele.Size.SMALL);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumButterflyChromosome.SPEED, EnumAllele.Speed.SLOWEST);
|
||||
|
||||
@@ -245,7 +245,7 @@ public class ButterflyHelper extends SpeciesRoot implements IButterflyRoot {
|
||||
|
||||
@Override
|
||||
public IChromosomeType[] getKaryotype() {
|
||||
return EnumButterflyChromosome.values();
|
||||
return EnumButterflyChromosome.VALUES;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,13 +25,8 @@ import forestry.lepidopterology.entities.EntityButterfly;
|
||||
|
||||
public class RenderButterflyItem implements IItemRenderer {
|
||||
|
||||
private final ModelButterfly model;
|
||||
private EntityButterfly entity;
|
||||
|
||||
public RenderButterflyItem() {
|
||||
model = new ModelButterfly();
|
||||
}
|
||||
|
||||
private static float getWingYaw(IButterfly butterfly) {
|
||||
float wingYaw = 1f;
|
||||
|
||||
@@ -72,18 +67,12 @@ public class RenderButterflyItem implements IItemRenderer {
|
||||
|
||||
private IButterfly initButterfly(ItemStack item) {
|
||||
IButterfly butterfly = ButterflyManager.butterflyRoot.getMember(item);
|
||||
if (butterfly == null) {
|
||||
butterfly = ButterflyManager.butterflyRoot
|
||||
.templateAsIndividual(ButterflyManager.butterflyRoot.getDefaultTemplate());
|
||||
}
|
||||
|
||||
if (entity == null) {
|
||||
entity = new EntityButterfly(Proxies.common.getRenderWorld(), butterfly, 0, 0, 0);
|
||||
entity = new EntityButterfly(null, butterfly, 0, 0, 0);
|
||||
} else {
|
||||
entity.setIndividual(butterfly);
|
||||
}
|
||||
|
||||
return butterfly;
|
||||
return entity.getButterfly();
|
||||
}
|
||||
|
||||
private void renderButterflyItem(IButterfly butterfly, float translateX, float translateY, float translateZ) {
|
||||
@@ -111,7 +100,12 @@ public class RenderButterflyItem implements IItemRenderer {
|
||||
entity.rotationPitch = 0;
|
||||
entity.rotationYawHead = entity.rotationYaw;
|
||||
|
||||
RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0f);
|
||||
try {
|
||||
entity.setWorld(Proxies.common.getRenderWorld());
|
||||
RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0f);
|
||||
} finally {
|
||||
entity.setWorld(null);
|
||||
}
|
||||
|
||||
} else {
|
||||
GL11.glTranslatef(translateX, translateY, translateZ);
|
||||
@@ -119,14 +113,19 @@ public class RenderButterflyItem implements IItemRenderer {
|
||||
GL11.glScalef(-2.0f, 2.0f, 2.0f);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-((float) Math.atan((double) (pitch / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(-((float) Math.atan(pitch / 40.0F)) * 20.0F, 1.0F, 0.0F, 0.0F);
|
||||
|
||||
entity.renderYawOffset = (float) Math.atan((double) (yaw / 40.0F)) * 20.0F;
|
||||
entity.rotationYaw = (float) Math.atan((double) (yaw / 40.0F)) * 40.0F;
|
||||
entity.rotationPitch = -((float) Math.atan((double) (pitch / 40.0F))) * 20.0F;
|
||||
entity.renderYawOffset = (float) Math.atan(yaw / 40.0F) * 20.0F;
|
||||
entity.rotationYaw = (float) Math.atan(yaw / 40.0F) * 40.0F;
|
||||
entity.rotationPitch = -((float) Math.atan(pitch / 40.0F)) * 20.0F;
|
||||
entity.rotationYawHead = entity.rotationYaw;
|
||||
|
||||
RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, getWingYaw(butterfly));
|
||||
try {
|
||||
entity.setWorld(Proxies.common.getRenderWorld());
|
||||
RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, getWingYaw(butterfly));
|
||||
} finally {
|
||||
entity.setWorld(null);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
@@ -160,8 +159,12 @@ public class RenderButterflyItem implements IItemRenderer {
|
||||
entity.rotationPitch = 0;
|
||||
entity.rotationYawHead = entity.rotationYaw;
|
||||
|
||||
RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, getWingYaw(butterfly));
|
||||
|
||||
try {
|
||||
entity.setWorld(Proxies.common.getRenderWorld());
|
||||
RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, getWingYaw(butterfly));
|
||||
} finally {
|
||||
entity.setWorld(null);
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
@@ -173,39 +176,27 @@ public class RenderButterflyItem implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
case EQUIPPED:
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
case INVENTORY:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return switch (type) {
|
||||
case ENTITY, EQUIPPED, EQUIPPED_FIRST_PERSON, INVENTORY -> true;
|
||||
default -> false;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
switch (helper) {
|
||||
case ENTITY_BOBBING:
|
||||
case ENTITY_ROTATION:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
return switch (helper) {
|
||||
case ENTITY_BOBBING, ENTITY_ROTATION -> false;
|
||||
default -> true;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
renderButterflyItem(initButterfly(item), 0f, -0.5f, 0f);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
renderButterflyItem(initButterfly(item), 0.5f, -0.9f, 1.0f);
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
case EQUIPPED, EQUIPPED_FIRST_PERSON:
|
||||
renderButterflyItem(initButterfly(item), 0.5f, -0.9f, 1.0f);
|
||||
break;
|
||||
case INVENTORY:
|
||||
|
||||
@@ -55,6 +55,7 @@ import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.tiles.MachineDefinition;
|
||||
import forestry.core.utils.ClimateUtil;
|
||||
import forestry.core.utils.ForestryModEnvWarningCallable;
|
||||
import forestry.farming.multiblock.FarmFertilizerRegistry;
|
||||
|
||||
@Plugin(
|
||||
pluginID = "Core",
|
||||
@@ -85,6 +86,7 @@ public class PluginCore extends ForestryPlugin {
|
||||
AlleleHelper.instance = new AlleleHelper();
|
||||
|
||||
MultiblockManager.logicFactory = new MultiblockLogicFactory();
|
||||
MultiblockManager.farmFertilizerRegistry = new FarmFertilizerRegistry();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,7 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
@@ -30,6 +31,7 @@ import forestry.api.circuits.CircuitSocketType;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
import forestry.api.farming.Farmables;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import forestry.api.multiblock.MultiblockManager;
|
||||
import forestry.core.circuits.Circuit;
|
||||
import forestry.core.circuits.CircuitLayout;
|
||||
import forestry.core.config.Constants;
|
||||
@@ -300,7 +302,7 @@ public class PluginFarming extends ForestryPlugin {
|
||||
ItemStack valve = blocks.farm.get(BlockFarmType.VALVE, 1);
|
||||
ItemStack control = blocks.farm.get(BlockFarmType.CONTROL, 1);
|
||||
|
||||
for (EnumFarmBlockTexture block : EnumFarmBlockTexture.values()) {
|
||||
for (EnumFarmBlockTexture block : EnumFarmBlockTexture.VALUES) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
block.saveToCompound(compound);
|
||||
|
||||
@@ -402,5 +404,8 @@ public class PluginFarming extends ForestryPlugin {
|
||||
layoutManual,
|
||||
PluginCore.items.tubes.get(EnumElectronTube.LAPIS, 1),
|
||||
Circuit.farmCocoaManual);
|
||||
|
||||
MultiblockManager.farmFertilizerRegistry
|
||||
.addFertilizer(new ItemStack(PluginCore.items.fertilizerCompound, 1, OreDictionary.WILDCARD_VALUE));
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.farming.Farmables;
|
||||
import forestry.api.fuels.EngineBronzeFuel;
|
||||
import forestry.api.fuels.FuelManager;
|
||||
import forestry.api.multiblock.MultiblockManager;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.api.storage.BackpackManager;
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
@@ -94,6 +95,7 @@ public class PluginIC2 extends ForestryPlugin {
|
||||
private static ItemStack silver;
|
||||
private static ItemStack brass;
|
||||
private static ItemStack uuMatter;
|
||||
private static ItemStack fertilizer;
|
||||
|
||||
public static ItemStack resin;
|
||||
public static ItemStack rubberwood;
|
||||
@@ -162,11 +164,13 @@ public class PluginIC2 extends ForestryPlugin {
|
||||
brass = IC2Items.getItem("bronzeIngot");
|
||||
|
||||
uran238 = IC2Items.getItem("Uran238");
|
||||
fertilizer = IC2Items.getItem("fertilizer");
|
||||
|
||||
Circuit.farmRubberManual = new CircuitFarmLogic("manualRubber", FarmLogicRubber.class);
|
||||
|
||||
ICircuitLayout layoutEngineTin = new CircuitLayout("engine.tin", CircuitSocketType.ELECTRIC_ENGINE);
|
||||
ChipsetManager.circuitRegistry.registerLayout(layoutEngineTin);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -378,6 +382,10 @@ public class PluginIC2 extends ForestryPlugin {
|
||||
'V',
|
||||
Blocks.piston);
|
||||
}
|
||||
|
||||
if (PluginManager.Module.FARMING.isEnabled() && fertilizer != null) {
|
||||
MultiblockManager.farmFertilizerRegistry.addFertilizer(fertilizer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,6 +10,7 @@ gui.screen=ffffff
|
||||
gui.table.header=ababab
|
||||
gui.table.row=ababab
|
||||
gui.book=000000
|
||||
gui.worktable.missing=ff0000
|
||||
|
||||
gui.beealyzer.binomial=14d50b
|
||||
gui.beealyzer.recessive=3687ec
|
||||
|
||||
|
Before Width: | Height: | Size: 411 B After Width: | Height: | Size: 408 B |
|
Before Width: | Height: | Size: 228 B After Width: | Height: | Size: 227 B |
|
Before Width: | Height: | Size: 447 B After Width: | Height: | Size: 445 B |
|
Before Width: | Height: | Size: 231 B After Width: | Height: | Size: 228 B |
|
Before Width: | Height: | Size: 212 B After Width: | Height: | Size: 207 B |
|
Before Width: | Height: | Size: 467 B After Width: | Height: | Size: 424 B |
|
Before Width: | Height: | Size: 324 B After Width: | Height: | Size: 319 B |
|
Before Width: | Height: | Size: 243 B After Width: | Height: | Size: 236 B |
|
Before Width: | Height: | Size: 346 B After Width: | Height: | Size: 345 B |
|
Before Width: | Height: | Size: 355 B After Width: | Height: | Size: 349 B |
|
Before Width: | Height: | Size: 362 B After Width: | Height: | Size: 359 B |
|
Before Width: | Height: | Size: 210 B After Width: | Height: | Size: 209 B |
|
Before Width: | Height: | Size: 332 B After Width: | Height: | Size: 326 B |
|
Before Width: | Height: | Size: 245 B After Width: | Height: | Size: 232 B |
|
Before Width: | Height: | Size: 362 B After Width: | Height: | Size: 359 B |
|
Before Width: | Height: | Size: 239 B After Width: | Height: | Size: 233 B |
|
Before Width: | Height: | Size: 384 B After Width: | Height: | Size: 379 B |
|
Before Width: | Height: | Size: 375 B After Width: | Height: | Size: 371 B |
|
Before Width: | Height: | Size: 318 B After Width: | Height: | Size: 312 B |
|
Before Width: | Height: | Size: 240 B After Width: | Height: | Size: 228 B |
|
Before Width: | Height: | Size: 221 B After Width: | Height: | Size: 219 B |
|
Before Width: | Height: | Size: 181 B After Width: | Height: | Size: 179 B |
|
Before Width: | Height: | Size: 168 B After Width: | Height: | Size: 161 B |
|
Before Width: | Height: | Size: 217 B After Width: | Height: | Size: 215 B |
|
Before Width: | Height: | Size: 285 B After Width: | Height: | Size: 284 B |
|
Before Width: | Height: | Size: 287 B After Width: | Height: | Size: 286 B |
|
Before Width: | Height: | Size: 195 B After Width: | Height: | Size: 193 B |
|
Before Width: | Height: | Size: 195 B After Width: | Height: | Size: 193 B |
|
Before Width: | Height: | Size: 186 B After Width: | Height: | Size: 183 B |
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 125 B After Width: | Height: | Size: 114 B |
|
Before Width: | Height: | Size: 122 B After Width: | Height: | Size: 113 B |
|
Before Width: | Height: | Size: 125 B After Width: | Height: | Size: 114 B |
|
Before Width: | Height: | Size: 124 B After Width: | Height: | Size: 113 B |
|
Before Width: | Height: | Size: 339 B After Width: | Height: | Size: 337 B |
|
Before Width: | Height: | Size: 339 B After Width: | Height: | Size: 337 B |
|
Before Width: | Height: | Size: 336 B After Width: | Height: | Size: 334 B |
|
Before Width: | Height: | Size: 500 B After Width: | Height: | Size: 499 B |
|
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 233 B |