use of org.spongepowered.api.block.tileentity.TileEntityType in project SpongeCommon by SpongePowered.
the class TileEntityTypeRegistryModule method doTileEntityRegistration.
@SuppressWarnings("unchecked")
public void doTileEntityRegistration(Class<?> clazz, String name) {
final String id = TileEntityTypeRegistryModule.getInstance().getIdForName(name);
boolean canTick = true;
try {
if (ITickable.class.isAssignableFrom(clazz)) {
String mapping = SpongeImplHooks.isDeobfuscatedEnvironment() ? "update" : "func_73660_a";
Class<?> declaringClazz = clazz.getMethod(mapping).getDeclaringClass();
if (declaringClazz.equals(TileEntityChest.class) || declaringClazz.equals(TileEntityEnderChest.class)) {
canTick = false;
}
}
} catch (Throwable e) {
// ignore
}
final String modId = SpongeImplHooks.getModIdFromClass(clazz);
final String tileId = modId + ":" + id;
final TileEntityType tileEntityType = new SpongeTileEntityType((Class<? extends org.spongepowered.api.block.tileentity.TileEntity>) clazz, name, tileId, canTick, modId);
TileEntityTypeRegistryModule.getInstance().registerAdditionalCatalog(tileEntityType);
}
Aggregations