Open bzy-xyz opened 6 years ago
Ok, so I don't understand why the GregBlockUtils SteamPump
implements hasCapability
and getCapability
in such a way that hasCapability
can return true
but getCapability
returns null
.
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing side) {
return (side == null || side.getAxis() != EnumFacing.Axis.Y) && super.hasCapability(capability, side);
}
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing side) {
return (side == null || side.getAxis() == EnumFacing.Axis.Y) ? null : super.getCapability(capability, side);
}
Consider what happens when something requests the ITEM_HANDLER_CAPABILITY
for side null
, as FindMe does. Since the SteamPump
has an "inventory" of size 2, GregTechCE's MetaTileEntity
happily reports that the SteamPump
has the capability, but the SteamPump
's getCapability
will return null
on account of the requested side
being null
.
This seems like the source of the behaviour I'm observing.
When invoking FindMe within search range of a Steam Pump a NullPointerException is thrown. Additionally, no particle effects are produced.