2015-08-29 14:33:25 +02:00
|
|
|
/*
|
2016-05-16 22:52:27 +02:00
|
|
|
* This file ("ClientProxy.java") is part of the Actually Additions mod for Minecraft.
|
2015-08-29 14:33:25 +02:00
|
|
|
* It is created and owned by Ellpeck and distributed
|
|
|
|
* under the Actually Additions License to be found at
|
2016-05-16 22:52:27 +02:00
|
|
|
* http://ellpeck.de/actaddlicense
|
2015-08-29 14:33:25 +02:00
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
2017-01-01 16:23:26 +01:00
|
|
|
* © 2015-2017 Ellpeck
|
2015-08-29 14:33:25 +02:00
|
|
|
*/
|
|
|
|
|
2016-01-05 04:47:35 +01:00
|
|
|
package de.ellpeck.actuallyadditions.mod.proxy;
|
2014-12-03 21:55:53 +01:00
|
|
|
|
2015-02-20 22:45:33 +01:00
|
|
|
|
2017-06-29 13:00:11 +02:00
|
|
|
import de.ellpeck.actuallyadditions.mod.ClientRegistryHandler;
|
2017-06-29 18:36:33 +02:00
|
|
|
import de.ellpeck.actuallyadditions.mod.blocks.render.*;
|
2016-07-22 20:23:51 +02:00
|
|
|
import de.ellpeck.actuallyadditions.mod.entity.InitEntities;
|
2017-07-07 22:09:56 +02:00
|
|
|
import de.ellpeck.actuallyadditions.mod.entity.RenderWorm;
|
2016-07-03 20:57:00 +02:00
|
|
|
import de.ellpeck.actuallyadditions.mod.event.ClientEvents;
|
2016-01-05 04:47:35 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.misc.special.SpecialRenderInit;
|
2017-06-29 18:36:33 +02:00
|
|
|
import de.ellpeck.actuallyadditions.mod.tile.*;
|
2017-02-13 23:17:08 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.util.IColorProvidingBlock;
|
2016-03-19 15:10:20 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
|
2016-01-05 04:47:35 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
2016-01-10 01:17:17 +01:00
|
|
|
import net.minecraft.block.Block;
|
2015-09-22 23:32:19 +02:00
|
|
|
import net.minecraft.client.Minecraft;
|
2016-03-18 23:47:22 +01:00
|
|
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
2016-11-08 08:53:30 +01:00
|
|
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
2016-11-27 21:53:16 +01:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2016-01-08 16:52:53 +01:00
|
|
|
import net.minecraft.item.Item;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2016-06-01 00:37:28 +02:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
2017-06-29 13:00:11 +02:00
|
|
|
import net.minecraftforge.common.MinecraftForge;
|
2016-02-17 21:45:19 +01:00
|
|
|
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
2016-01-07 18:20:59 +01:00
|
|
|
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
|
|
|
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
|
|
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
2016-11-16 20:31:16 +01:00
|
|
|
|
2017-06-29 18:36:33 +02:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
2014-12-03 21:55:53 +01:00
|
|
|
public class ClientProxy implements IProxy{
|
|
|
|
|
2016-06-01 00:39:35 +02:00
|
|
|
private static final List<Item> COLOR_PRODIVIDING_ITEMS_FOR_REGISTERING = new ArrayList<Item>();
|
2017-02-13 23:17:08 +01:00
|
|
|
private static final List<Block> COLOR_PRODIVIDING_BLOCKS_FOR_REGISTERING = new ArrayList<Block>();
|
2016-12-18 17:50:31 +01:00
|
|
|
|
2015-02-20 22:45:33 +01:00
|
|
|
@Override
|
2015-08-30 19:10:10 +02:00
|
|
|
public void preInit(FMLPreInitializationEvent event){
|
2015-07-01 21:32:48 +02:00
|
|
|
ModUtil.LOGGER.info("PreInitializing ClientProxy...");
|
2015-06-15 22:06:07 +02:00
|
|
|
|
2017-06-29 13:00:11 +02:00
|
|
|
MinecraftForge.EVENT_BUS.register(new ClientRegistryHandler());
|
2016-01-16 23:14:10 +01:00
|
|
|
|
2016-07-22 20:23:51 +02:00
|
|
|
InitEntities.initClient();
|
2016-01-10 01:17:17 +01:00
|
|
|
}
|
|
|
|
|
2015-02-20 22:45:33 +01:00
|
|
|
@Override
|
2015-08-30 19:10:10 +02:00
|
|
|
public void init(FMLInitializationEvent event){
|
2015-07-01 21:32:48 +02:00
|
|
|
ModUtil.LOGGER.info("Initializing ClientProxy...");
|
2015-03-30 18:42:14 +02:00
|
|
|
|
2017-07-07 22:09:56 +02:00
|
|
|
RenderWorm.fixItemStack();
|
|
|
|
|
2016-07-03 20:57:00 +02:00
|
|
|
new ClientEvents();
|
2015-09-02 20:06:34 +02:00
|
|
|
|
2016-02-20 15:23:03 +01:00
|
|
|
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCompost.class, new RenderCompost());
|
2016-02-17 21:45:19 +01:00
|
|
|
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAtomicReconstructor.class, new RenderReconstructorLens());
|
|
|
|
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySmileyCloud.class, new RenderSmileyCloud());
|
2016-06-06 21:27:09 +02:00
|
|
|
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDisplayStand.class, new RenderDisplayStand());
|
2016-08-03 04:01:47 +02:00
|
|
|
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityEmpowerer.class, new RenderEmpowerer());
|
2016-12-18 17:28:29 +01:00
|
|
|
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBatteryBox.class, new RenderBatteryBox());
|
2016-02-17 21:45:19 +01:00
|
|
|
|
2017-07-28 03:17:50 +02:00
|
|
|
TileEntitySpecialRenderer<TileEntityLaserRelay> laser = new RenderLaserRelay();
|
2016-11-08 08:53:30 +01:00
|
|
|
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLaserRelayEnergy.class, laser);
|
|
|
|
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLaserRelayEnergyAdvanced.class, laser);
|
|
|
|
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLaserRelayEnergyExtreme.class, laser);
|
|
|
|
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLaserRelayItem.class, laser);
|
|
|
|
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLaserRelayItemWhitelist.class, laser);
|
|
|
|
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLaserRelayFluids.class, laser);
|
|
|
|
|
2016-05-26 22:49:47 +02:00
|
|
|
for(Item item : COLOR_PRODIVIDING_ITEMS_FOR_REGISTERING){
|
2016-03-19 15:10:20 +01:00
|
|
|
if(item instanceof IColorProvidingItem){
|
2017-02-13 23:17:08 +01:00
|
|
|
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(((IColorProvidingItem)item).getItemColor(), item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for(Block block : COLOR_PRODIVIDING_BLOCKS_FOR_REGISTERING){
|
|
|
|
if(block instanceof IColorProvidingBlock){
|
|
|
|
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(((IColorProvidingBlock)block).getBlockColor(), block);
|
|
|
|
}
|
|
|
|
if(block instanceof IColorProvidingItem){
|
|
|
|
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(((IColorProvidingItem)block).getItemColor(), block);
|
2016-03-19 15:10:20 +01:00
|
|
|
}
|
2016-01-08 16:52:53 +01:00
|
|
|
}
|
2014-12-03 21:55:53 +01:00
|
|
|
}
|
|
|
|
|
2015-02-20 22:45:33 +01:00
|
|
|
@Override
|
2015-08-30 19:10:10 +02:00
|
|
|
public void postInit(FMLPostInitializationEvent event){
|
2015-07-01 21:32:48 +02:00
|
|
|
ModUtil.LOGGER.info("PostInitializing ClientProxy...");
|
2015-11-02 22:37:44 +01:00
|
|
|
|
2016-07-03 20:57:00 +02:00
|
|
|
new SpecialRenderInit();
|
2014-12-03 21:55:53 +01:00
|
|
|
}
|
2015-11-13 18:56:15 +01:00
|
|
|
|
2016-01-08 20:51:03 +01:00
|
|
|
@Override
|
2016-06-01 00:37:28 +02:00
|
|
|
public void addRenderRegister(ItemStack stack, ResourceLocation location, String variant){
|
2017-06-29 13:00:11 +02:00
|
|
|
ClientRegistryHandler.MODEL_LOCATIONS_FOR_REGISTERING.put(stack, new ModelResourceLocation(location, variant));
|
2016-01-08 20:51:03 +01:00
|
|
|
}
|
|
|
|
|
2016-03-19 15:10:20 +01:00
|
|
|
@Override
|
|
|
|
public void addColoredItem(Item item){
|
2016-05-26 22:49:47 +02:00
|
|
|
COLOR_PRODIVIDING_ITEMS_FOR_REGISTERING.add(item);
|
2016-03-19 15:10:20 +01:00
|
|
|
}
|
2016-11-27 21:53:16 +01:00
|
|
|
|
2017-02-13 23:17:08 +01:00
|
|
|
@Override
|
|
|
|
public void addColoredBlock(Block block){
|
|
|
|
COLOR_PRODIVIDING_BLOCKS_FOR_REGISTERING.add(block);
|
|
|
|
}
|
|
|
|
|
2016-11-27 21:53:16 +01:00
|
|
|
@Override
|
|
|
|
public EntityPlayer getCurrentPlayer(){
|
|
|
|
return Minecraft.getMinecraft().player;
|
|
|
|
}
|
2014-12-03 21:55:53 +01:00
|
|
|
}
|