Fixed Mineral Melting Furnace fluid extraction (#223).

This commit is contained in:
stfwi 2022-08-07 10:04:21 +02:00
parent 3b994ec5ef
commit 7e493564de
5 changed files with 33 additions and 19 deletions

View file

@ -7,4 +7,4 @@ meta_download=https://www.curseforge.com/minecraft/mc-mods/engineers-decor/
version_minecraft=1.19.1
version_forge_minecraft=1.19.1-42.0.1
version_jei=11.0.0.206
version_engineersdecor=1.2.25
version_engineersdecor=1.2.26

View file

@ -1,6 +1,7 @@
{
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
"1.19.1": {
"1.2.26": "[F] Fixed Mineral Melting Furnace fluid extraction (issue #223, ty adkinss).",
"1.2.25": "[U] Ported to 1.19.1.",
"1.1.24": "[U] Forge updated to 1.19-41.1.0.\n[B] Known issue: JEI integration missing.",
"1.1.24-b1": "[U] Initial 1.19 port.\n[D] Metal/Treated Wood Crafting Table dropped in favour of IE Engineer's Crafting Table.\n[D] Labeled Crate dropped.\n[D] Obsolete wood blocks dropped.",
@ -60,7 +61,7 @@
"1.1.2-b1": "[U] Ported to MC1.16.2."
},
"promos": {
"1.19.1-recommended": "1.2.25",
"1.19.1-latest": "1.2.25"
"1.19.1-recommended": "1.2.26",
"1.19.1-latest": "1.2.26"
}
}

View file

@ -11,6 +11,8 @@ Mod sources for Minecraft version 1.18.x.
## Version history
- v1.2.26 [F] Fixed Mineral Melting Furnace fluid extraction (issue #223, ty adkinss).
- v1.2.25 [U] Ported to 1.19.1.
- v1.1.24 [U] Forge updated to 1.19-41.1.0.

View file

@ -477,18 +477,23 @@ public class EdMineralSmelter
level.playSound(null, worldPosition, SoundEvents.LAVA_EXTINGUISH, SoundSource.BLOCKS, 0.3f, 0.7f);
}
}
} else if((phase()==PHASE_LAVA) && (tank_.getFluidAmount()>0)) {
// Phase unchanged, fluid transfer check.
FluidStack fs = tank_.getFluid().copy();
if(fs.getAmount() > 100) fs.setAmount(100);
final int n = Fluidics.fill(level, getBlockPos().below(), Direction.UP, fs);
if(n > 0) {
tank_.drain(n);
if(tank_.isEmpty()) {
final ItemStack prev = main_inventory_.getItem(0);
reset_process();
main_inventory_.setItem(0, prev);
level.playSound(null, worldPosition, SoundEvents.LAVA_EXTINGUISH, SoundSource.BLOCKS, 0.3f, 0.7f);
} else if(phase()>=PHASE_LAVA) {
if(tank_.getFluidAmount()<=0) {
reset_process();
level.playSound(null, worldPosition, SoundEvents.LAVA_EXTINGUISH, SoundSource.BLOCKS, 0.3f, 0.7f);
} else {
// Phase unchanged, fluid transfer check.
FluidStack fs = tank_.getFluid().copy();
if(fs.getAmount() > 100) fs.setAmount(100);
final int n = Fluidics.fill(level, getBlockPos().below(), Direction.UP, fs);
if(n > 0) {
tank_.drain(n);
if(tank_.isEmpty()) {
final ItemStack prev = main_inventory_.getItem(0);
reset_process();
main_inventory_.setItem(0, prev);
level.playSound(null, worldPosition, SoundEvents.LAVA_EXTINGUISH, SoundSource.BLOCKS, 0.3f, 0.7f);
}
}
}
}

View file

@ -72,14 +72,20 @@ public class Inventories
return (entity==null) ? (null) : (itemhandler(entity,side));
}
public static IItemHandler itemhandler(Entity entity)
{ return (entity instanceof Container) ? (new InvWrapper((Container)entity)) : null; }
public static IItemHandler itemhandler(Player player)
{ return new PlayerMainInvWrapper(player.getInventory()); }
public static IItemHandler itemhandler(Entity entity)
{ return itemhandler(entity, null); }
public static IItemHandler itemhandler(Entity entity, @Nullable Direction side)
{ return (entity instanceof Container) ? (new InvWrapper((Container)entity)) : null; }
{
if(entity==null) return null;
final IItemHandler ih = entity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side).orElse(null);
if(ih!=null) return ih;
if(entity instanceof Container container) return (new InvWrapper(container));
return null;
}
public static boolean insertionPossible(Level world, BlockPos pos, @Nullable Direction side, boolean including_entities)
{ return itemhandler(world, pos, side, including_entities) != null; }