Now with 50% less json file, and fixes
This commit is contained in:
parent
61c7815f3b
commit
eca6144c66
93 changed files with 2406 additions and 1877 deletions
|
@ -1,14 +1,24 @@
|
|||
package techreborn.proxies;
|
||||
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import net.minecraftforge.fml.client.registry.IRenderFactory;
|
||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameData;
|
||||
import reborncore.RebornCore;
|
||||
import reborncore.client.multiblock.MultiblockRenderEvent;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import techreborn.client.ClientMultiBlocks;
|
||||
import techreborn.client.IconSupplier;
|
||||
import techreborn.client.RegisterItemJsons;
|
||||
|
@ -44,6 +54,13 @@ public class ClientProxy extends CommonProxy
|
|||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
|
||||
for(Object object : RebornCore.jsonDestroyer.objectsToDestroy) {
|
||||
if (object instanceof BlockMachineBase) {
|
||||
BlockMachineBase base = (BlockMachineBase) object;
|
||||
registerItemModel(Item.getItemFromBlock(base));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -60,6 +77,45 @@ public class ClientProxy extends CommonProxy
|
|||
// TODO FIX ME
|
||||
ClientRegistry.registerKeyBinding(KeyBindings.config);
|
||||
ClientMultiBlocks.init();
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void registerItemModel(ItemStack item, String name) {
|
||||
// tell Minecraft which textures it has to load. This is resource-domain sensitive
|
||||
ModelLoader.registerItemVariants(item.getItem(), new ResourceLocation(name));
|
||||
// tell the game which model to use for this item-meta combination
|
||||
ModelLoader.setCustomModelResourceLocation(item.getItem(), item
|
||||
.getMetadata(), new ModelResourceLocation(name, "inventory"));
|
||||
}
|
||||
|
||||
public ResourceLocation registerItemModel(Item item) {
|
||||
ResourceLocation itemLocation = getItemLocation(item);
|
||||
if(itemLocation == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return registerIt(item, itemLocation);
|
||||
}
|
||||
|
||||
public static ResourceLocation getItemLocation(Item item) {
|
||||
Object o = GameData.getItemRegistry().getNameForObject(item);
|
||||
if(o == null) {
|
||||
return null;
|
||||
}
|
||||
return (ResourceLocation) o;
|
||||
}
|
||||
|
||||
private static ResourceLocation registerIt(Item item, final ResourceLocation location) {
|
||||
ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() {
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(ItemStack stack) {
|
||||
return new ModelResourceLocation(location, "inventory");
|
||||
}
|
||||
});
|
||||
ModelLoader.registerItemVariants(item, location);
|
||||
|
||||
return location;
|
||||
}
|
||||
|
||||
public class RenderManagerNuke implements IRenderFactory<EntityNukePrimed>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue