mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 09:34:57 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a62024dd4 | ||
|
|
bedb7ffe85 | ||
|
|
4a21641bcd | ||
|
|
21d0b832b9 | ||
|
|
ce9081249f | ||
|
|
f6786cd44a | ||
|
|
a045c18a89 | ||
|
|
d6af85ad77 | ||
|
|
af55bd86a2 | ||
|
|
7aa840282f | ||
|
|
a5d57c4788 | ||
|
|
4d0c2d1ea2 | ||
|
|
840331b7d5 | ||
|
|
df91b47b35 | ||
|
|
f400241ff4 | ||
|
|
8639148f20 | ||
|
|
28e7b561ea | ||
|
|
ba7ef4228c | ||
|
|
fcd3ee6feb | ||
|
|
6ddc9f3079 | ||
|
|
cc53894473 | ||
|
|
2cd76bdad7 | ||
|
|
92eab8d47a | ||
|
|
12f5d7be6c | ||
|
|
ab88e7d57c | ||
|
|
725d85181d | ||
|
|
23c9b2071b | ||
|
|
ae025a92fc | ||
|
|
fbf30b1a73 | ||
|
|
4ba3370fc9 |
No files matched your search
+2
-2
@@ -1,5 +1,5 @@
|
||||
mcversion=1.9.4
|
||||
forgeversion=12.17.0.1950
|
||||
forgeversion=12.17.0.1957
|
||||
mcp_mappings=snapshot_20160525
|
||||
|
||||
jei_version=3.6.0.+
|
||||
@@ -7,4 +7,4 @@ ic2_version=2.5.5-ex19
|
||||
|
||||
version_major=5
|
||||
version_minor=0
|
||||
version_patch=10
|
||||
version_patch=15
|
||||
+1
-1
Submodule lang updated: ac5825bcc9...9be86d3c99.
@@ -36,6 +36,12 @@ public interface IBeekeepingLogic extends INbtWritable, INbtReadable {
|
||||
*/
|
||||
void doWork();
|
||||
|
||||
/**
|
||||
* Force the logic to refresh any cached values and error states.
|
||||
* Call this when a player opens the gui so that all errors are up to date.
|
||||
*/
|
||||
void clearCachedValues();
|
||||
|
||||
|
||||
/* CLIENT */
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture.hives;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
@@ -46,5 +48,5 @@ public interface IHiveDescription {
|
||||
* Called after successful hive generation.
|
||||
* world, x, y, z give the location of the new hive.
|
||||
**/
|
||||
void postGen(World world, BlockPos pos);
|
||||
void postGen(World world, Random rand, BlockPos pos);
|
||||
}
|
||||
@@ -5,6 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
@@ -24,6 +26,7 @@ public interface ISqueezerRecipe extends IForestryRecipe {
|
||||
/**
|
||||
* @return Item stack representing the possible remnants from this recipe. (i.e. tin left over from tin cans)
|
||||
*/
|
||||
@Nullable
|
||||
ItemStack getRemnants();
|
||||
|
||||
/**
|
||||
|
||||
@@ -197,6 +197,8 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
if (!ItemStack.areItemStacksEqual(this.queenStack, queenStack)) {
|
||||
this.queen = BeeManager.beeRoot.getMember(queenStack);
|
||||
this.queenStack = queenStack;
|
||||
hasFlowersCache.clear();
|
||||
queenCanWorkCache.clear();
|
||||
}
|
||||
|
||||
if (errorLogic.setCondition(queen == null, EnumErrorCode.NO_QUEEN)) {
|
||||
@@ -235,6 +237,13 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearCachedValues() {
|
||||
hasFlowersCache.clear();
|
||||
queenCanWorkCache.clear();
|
||||
canWork();
|
||||
}
|
||||
|
||||
private void queenWorkTick(IBee queen) {
|
||||
if (queen == null) {
|
||||
beeProgress = 0;
|
||||
@@ -505,6 +514,11 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
|
||||
return queenCanWorkCached;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
queenCanWorkCached.clear();
|
||||
queenCanWorkCooldown = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private static class PollenHandler {
|
||||
|
||||
@@ -37,6 +37,11 @@ public class FakeBeekeepingLogic implements IBeekeepingLogic {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearCachedValues() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncToClient() {
|
||||
|
||||
|
||||
@@ -97,6 +97,11 @@ public class HasFlowersCache implements INbtWritable, INbtReadable, IStreamable
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
flowerCoords.clear();
|
||||
cooldown = 0;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public List<BlockPos> getFlowerCoords() {
|
||||
return Collections.unmodifiableList(flowerCoords);
|
||||
|
||||
@@ -22,6 +22,8 @@ public class ContainerAlveary extends ContainerTile<TileAlveary> {
|
||||
public ContainerAlveary(InventoryPlayer player, TileAlveary tile) {
|
||||
super(tile, player, 8, 108);
|
||||
ContainerBeeHelper.addSlots(this, tile, false);
|
||||
|
||||
tile.getBeekeepingLogic().clearCachedValues();
|
||||
}
|
||||
|
||||
private int beeProgress = -1;
|
||||
|
||||
@@ -22,6 +22,8 @@ public class ContainerBeeHousing extends ContainerTile<TileBeeHousingBase> imple
|
||||
public ContainerBeeHousing(InventoryPlayer player, TileBeeHousingBase tile, boolean hasFrames) {
|
||||
super(tile, player, 8, 108);
|
||||
ContainerBeeHelper.addSlots(this, tile, hasFrames);
|
||||
|
||||
tile.getBeekeepingLogic().clearCachedValues();
|
||||
}
|
||||
|
||||
private int beeProgress = -1;
|
||||
|
||||
@@ -21,6 +21,8 @@ public class ContainerMinecartBeehouse extends ContainerEntity<EntityMinecartBee
|
||||
public ContainerMinecartBeehouse(InventoryPlayer player, EntityMinecartBeeHousingBase entity, boolean hasFrames) {
|
||||
super(entity, player, 8, 108);
|
||||
ContainerBeeHelper.addSlots(this, entity, hasFrames);
|
||||
|
||||
entity.getBeekeepingLogic().clearCachedValues();
|
||||
}
|
||||
|
||||
private int beeProgress = -1;
|
||||
|
||||
@@ -137,7 +137,7 @@ public class TileAlvearySwarmer extends TileAlveary implements ISidedInventory,
|
||||
int x = getPos().getX() + worldObj.rand.nextInt(40 * 2) - 40;
|
||||
int z = getPos().getZ() + worldObj.rand.nextInt(40 * 2) - 40;
|
||||
|
||||
if (HiveDecorator.tryGenHive(worldObj, x, z, hive)) {
|
||||
if (HiveDecorator.tryGenHive(worldObj, worldObj.rand, x, z, hive)) {
|
||||
pendingSpawns.pop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ package forestry.apiculture.worldgen;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -52,8 +53,8 @@ public final class Hive {
|
||||
return hiveDescription.getGenChance();
|
||||
}
|
||||
|
||||
public void postGen(World world, BlockPos pos) {
|
||||
hiveDescription.postGen(world, pos);
|
||||
public void postGen(World world, Random rand, BlockPos pos) {
|
||||
hiveDescription.postGen(world, rand, pos);
|
||||
}
|
||||
|
||||
public boolean isGoodBiome(Biome biome) {
|
||||
|
||||
@@ -48,7 +48,7 @@ public abstract class HiveDecorator {
|
||||
List<Hive> hives = PluginApiculture.hiveRegistry.getHives();
|
||||
|
||||
if (Config.generateBeehivesDebug) {
|
||||
decorateHivesDebug(world, chunkX, chunkZ, hives);
|
||||
decorateHivesDebug(world, rand, chunkX, chunkZ, hives);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public abstract class HiveDecorator {
|
||||
for (Hive hive : hives) {
|
||||
if (hive.genChance() * Config.getBeehivesAmount() >= rand.nextFloat() * 100.0f) {
|
||||
if (hive.isGoodBiome(biome) && hive.isGoodHumidity(humidity)) {
|
||||
if (tryGenHive(world, x, z, hive)) {
|
||||
if (tryGenHive(world, rand, x, z, hive)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public abstract class HiveDecorator {
|
||||
}
|
||||
}
|
||||
|
||||
private static void decorateHivesDebug(World world, int chunkX, int chunkZ, List<Hive> hives) {
|
||||
private static void decorateHivesDebug(World world, Random rand, int chunkX, int chunkZ, List<Hive> hives) {
|
||||
int worldX = (chunkX << 4) + 8;
|
||||
int worldZ = (chunkZ << 4) + 8;
|
||||
Biome biome = world.getBiome(new BlockPos(chunkX, 0, chunkZ));
|
||||
@@ -95,13 +95,13 @@ public abstract class HiveDecorator {
|
||||
continue;
|
||||
}
|
||||
|
||||
tryGenHive(world, worldX + x, worldZ + z, hive);
|
||||
tryGenHive(world, rand, worldX + x, worldZ + z, hive);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean tryGenHive(World world, int x, int z, Hive hive) {
|
||||
public static boolean tryGenHive(World world, Random rand, int x, int z, Hive hive) {
|
||||
|
||||
final BlockPos hivePos = hive.getPosForHive(world, x, z);
|
||||
|
||||
@@ -123,10 +123,10 @@ public abstract class HiveDecorator {
|
||||
return false;
|
||||
}
|
||||
|
||||
return setHive(world, hivePos, hive);
|
||||
return setHive(world, rand, hivePos, hive);
|
||||
}
|
||||
|
||||
private static boolean setHive(World world, BlockPos pos, Hive hive) {
|
||||
private static boolean setHive(World world, Random rand, BlockPos pos, Hive hive) {
|
||||
IBlockState hiveState = hive.getHiveBlockState();
|
||||
Block hiveBlock = hiveState.getBlock();
|
||||
boolean placed = world.setBlockState(pos, hiveState, Constants.FLAG_BLOCK_SYNC);
|
||||
@@ -143,7 +143,7 @@ public abstract class HiveDecorator {
|
||||
hiveBlock.onBlockAdded(world, pos, state);
|
||||
|
||||
if (!Config.generateBeehivesDebug) {
|
||||
hive.postGen(world, pos);
|
||||
hive.postGen(world, rand, pos);
|
||||
}
|
||||
|
||||
if (Config.logHivePlacement) {
|
||||
|
||||
@@ -13,6 +13,7 @@ package forestry.apiculture.worldgen;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -41,23 +42,23 @@ public enum HiveDescription implements IHiveDescription {
|
||||
|
||||
FOREST(IHiveRegistry.HiveType.FOREST, 3.0f, BeeDefinition.FOREST, HiveManager.genHelper.tree()) {
|
||||
@Override
|
||||
public void postGen(World world, BlockPos pos) {
|
||||
super.postGen(world, pos);
|
||||
postGenFlowers(world, pos, flowerStates);
|
||||
public void postGen(World world, Random rand, BlockPos pos) {
|
||||
super.postGen(world, rand, pos);
|
||||
postGenFlowers(world, rand, pos, flowerStates);
|
||||
}
|
||||
},
|
||||
MEADOWS(IHiveRegistry.HiveType.MEADOWS, 1.0f, BeeDefinition.MEADOWS, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS)) {
|
||||
@Override
|
||||
public void postGen(World world, BlockPos pos) {
|
||||
super.postGen(world, pos);
|
||||
postGenFlowers(world, pos, flowerStates);
|
||||
public void postGen(World world, Random rand, BlockPos pos) {
|
||||
super.postGen(world, rand, pos);
|
||||
postGenFlowers(world, rand, pos, flowerStates);
|
||||
}
|
||||
},
|
||||
DESERT(IHiveRegistry.HiveType.DESERT, 1.0f, BeeDefinition.MODEST, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS, Blocks.SAND, Blocks.SANDSTONE)) {
|
||||
@Override
|
||||
public void postGen(World world, BlockPos pos) {
|
||||
super.postGen(world, pos);
|
||||
postGenFlowers(world, pos, cactusStates);
|
||||
public void postGen(World world, Random rand, BlockPos pos) {
|
||||
super.postGen(world, rand, pos);
|
||||
postGenFlowers(world, rand, pos, cactusStates);
|
||||
}
|
||||
},
|
||||
JUNGLE(IHiveRegistry.HiveType.JUNGLE, 6.0f, BeeDefinition.TROPICAL, HiveManager.genHelper.tree()),
|
||||
@@ -69,21 +70,21 @@ public enum HiveDescription implements IHiveDescription {
|
||||
},
|
||||
SNOW(IHiveRegistry.HiveType.SNOW, 2.0f, BeeDefinition.WINTRY, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS, Blocks.SNOW)) {
|
||||
@Override
|
||||
public void postGen(World world, BlockPos pos) {
|
||||
public void postGen(World world, Random rand, BlockPos pos) {
|
||||
BlockPos posAbove = pos.up();
|
||||
if (world.isAirBlock(posAbove)) {
|
||||
world.setBlockState(posAbove, Blocks.SNOW_LAYER.getDefaultState(), Constants.FLAG_BLOCK_SYNC);
|
||||
}
|
||||
|
||||
postGenFlowers(world, pos, flowerStates);
|
||||
postGenFlowers(world, rand, pos, flowerStates);
|
||||
}
|
||||
},
|
||||
SWAMP(IHiveRegistry.HiveType.SWAMP, 2.0f, BeeDefinition.MARSHY, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS)) {
|
||||
@Override
|
||||
public void postGen(World world, BlockPos pos) {
|
||||
super.postGen(world, pos);
|
||||
public void postGen(World world, Random rand, BlockPos pos) {
|
||||
super.postGen(world, rand, pos);
|
||||
|
||||
postGenFlowers(world, pos, mushroomStates);
|
||||
postGenFlowers(world, rand, pos, mushroomStates);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -146,15 +147,15 @@ public enum HiveDescription implements IHiveDescription {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postGen(World world, BlockPos pos) {
|
||||
public void postGen(World world, Random rand, BlockPos pos) {
|
||||
|
||||
}
|
||||
|
||||
protected static void postGenFlowers(World world, BlockPos hivePos, List<IBlockState> flowerStates) {
|
||||
protected static void postGenFlowers(World world, Random rand, BlockPos hivePos, List<IBlockState> flowerStates) {
|
||||
int plantedCount = 0;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
int xOffset = world.rand.nextInt(8) - 4;
|
||||
int zOffset = world.rand.nextInt(8) - 4;
|
||||
int xOffset = rand.nextInt(8) - 4;
|
||||
int zOffset = rand.nextInt(8) - 4;
|
||||
BlockPos blockPos = hivePos.add(xOffset, 0, zOffset);
|
||||
if ((xOffset == 0 && zOffset == 0) || !world.isBlockLoaded(blockPos)) {
|
||||
continue;
|
||||
@@ -165,7 +166,7 @@ public enum HiveDescription implements IHiveDescription {
|
||||
continue;
|
||||
}
|
||||
|
||||
IBlockState state = flowerStates.get(world.rand.nextInt(flowerStates.size()));
|
||||
IBlockState state = flowerStates.get(rand.nextInt(flowerStates.size()));
|
||||
Block block = state.getBlock();
|
||||
if (!block.canPlaceBlockAt(world, blockPos)) {
|
||||
continue;
|
||||
|
||||
@@ -12,6 +12,7 @@ package forestry.apiculture.worldgen;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -68,7 +69,7 @@ public class HiveDescriptionSwarmer implements IHiveDescription {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postGen(World world, BlockPos pos) {
|
||||
public void postGen(World world, Random rand, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileHive) {
|
||||
((TileHive) tile).setContained(bees);
|
||||
|
||||
@@ -59,11 +59,6 @@ public class BlockForestryFenceGate<T extends Enum<T> & IWoodType> extends Block
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material getMaterial(IBlockState state) {
|
||||
return MaterialArbWood.ARB_WOOD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFireproof() {
|
||||
return fireproof;
|
||||
|
||||
@@ -214,17 +214,16 @@ public class BlockForestryLeaves extends BlockLeaves implements ITileEntityProvi
|
||||
|
||||
@Override
|
||||
public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) {
|
||||
String speciesUid = TreeDefinition.Oak.getUID();
|
||||
|
||||
TileLeaves leaves = TileUtil.getTile(world, pos, TileLeaves.class);
|
||||
if (leaves == null) {
|
||||
return null;
|
||||
if (leaves != null) {
|
||||
ITree tree = leaves.getTree();
|
||||
if (tree != null) {
|
||||
speciesUid = tree.getGenome().getPrimary().getUID();
|
||||
}
|
||||
}
|
||||
|
||||
ITree tree = leaves.getTree();
|
||||
if (tree == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String speciesUid = tree.getGenome().getPrimary().getUID();
|
||||
|
||||
return Collections.singletonList(PluginArboriculture.blocks.getDecorativeLeaves(speciesUid));
|
||||
}
|
||||
|
||||
|
||||
@@ -38,11 +38,6 @@ public class BlockForestryStairs<T extends Enum<T> & IWoodType> extends BlockSta
|
||||
setHarvestLevel("axe", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material getMaterial(IBlockState state) {
|
||||
return MaterialArbWood.ARB_WOOD;
|
||||
}
|
||||
|
||||
/* MODELS */
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package forestry.arboriculture.blocks;
|
||||
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class MaterialArbWood extends Material {
|
||||
|
||||
public static final Material ARB_WOOD = new MaterialArbWood();
|
||||
|
||||
private MaterialArbWood() {
|
||||
super(MapColor.WOOD);
|
||||
setBurning();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -35,7 +35,6 @@ import forestry.api.core.Tabs;
|
||||
import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.arboriculture.PluginArboriculture;
|
||||
import forestry.arboriculture.WoodHelper;
|
||||
import forestry.arboriculture.blocks.MaterialArbWood;
|
||||
import forestry.arboriculture.blocks.WoodTypeStateMapper;
|
||||
import forestry.arboriculture.blocks.property.PropertyWoodType;
|
||||
import forestry.core.proxy.Proxies;
|
||||
@@ -48,7 +47,7 @@ public abstract class BlockForestryFence<T extends Enum<T> & IWoodType> extends
|
||||
private final int blockNumber;
|
||||
|
||||
protected BlockForestryFence(boolean fireproof, int blockNumber) {
|
||||
super(MaterialArbWood.ARB_WOOD, BlockPlanks.EnumType.OAK.getMapColor());
|
||||
super(Material.WOOD, BlockPlanks.EnumType.OAK.getMapColor());
|
||||
this.fireproof = fireproof;
|
||||
this.blockNumber = blockNumber;
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.arboriculture.WoodHelper;
|
||||
import forestry.arboriculture.blocks.MaterialArbWood;
|
||||
import forestry.arboriculture.blocks.WoodTypeStateMapper;
|
||||
import forestry.arboriculture.blocks.property.PropertyWoodType;
|
||||
import forestry.core.proxy.Proxies;
|
||||
@@ -67,11 +66,6 @@ public abstract class BlockForestryLog<T extends Enum<T> & IWoodType> extends Bl
|
||||
return blockNumber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Material getMaterial(IBlockState state) {
|
||||
return MaterialArbWood.ARB_WOOD;
|
||||
}
|
||||
|
||||
private static EnumAxis getAxis(int meta) {
|
||||
switch (meta & 12) {
|
||||
case 0:
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -29,7 +30,6 @@ import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.arboriculture.WoodHelper;
|
||||
import forestry.arboriculture.blocks.MaterialArbWood;
|
||||
import forestry.arboriculture.blocks.WoodTypeStateMapper;
|
||||
import forestry.arboriculture.blocks.property.PropertyWoodType;
|
||||
import forestry.core.proxy.Proxies;
|
||||
@@ -42,7 +42,7 @@ public abstract class BlockForestryPlanks<T extends Enum<T> & IWoodType> extends
|
||||
private final int blockNumber;
|
||||
|
||||
protected BlockForestryPlanks(boolean fireproof, int blockNumber) {
|
||||
super(MaterialArbWood.ARB_WOOD);
|
||||
super(Material.WOOD);
|
||||
this.fireproof = fireproof;
|
||||
this.blockNumber = blockNumber;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -30,7 +31,6 @@ import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.arboriculture.WoodHelper;
|
||||
import forestry.arboriculture.blocks.MaterialArbWood;
|
||||
import forestry.arboriculture.blocks.WoodTypeStateMapper;
|
||||
import forestry.arboriculture.blocks.property.PropertyWoodType;
|
||||
import forestry.core.proxy.Proxies;
|
||||
@@ -43,7 +43,7 @@ public abstract class BlockForestrySlab<T extends Enum<T> & IWoodType> extends B
|
||||
private final int blockNumber;
|
||||
|
||||
protected BlockForestrySlab(boolean fireproof, int blockNumber) {
|
||||
super(MaterialArbWood.ARB_WOOD);
|
||||
super(Material.WOOD);
|
||||
this.fireproof = fireproof;
|
||||
this.blockNumber = blockNumber;
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.render;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import static forestry.arboriculture.multiblock.EnumPilePosition.BACK;
|
||||
import static forestry.arboriculture.multiblock.EnumPilePosition.CORNER_BACK_LEFT;
|
||||
import static forestry.arboriculture.multiblock.EnumPilePosition.CORNER_BACK_RIGHT;
|
||||
@@ -46,8 +48,12 @@ public class CharcoalPileRenderer extends TileEntitySpecialRenderer<TilePile> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TilePile pile, double x, double y, double z, float p_147500_8_, int destroyStage) {
|
||||
public void renderTileEntityAt(@Nonnull TilePile pile, double x, double y, double z, float p_147500_8_, int destroyStage) {
|
||||
IBlockState state = pile.getWorld().getBlockState(pile.getPos());
|
||||
if (!(state.getBlock() instanceof BlockPile)) {
|
||||
return;
|
||||
}
|
||||
|
||||
EnumPilePosition pilePosition = state.getValue(BlockPile.PILE_POSITION);
|
||||
MultiblockLogic<ICharcoalPileControllerInternal> logic = pile.getMultiblockLogic();
|
||||
if (pilePosition != EnumPilePosition.INTERIOR && logic.isConnected() && logic.getController() != null) {
|
||||
|
||||
@@ -119,7 +119,7 @@ public final class CommandSaveStats extends SubCommand {
|
||||
}
|
||||
}
|
||||
|
||||
File file = new File(Proxies.common.getForestryRoot(), "config/" + Constants.MOD_ID + "/stats/" + player.getDisplayName() + '-' + saveHelper.getFileSuffix() + ".log");
|
||||
File file = new File(Proxies.common.getForestryRoot(), "config/" + Constants.MOD_ID + "/stats/" + player.getDisplayNameString() + '-' + saveHelper.getFileSuffix() + ".log");
|
||||
try {
|
||||
File folder = file.getParentFile();
|
||||
if (folder != null && !folder.exists()) {
|
||||
|
||||
@@ -154,27 +154,21 @@ public class InventoryAdapter implements IInventoryAdapter, IStreamable {
|
||||
}
|
||||
|
||||
/* ISIDEDINVENTORY */
|
||||
private int[][] slotMap;
|
||||
private int[] slotMap;
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side) {
|
||||
if (allowAutomation) {
|
||||
return slotMap[side.ordinal()];
|
||||
return slotMap;
|
||||
}
|
||||
return Constants.SLOTS_NONE;
|
||||
}
|
||||
|
||||
private void configureSided() {
|
||||
slotMap = new int[6][0];
|
||||
|
||||
int count = getSizeInventory();
|
||||
int[] slots = new int[count];
|
||||
slotMap = new int[count];
|
||||
for (int i = 0; i < count; i++) {
|
||||
slots[i] = i;
|
||||
}
|
||||
|
||||
for (EnumFacing side : EnumFacing.VALUES) {
|
||||
slotMap[side.getIndex()] = slots;
|
||||
slotMap[i] = i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,10 +27,10 @@ public class ItemWrench extends ItemForestry {//implements IToolWrench {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
if (block.rotateBlock(world, pos, side)) {
|
||||
player.swingArm(hand);
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
Block block = worldIn.getBlockState(pos).getBlock();
|
||||
if (block.rotateBlock(worldIn, pos, facing)) {
|
||||
playerIn.swingArm(hand);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
return EnumActionResult.FAIL;
|
||||
|
||||
@@ -32,7 +32,7 @@ public class DataInputStreamForestry extends DataInputStream {
|
||||
|
||||
if (!itemName.isEmpty()) {
|
||||
Item item = ItemStackUtil.getItemFromRegistry(itemName);
|
||||
byte stackSize = readByte();
|
||||
int stackSize = readVarInt();
|
||||
int meta = readVarInt();
|
||||
itemstack = new ItemStack(item, stackSize, meta);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public class DataOutputStreamForestry extends DataOutputStream {
|
||||
writeUTF("");
|
||||
} else {
|
||||
writeUTF(ItemStackUtil.getItemNameFromRegistryAsString(itemstack.getItem()));
|
||||
writeByte(itemstack.stackSize);
|
||||
writeVarInt(itemstack.stackSize);
|
||||
writeVarInt(itemstack.getItemDamage());
|
||||
|
||||
if (itemstack.getItem().isDamageable() || itemstack.getItem().getShareTag()) {
|
||||
|
||||
@@ -16,18 +16,6 @@ public class ForestryTooltipCallback implements ITooltipCallback<ItemStack> {
|
||||
|
||||
private final ArrayListMultimap<Integer, String> tooltips = ArrayListMultimap.create();
|
||||
|
||||
public void addToTooltip(int index, List<String> tooltip) {
|
||||
tooltips.get(index).addAll(tooltip);
|
||||
}
|
||||
|
||||
public void addToTooltip(int index, String tooltip) {
|
||||
tooltips.get(index).add(tooltip);
|
||||
}
|
||||
|
||||
public List<String> getTooltip(int index) {
|
||||
return tooltips.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTooltip(int index, boolean input, ItemStack ingredient, List<String> tooltip) {
|
||||
List<String> tip = tooltips.get(index);
|
||||
@@ -36,20 +24,18 @@ public class ForestryTooltipCallback implements ITooltipCallback<ItemStack> {
|
||||
}
|
||||
}
|
||||
|
||||
public void clearTooltip(){
|
||||
tooltips.clear();
|
||||
}
|
||||
|
||||
public void addChanceTooltip(int index, float chance) {
|
||||
if (chance <= 0.0F) {
|
||||
tooltips.get(index).add(TextFormatting.GRAY + String.format(Translator.translateToLocal("forestry.jei.chance"), Translator.translateToLocal("forestry.jei.chance.never")));
|
||||
} else if (chance < 0.01F) {
|
||||
tooltips.get(index).add(TextFormatting.GRAY + String.format(Translator.translateToLocal("forestry.jei.chance"), Translator.translateToLocal("forestry.jei.chance.lessThan1")));
|
||||
} else if (chance != 1.0F) {
|
||||
NumberFormat percentFormat = NumberFormat.getPercentInstance();
|
||||
percentFormat.setMaximumFractionDigits(2);
|
||||
tooltips.get(index).add(TextFormatting.GRAY + String.format(Translator.translateToLocal("forestry.jei.chance"), String.valueOf(percentFormat.format(chance))));
|
||||
if (chance < 0) {
|
||||
chance = 0;
|
||||
} else if (chance > 1.0) {
|
||||
chance = 1.0f;
|
||||
}
|
||||
|
||||
NumberFormat percentFormat = NumberFormat.getPercentInstance();
|
||||
percentFormat.setMaximumFractionDigits(2);
|
||||
String chanceString = String.valueOf(percentFormat.format(chance));
|
||||
|
||||
tooltips.get(index).add(TextFormatting.GRAY + Translator.translateToLocalFormatted("for.jei.chance", chanceString));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,11 +12,54 @@ package forestry.core.tiles;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidTankProperties;
|
||||
|
||||
import forestry.core.fluids.ITankManager;
|
||||
|
||||
public interface ILiquidTankTile extends ILocatable {
|
||||
public interface ILiquidTankTile extends ILocatable, IFluidHandler {
|
||||
|
||||
@Nonnull
|
||||
ITankManager getTankManager();
|
||||
|
||||
@Override
|
||||
default int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||
return getTankManager().fill(resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
default FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||
return getTankManager().drain(resource, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
default FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||
return getTankManager().drain(maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
default boolean canFill(EnumFacing from, Fluid fluid) {
|
||||
return getTankManager().canFillFluidType(new FluidStack(fluid, Fluid.BUCKET_VOLUME));
|
||||
}
|
||||
|
||||
@Override
|
||||
default boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||
return getTankManager().canDrainFluidType(new FluidStack(fluid, Fluid.BUCKET_VOLUME));
|
||||
}
|
||||
|
||||
@Override
|
||||
default FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||
IFluidTankProperties[] tankProperties = getTankManager().getTankProperties();
|
||||
FluidTankInfo[] tankInfos = new FluidTankInfo[tankProperties.length];
|
||||
for (int i = 0; i < tankProperties.length; i++) {
|
||||
IFluidTankProperties fluidTankProperties = tankProperties[i];
|
||||
tankInfos[i] = new FluidTankInfo(fluidTankProperties.getContents(), fluidTankProperties.getCapacity());
|
||||
}
|
||||
return tankInfos;
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import java.io.IOException;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
@@ -68,7 +69,7 @@ public abstract class TileNaturalistChest extends TileBase implements IPagedInve
|
||||
prevLidAngle = lidAngle;
|
||||
|
||||
if (numPlayersUsing > 0 && lidAngle == 0.0F) {
|
||||
playLidSound("random.chestopen");
|
||||
playLidSound(SoundEvents.BLOCK_CHEST_OPEN);
|
||||
}
|
||||
|
||||
if (numPlayersUsing == 0 && lidAngle > 0.0F || numPlayersUsing > 0 && lidAngle < 1.0F) {
|
||||
@@ -83,13 +84,13 @@ public abstract class TileNaturalistChest extends TileBase implements IPagedInve
|
||||
lidAngle = Math.max(Math.min(lidAngle, 1), 0);
|
||||
|
||||
if (lidAngle < 0.5F && oldAngle >= 0.5F) {
|
||||
playLidSound("random.chestclosed");
|
||||
playLidSound(SoundEvents.BLOCK_CHEST_CLOSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void playLidSound(String sound) {
|
||||
this.worldObj.playSound(null, getPos(), SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
|
||||
private void playLidSound(SoundEvent sound) {
|
||||
this.worldObj.playSound(null, getPos(), sound, SoundCategory.BLOCKS, 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.factory.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
@@ -21,10 +23,11 @@ public class SqueezerRecipe implements ISqueezerRecipe {
|
||||
private final int processingTime;
|
||||
private final ItemStack[] resources;
|
||||
private final FluidStack fluidOutput;
|
||||
@Nullable
|
||||
private final ItemStack remnants;
|
||||
private final float remnantsChance;
|
||||
|
||||
public SqueezerRecipe(int processingTime, ItemStack[] resources, FluidStack fluidOutput, ItemStack remnants, float remnantsChance) {
|
||||
public SqueezerRecipe(int processingTime, ItemStack[] resources, FluidStack fluidOutput, @Nullable ItemStack remnants, float remnantsChance) {
|
||||
this.processingTime = processingTime;
|
||||
this.resources = resources;
|
||||
this.fluidOutput = fluidOutput;
|
||||
@@ -38,6 +41,7 @@ public class SqueezerRecipe implements ISqueezerRecipe {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ItemStack getRemnants() {
|
||||
return remnants;
|
||||
}
|
||||
|
||||
+10
-11
@@ -5,6 +5,7 @@ import java.util.Comparator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.PriorityQueue;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -22,7 +23,6 @@ import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import mezz.jei.gui.ingredients.GuiItemStackGroup;
|
||||
|
||||
public class CentrifugeRecipeCategory extends ForestryRecipeCategory {
|
||||
|
||||
@@ -41,8 +41,7 @@ public class CentrifugeRecipeCategory extends ForestryRecipeCategory {
|
||||
private final static ResourceLocation guiTexture = new ForestryResource("textures/gui/centrifugesocket.png");
|
||||
@Nonnull
|
||||
private final IDrawableAnimated arrow;
|
||||
private final ForestryTooltipCallback tooltip = new ForestryTooltipCallback();
|
||||
|
||||
|
||||
public CentrifugeRecipeCategory(IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 25, 18, 126, 54), "tile.for.centrifuge.name");
|
||||
|
||||
@@ -68,17 +67,17 @@ public class CentrifugeRecipeCategory extends ForestryRecipeCategory {
|
||||
guiItemStacks.init(inputSlot, true, 4, 18);
|
||||
guiItemStacks.setFromRecipe(inputSlot, recipeWrapper.getInputs());
|
||||
CentrifugeRecipeWrapper centrifugeWrapper = (CentrifugeRecipeWrapper) recipeWrapper;
|
||||
tooltip.clearTooltip();
|
||||
setResults(centrifugeWrapper.getRecipe().getAllProducts(), (GuiItemStackGroup) guiItemStacks);
|
||||
ForestryTooltipCallback tooltip = new ForestryTooltipCallback();
|
||||
setResults(tooltip, centrifugeWrapper.getRecipe().getAllProducts(), guiItemStacks);
|
||||
guiItemStacks.addTooltipCallback(tooltip);
|
||||
}
|
||||
|
||||
private void setResults(Map<ItemStack, Float> outputs, GuiItemStackGroup guiItemStacks) {
|
||||
private static void setResults(ForestryTooltipCallback tooltip, Map<ItemStack, Float> outputs, IGuiItemStackGroup guiItemStacks) {
|
||||
Set<Entry<ItemStack, Float>> entrySet = outputs.entrySet();
|
||||
if (entrySet.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
PriorityQueue<Entry<ItemStack, Float>> sortByChance = new PriorityQueue<>(entrySet.size(), highestChanceComparator);
|
||||
Queue<Entry<ItemStack, Float>> sortByChance = new PriorityQueue<>(entrySet.size(), highestChanceComparator);
|
||||
sortByChance.addAll(entrySet);
|
||||
|
||||
int i = 0;
|
||||
@@ -89,10 +88,10 @@ public class CentrifugeRecipeCategory extends ForestryRecipeCategory {
|
||||
}
|
||||
int x = 72 + OUTPUTS[i][0] * 18;
|
||||
int y = OUTPUTS[i][1] * 18;
|
||||
int ID = outputSlot + i;
|
||||
guiItemStacks.init(ID, false, x, y);
|
||||
guiItemStacks.set(ID, stack.getKey());
|
||||
tooltip.addChanceTooltip(ID + 1, stack.getValue());
|
||||
int slotIndex = outputSlot + i;
|
||||
guiItemStacks.init(slotIndex, false, x, y);
|
||||
guiItemStacks.set(slotIndex, stack.getKey());
|
||||
tooltip.addChanceTooltip(slotIndex, stack.getValue());
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,8 +35,7 @@ public class SqueezerRecipeCategory extends ForestryRecipeCategory {
|
||||
private final IDrawableAnimated arrow;
|
||||
@Nonnull
|
||||
private final IDrawable tankOverlay;
|
||||
private final ForestryTooltipCallback tooltip = new ForestryTooltipCallback();
|
||||
|
||||
|
||||
public SqueezerRecipeCategory(@Nonnull IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 9, 16, 158, 62), "tile.for.squeezer.name");
|
||||
|
||||
@@ -70,7 +69,7 @@ public class SqueezerRecipeCategory extends ForestryRecipeCategory {
|
||||
|
||||
guiItemStacks.init(craftOutputSlot, false, 87, 43);
|
||||
guiItemStacks.set(craftOutputSlot, wrapper.getOutputs());
|
||||
tooltip.clearTooltip();
|
||||
ForestryTooltipCallback tooltip = new ForestryTooltipCallback();
|
||||
tooltip.addChanceTooltip(craftOutputSlot, chance);
|
||||
setIngredients(guiItemStacks, wrapper.getInputs());
|
||||
|
||||
|
||||
@@ -51,16 +51,7 @@ public class SqueezerRecipeHandler<R extends ForestryRecipeWrapper> implements I
|
||||
if (wrapper.getInputs() == null || wrapper.getInputs().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
if (wrapper.getOutputs() == null || wrapper.getOutputs().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
if (wrapper.getRecipe() instanceof ISqueezerContainerRecipe) {
|
||||
ISqueezerContainerRecipe recipe = (ISqueezerContainerRecipe) wrapper.getRecipe();
|
||||
return recipe.getProcessingTime() > 0 && recipe.getRemnantsChance() > 0;
|
||||
} else {
|
||||
ISqueezerRecipe recipe = (ISqueezerRecipe) wrapper.getRecipe();
|
||||
return recipe.getProcessingTime() > 0 && recipe.getRemnantsChance() > 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,7 +34,8 @@ public class SqueezerRecipeWrapper extends AbstractSqueezerRecipeWrapper<ISqueez
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getOutputs() {
|
||||
return Collections.singletonList(getRecipe().getRemnants());
|
||||
ItemStack remnants = getRecipe().getRemnants();
|
||||
return remnants == null ? Collections.emptyList() : Collections.singletonList(remnants);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,6 +13,7 @@ package forestry.lepidopterology.commands;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.command.WrongUsageException;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.EntitySelectors;
|
||||
|
||||
import forestry.core.commands.CommandHelpers;
|
||||
import forestry.core.commands.SubCommand;
|
||||
@@ -43,10 +44,8 @@ public class CommandButterfly extends SubCommand {
|
||||
CommandHelpers.throwWrongUsage(sender, this);
|
||||
}
|
||||
|
||||
for (Object entity : sender.getEntityWorld().getLoadedEntityList()) {
|
||||
if (entity instanceof EntityButterfly) {
|
||||
((EntityButterfly) entity).setDead();
|
||||
}
|
||||
for (EntityButterfly butterfly : sender.getEntityWorld().getEntities(EntityButterfly.class, EntitySelectors.IS_ALIVE)) {
|
||||
butterfly.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -131,9 +131,11 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly
|
||||
public void writeEntityToNBT(NBTTagCompound nbttagcompound) {
|
||||
super.writeEntityToNBT(nbttagcompound);
|
||||
|
||||
NBTTagCompound bio = new NBTTagCompound();
|
||||
contained.writeToNBT(bio);
|
||||
nbttagcompound.setTag("BTFLY", bio);
|
||||
if (contained != null) {
|
||||
NBTTagCompound bio = new NBTTagCompound();
|
||||
contained.writeToNBT(bio);
|
||||
nbttagcompound.setTag("BTFLY", bio);
|
||||
}
|
||||
|
||||
if (pollen != null) {
|
||||
NBTTagCompound pln = new NBTTagCompound();
|
||||
|
||||
@@ -47,7 +47,7 @@ public class ContainerCatalogue extends Container implements IGuiSelectable, ILe
|
||||
// for display on client
|
||||
private int stationCount;
|
||||
|
||||
private boolean needsSynch = true;
|
||||
private boolean needsSync = true;
|
||||
private int currentFilter = 1;
|
||||
|
||||
private static final String[] FILTER_NAMES = new String[]{"all", "online", "offline"};
|
||||
@@ -158,7 +158,7 @@ public class ContainerCatalogue extends Container implements IGuiSelectable, ILe
|
||||
} else {
|
||||
setTradeInfo(null);
|
||||
}
|
||||
needsSynch = true;
|
||||
needsSync = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -178,7 +178,7 @@ public class ContainerCatalogue extends Container implements IGuiSelectable, ILe
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
if (needsSynch) {
|
||||
if (needsSync) {
|
||||
for (IContainerListener crafter : listeners) {
|
||||
crafter.sendProgressBarUpdate(this, 0, stationIndex);
|
||||
crafter.sendProgressBarUpdate(this, 1, stations.size());
|
||||
@@ -186,7 +186,7 @@ public class ContainerCatalogue extends Container implements IGuiSelectable, ILe
|
||||
}
|
||||
|
||||
Proxies.net.sendToPlayer(new PacketLetterInfoResponse(EnumAddressee.TRADER, currentTrade, null), player);
|
||||
needsSynch = false;
|
||||
needsSync = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,6 +225,6 @@ public class ContainerCatalogue extends Container implements IGuiSelectable, ILe
|
||||
break;
|
||||
}
|
||||
|
||||
needsSynch = true;
|
||||
needsSync = true;
|
||||
}
|
||||
}
|
||||
@@ -110,6 +110,8 @@ public class PacketLetterInfoResponse extends ForestryPacket implements IForestr
|
||||
}
|
||||
|
||||
type = EnumAddressee.fromString(data.readUTF());
|
||||
tradeInfo = null;
|
||||
address = null;
|
||||
|
||||
if (type == EnumAddressee.PLAYER) {
|
||||
if (data.readShort() < 0) {
|
||||
|
||||
@@ -97,11 +97,10 @@ public class ItemBackpack extends ItemWithGui implements IColoredItem {
|
||||
@Override
|
||||
public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
|
||||
// We only do this when shift is clicked
|
||||
if (!player.isSneaking()) {
|
||||
return EnumActionResult.FAIL;
|
||||
if (player.isSneaking()) {
|
||||
return evaluateTileHit(stack, player, world, pos, side) ? EnumActionResult.PASS : EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
return evaluateTileHit(stack, player, world, pos, side) ? EnumActionResult.PASS : EnumActionResult.FAIL;
|
||||
return super.onItemUseFirst(stack, player, world, pos, side, hitX, hitY, hitZ, hand);
|
||||
}
|
||||
|
||||
public static void tryStowing(EntityPlayer player, ItemStack backpackStack, ItemStack stack) {
|
||||
@@ -138,7 +137,7 @@ public class ItemBackpack extends ItemWithGui implements IColoredItem {
|
||||
|
||||
private static IItemHandler getInventoryHit(World world, BlockPos pos, EnumFacing side) {
|
||||
TileEntity targeted = world.getTileEntity(pos);
|
||||
return TileUtil.getInventoryFromTile(targeted, side);
|
||||
return TileUtil.getInventoryFromTile(targeted, null);
|
||||
}
|
||||
|
||||
private boolean evaluateTileHit(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side) {
|
||||
|
||||
Reference in new issue
Block a user