2017-06-29 13:00:11 +02:00
|
|
|
package de.ellpeck.actuallyadditions.mod;
|
|
|
|
|
2021-02-27 21:24:26 +01:00
|
|
|
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
|
|
|
import net.minecraft.fluid.Fluid;
|
2017-06-29 13:00:11 +02:00
|
|
|
import net.minecraft.item.ItemStack;
|
2018-06-24 02:44:47 +02:00
|
|
|
import net.minecraftforge.client.event.ModelBakeEvent;
|
2017-06-29 13:00:11 +02:00
|
|
|
import net.minecraftforge.client.event.ModelRegistryEvent;
|
2021-02-27 21:24:26 +01:00
|
|
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
2017-06-29 13:00:11 +02:00
|
|
|
|
2021-02-26 22:15:48 +01:00
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map;
|
|
|
|
|
2021-02-27 21:24:26 +01:00
|
|
|
/**
|
|
|
|
* TODO: [port] eval all of this class
|
|
|
|
*/
|
2019-05-02 09:10:29 +02:00
|
|
|
public class ClientRegistryHandler {
|
2017-06-29 13:00:11 +02:00
|
|
|
|
2019-02-27 19:53:05 +01:00
|
|
|
public static final Map<ItemStack, ModelResourceLocation> MODEL_LOCATIONS_FOR_REGISTERING = new HashMap<>();
|
2017-06-29 13:00:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* (Excerpted from Tinkers' Construct with permission, thanks guys!)
|
|
|
|
*/
|
2019-05-02 09:10:29 +02:00
|
|
|
private static void registerCustomFluidBlockRenderer(Fluid fluid) {
|
2021-02-27 21:24:26 +01:00
|
|
|
// Block block = fluid.getBlock();
|
|
|
|
// Item item = Item.getItemFromBlock(block);
|
|
|
|
// FluidStateMapper mapper = new FluidStateMapper(fluid);
|
|
|
|
// ModelBakery.registerItemVariants(item);
|
|
|
|
// ModelLoader.setCustomMeshDefinition(item, mapper);
|
|
|
|
// ModelLoader.setCustomStateMapper(block, mapper);
|
2017-06-29 13:00:11 +02:00
|
|
|
}
|
2017-06-29 18:36:33 +02:00
|
|
|
|
|
|
|
@SubscribeEvent
|
2019-05-02 09:10:29 +02:00
|
|
|
public void onModelRegistry(ModelRegistryEvent event) {
|
2021-02-27 21:24:26 +01:00
|
|
|
// for (Block block : RegistryHandler.BLOCKS_TO_REGISTER) {
|
|
|
|
// if (block instanceof IHasModel) {
|
|
|
|
// ((IHasModel) block).registerRendering();
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// for (Map.Entry<ItemStack, ModelResourceLocation> entry : MODEL_LOCATIONS_FOR_REGISTERING.entrySet()) {
|
|
|
|
// ModelLoader.setCustomModelResourceLocation(entry.getKey().getItem(), entry.getKey().getItemDamage(), entry.getValue());
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// registerCustomFluidBlockRenderer(InitFluids.fluidCanolaOil);
|
|
|
|
// registerCustomFluidBlockRenderer(InitFluids.fluidRefinedCanolaOil);
|
|
|
|
// registerCustomFluidBlockRenderer(InitFluids.fluidCrystalOil);
|
|
|
|
// registerCustomFluidBlockRenderer(InitFluids.fluidEmpoweredOil);
|
2017-06-29 18:36:33 +02:00
|
|
|
}
|
2019-02-27 19:53:05 +01:00
|
|
|
|
2018-06-24 02:44:47 +02:00
|
|
|
@SubscribeEvent
|
|
|
|
public void onModelBake(ModelBakeEvent e) {
|
2021-02-27 21:24:26 +01:00
|
|
|
// ModelResourceLocation mrl = new ModelResourceLocation(new ResourceLocation(ActuallyAdditions.MODID, "block_compost"), "normal");
|
|
|
|
// CompostModel.compostBase = e.getModelRegistry().getObject(mrl);
|
|
|
|
// e.getModelRegistry().putObject(mrl, new ActualCompostModel());
|
2018-06-24 02:44:47 +02:00
|
|
|
}
|
2017-06-29 13:00:11 +02:00
|
|
|
}
|