use of pl.asie.simplelogic.gates.PartGate in project Charset by CharsetMC.
the class MCMPAddonGates method onAttachCaps.
@SubscribeEvent
public void onAttachCaps(AttachCapabilitiesEvent<TileEntity> event) {
if (event.getObject() instanceof PartGate) {
final PartGate gate = (PartGate) event.getObject();
final IMultipartTile mpartTile = new MultipartTile<>(gate);
event.addCapability(LOC, new ICapabilityProvider() {
@Override
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
return capability == MCMPCapabilities.MULTIPART_TILE;
}
@Nullable
@Override
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
return capability == MCMPCapabilities.MULTIPART_TILE ? MCMPCapabilities.MULTIPART_TILE.cast(mpartTile) : null;
}
});
}
}
Aggregations