Fix #1183 Portable alyzer, Fix #1185 Infuser GUI crash and Fix #1187 Crash when trying to break farm block

This commit is contained in:
Nedelosk committed 2016-05-17 16:16:39 +02:00
1 parent 828f91f894
commit afb3ee56dd
4 files changed
+16 -4

No files matched your search

@@ -53,7 +53,7 @@ public abstract class ContainerItemInventory<I extends ItemInventory> extends Co
@Override
public ItemStack slotClick(int slotId, int dragType_or_button, ClickType clickTypeIn, EntityPlayer player) {
ItemStack result = super.slotClick(slotId, dragType_or_button, clickTypeIn, player);
if(slotId != -999){
if(slotId > 0){
inventory.onSlotClick(inventorySlots.get(slotId).getSlotIndex(), player);
}
return result;
@@ -58,6 +58,18 @@ public class ItemInventoryAlyzer extends ItemInventory implements IErrorSource,
return alyzer.canSlotAccept(this, slotIndex, itemStack);
}
@Override
public void setInventorySlotContents(int slotIndex, ItemStack itemStack) {
if(!hasSpecimen() && slotIndex == SLOT_SPECIMEN){
ItemStack ersatz = GeneticsUtil.convertSaplingToGeneticEquivalent(itemStack);
if(ersatz != null){
super.setInventorySlotContents(slotIndex, ersatz);
return;
}
}
super.setInventorySlotContents(slotIndex, itemStack);
}
@Override
public void onSlotClick(int slotIndex, EntityPlayer player) {
ISpeciesRoot speciesRoot;
@@ -11,8 +11,6 @@
package forestry.core.items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.oredict.OreDictionary;
import forestry.api.core.Tabs;
@@ -43,9 +43,11 @@ public class ModelFarmBlock extends ModelBlockDefault<BlockFarm> {
TileFarm farm = TileUtil.getTile(world, pos, TileFarm.class);
EnumFarmBlockTexture texture = EnumFarmBlockTexture.BRICK;
TextureAtlasSprite[] overlayTextures = getOverlaySprites(EnumFarmBlockType.PLAIN);
if(farm != null){
texture = farm.getFarmBlockTexture();
overlayTextures = getOverlaySprites(farm.getFarmBlockType());
}
TextureAtlasSprite[] textures = getSprites(texture);
@@ -53,7 +55,7 @@ public class ModelFarmBlock extends ModelBlockDefault<BlockFarm> {
// Add the plain block.
baker.addBlockModel(blockFarm, Block.FULL_BLOCK_AABB, pos, textures, 0);
// Add the overlay block.
baker.addBlockModel(blockFarm, Block.FULL_BLOCK_AABB, pos, getOverlaySprites(farm.getFarmBlockType()), 0);
baker.addBlockModel(blockFarm, Block.FULL_BLOCK_AABB, pos, overlayTextures, 0);
// Set the particle sprite
baker.setParticleSprite(textures[0]);