Add a temporary (?) method to register the TileEntities because the Forge method changed from 1.10 to 1.11.2.
This commit is contained in:
@@ -61,6 +61,7 @@ import net.minecraft.stats.Achievement;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityChest;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
@@ -76,6 +77,8 @@ import net.minecraftforge.common.util.FakePlayerFactory;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.common.registry.GameData;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
@@ -1818,4 +1821,24 @@ public class Platform
|
||||
|
||||
return isPurified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Added because the internal Forge GameRegistry method changed a bit
|
||||
* @param tileEntityClass
|
||||
* @param id
|
||||
* @param alternatives
|
||||
*/
|
||||
public static void registerTileEntityWithAlternatives(Class<? extends TileEntity> tileEntityClass, String id, String... alternatives)
|
||||
{
|
||||
ResourceLocation rloc = GameData.getTileEntityRegistry().getNameForObject(tileEntityClass);
|
||||
|
||||
/**
|
||||
* If there's no mention of said TE in the registry, add it, otherwise add the aliases.
|
||||
*/
|
||||
if(rloc == null) {
|
||||
GameRegistry.registerTileEntityWithAlternatives( tileEntityClass, AppEng.MOD_ID.toLowerCase() + ":" + id, id );
|
||||
} else {
|
||||
GameData.getTileEntityRegistry().addLegacyName(new ResourceLocation(id), new ResourceLocation(AppEng.MOD_ID.toLowerCase() + ":" + id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user