Hotfix issue #174 (E-Furnace inventory pulling from Storage Drawers).

This commit is contained in:
stfwi 2021-04-17 08:29:57 +02:00
parent bed43ef505
commit 88acdcae12
5 changed files with 13 additions and 21 deletions

View file

@ -5,4 +5,4 @@ version_minecraft=1.16.4
version_forge_minecraft=1.16.4-35.1.10 version_forge_minecraft=1.16.4-35.1.10
version_fml_mappings=20201028-1.16.3 version_fml_mappings=20201028-1.16.3
version_jei=1.16.4:7.6.1.63 version_jei=1.16.4:7.6.1.63
version_engineersdecor=1.1.12 version_engineersdecor=1.1.13-b1

View file

@ -1,6 +1,7 @@
{ {
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/", "homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
"1.16.4": { "1.16.4": {
"1.1.13-b1": "[F] Hotfix Electrical Furnace inventory import from Storage Drawers (issue #174, ty anto-fire/IchigoGames).",
"1.1.12": "[F] Chisels&Bits compatibility addressed (issue #172, ty rodg88).\n[F] Labeled Crate drop list made stateless (issue #173, ty HopsandBarley && Harmonised).", "1.1.12": "[F] Chisels&Bits compatibility addressed (issue #172, ty rodg88).\n[F] Labeled Crate drop list made stateless (issue #173, ty HopsandBarley && Harmonised).",
"1.1.11": "[F] Fixed Window placement dupe (issue #170, ty NillerMedDild).", "1.1.11": "[F] Fixed Window placement dupe (issue #170, ty NillerMedDild).",
"1.1.10": "[A] Added Small Lab Furnace config for accepted speed-boost heaters (PR#165, ty mrh0).\n[F] Fixed Labeled Crate mouse scrolling crash (issue #169, ty vaelzan).", "1.1.10": "[A] Added Small Lab Furnace config for accepted speed-boost heaters (PR#165, ty mrh0).\n[F] Fixed Labeled Crate mouse scrolling crash (issue #169, ty vaelzan).",
@ -33,6 +34,6 @@
}, },
"promos": { "promos": {
"1.16.4-recommended": "1.1.12", "1.16.4-recommended": "1.1.12",
"1.16.4-latest": "1.1.12" "1.16.4-latest": "1.1.13-b1"
} }
} }

View file

@ -11,6 +11,8 @@ Mod sources for Minecraft version 1.16.x.
## Version history ## Version history
- v1.1.13-b1 [F] Hotfix Electrical Furnace inventory import from Storage Drawers (issue #174, ty anto-fire/IchigoGames).
- v1.1.12 [F] Chisels&Bits compatibility addressed (issue #172, ty rodg88). - v1.1.12 [F] Chisels&Bits compatibility addressed (issue #172, ty rodg88).
[F] Labeled Crate drop list made stateless (issue #173, ty HopsandBarley && Harmonised). [F] Labeled Crate drop list made stateless (issue #173, ty HopsandBarley && Harmonised).

View file

@ -453,24 +453,13 @@ public class EdElectricalFurnace
} }
if(with_automatic_inventory_pulling_ || is_accepted_hopper(inventory_.getStackInSlot(SMELTING_AUX_SLOT_NO))) { if(with_automatic_inventory_pulling_ || is_accepted_hopper(inventory_.getStackInSlot(SMELTING_AUX_SLOT_NO))) {
final Direction inp_facing = state.get(ElectricalFurnaceBlock.HORIZONTAL_FACING).getOpposite(); final Direction inp_facing = state.get(ElectricalFurnaceBlock.HORIZONTAL_FACING).getOpposite();
if(inp && (inventory_.getStackInSlot(FIFO_INPUT_1_SLOT_NO).isEmpty())) { if(inp && (inventory_.getStackInSlot(FIFO_INPUT_1_SLOT_NO).isEmpty()) && (battery_.getEnergyStored() >= transfer_energy_consumption_)) {
TileEntity te = world.getTileEntity(pos.offset(inp_facing)); final int max_count = MathHelper.clamp((transfer_energy_consumption_ <= 0) ? (64) : (battery_.getEnergyStored()/transfer_energy_consumption_), 1, 64);
if(te!=null) { final ItemStack retrieved = Inventories.extract(Inventories.itemhandler(world, pos.offset(inp_facing), inp_facing), null, max_count, false);
IItemHandler hnd = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, inp_facing).orElse(null); if(!retrieved.isEmpty()) {
if(hnd != null) { inventory_.setInventorySlotContents(FIFO_INPUT_1_SLOT_NO, retrieved);
for(int i=0; i< hnd.getSlots(); ++i) { battery_.draw(max_count * transfer_energy_consumption_);
ItemStack adj_stack = hnd.getStackInSlot(i); dirty = true;
if(!adj_stack.isEmpty()) {
ItemStack my_stack = adj_stack.copy();
if(my_stack.getCount() > inventory_.getInventoryStackLimit()) my_stack.setCount(inventory_.getInventoryStackLimit());
adj_stack.shrink(my_stack.getCount());
inventory_.setInventorySlotContents(FIFO_INPUT_1_SLOT_NO, my_stack);
battery_.draw(transfer_energy_consumption_);
dirty = true;
break;
}
}
}
} }
} }
} }

View file

@ -86,7 +86,7 @@ public class Inventories
public static ItemStack insert(World world, BlockPos pos, @Nullable Direction side, ItemStack stack, boolean simulate) public static ItemStack insert(World world, BlockPos pos, @Nullable Direction side, ItemStack stack, boolean simulate)
{ return insert(world.getTileEntity(pos), side, stack, simulate); } { return insert(world.getTileEntity(pos), side, stack, simulate); }
public static ItemStack extract(IItemHandler inventory, @Nullable ItemStack match, int amount, boolean simulate) public static ItemStack extract(@Nullable IItemHandler inventory, @Nullable ItemStack match, int amount, boolean simulate)
{ {
if((inventory==null) || (amount<=0)) return ItemStack.EMPTY; if((inventory==null) || (amount<=0)) return ItemStack.EMPTY;
final int max = inventory.getSlots(); final int max = inventory.getSlots();