Skip to content

Commit

Permalink
Fix potential crashes when supplying power to arc furnace or excavato…
Browse files Browse the repository at this point in the history
…r with other mod's cables, closes #5716
  • Loading branch information
BluSunrize committed Oct 3, 2023
1 parent c54bd20 commit ba03c4b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
##### Version 1.19.4-9.4.1-pre
- All features from 9.2.3
- Fix localization of perks on revolver parts (BluSunrize)
- Fix potential crashes when supplying power to arc furnace or excavator with other mod's cables (BluSunrize)

##### Version 1.19.2-9.2.3-167
- Change "Superior Weaponry" advancement to hint at its potential to spawn new illagers in raids (BluSunrize)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.IEnergyStorage;
Expand Down Expand Up @@ -313,7 +314,7 @@ private boolean fillBucket(
@Override
public <T> LazyOptional<T> getCapability(IMultiblockContext<State> ctx, CapabilityPosition position, Capability<T> cap)
{
if(position.side()==null||ENERGY_INPUTS.contains(position))
if(cap==ForgeCapabilities.ENERGY&&(position.side()==null||ENERGY_INPUTS.contains(position)))
return ctx.getState().energyCap.cast(ctx);
return LazyOptional.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public <T> LazyOptional<T> getCapability(
{
final State state = ctx.getState();
final BlockPos posInMultiblock = position.posInMultiblock();
if(position.side()==null||(posInMultiblock.getY()==1&&(posInMultiblock.getX()+posInMultiblock.getZ())%2==1))
if(cap==ForgeCapabilities.ENERGY&&(position.side()==null||(posInMultiblock.getY()==1&&(posInMultiblock.getX()+posInMultiblock.getZ())%2==1)))
return ForgeCapabilities.ENERGY.orEmpty(cap, state.energyCap.get(ctx));
else
return LazyOptional.empty();
Expand Down

0 comments on commit ba03c4b

Please sign in to comment.