use of com.lowdragmc.multiblocked.api.tile.ControllerTileTesterEntity in project Multiblocked by Low-Drag-MC.
the class PredicateComponent method buildPredicate.
@Override
public SimplePredicate buildPredicate() {
predicate = state -> {
TileEntity tileEntity = state.getTileEntity();
if (tileEntity instanceof IComponent) {
return ((IComponent) tileEntity).getDefinition().location.equals(location);
}
return false;
};
candidates = () -> {
if (MbdComponents.COMPONENT_BLOCKS_REGISTRY.containsKey(location)) {
return new BlockInfo[] { new BlockInfo(MbdComponents.COMPONENT_BLOCKS_REGISTRY.get(location).defaultBlockState(), MbdComponents.DEFINITION_REGISTRY.get(location).createNewTileEntity()) };
} else {
if (definition == null)
return new BlockInfo[0];
if (definition instanceof ControllerDefinition) {
ControllerTileTesterEntity te = new ControllerTileTesterEntity(ControllerTileTesterEntity.DEFAULT_DEFINITION);
te.setDefinition((ControllerDefinition) definition);
return new BlockInfo[] { new BlockInfo(MbdComponents.COMPONENT_BLOCKS_REGISTRY.get(ControllerTileTesterEntity.DEFAULT_DEFINITION.location).defaultBlockState(), te) };
} else {
DummyComponentTileEntity te = new DummyComponentTileEntity(MbdComponents.DummyComponentBlock.definition);
te.setDefinition(definition);
return new BlockInfo[] { new BlockInfo(MbdComponents.DummyComponentBlock.defaultBlockState(), te) };
}
}
};
return this;
}
Aggregations