2019-12-31 02:43:52 +01:00
|
|
|
package com.progwml6.ironchest.client.tileentity;
|
|
|
|
|
|
|
|
|
|
import com.progwml6.ironchest.IronChests;
|
|
|
|
|
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
|
|
|
|
import net.minecraft.client.renderer.Atlases;
|
|
|
|
|
import net.minecraft.client.renderer.model.Material;
|
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
|
|
|
import net.minecraft.util.ResourceLocation;
|
2020-01-22 23:53:24 +01:00
|
|
|
import net.minecraftforge.api.distmarker.Dist;
|
|
|
|
|
import net.minecraftforge.client.event.TextureStitchEvent;
|
|
|
|
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
|
|
|
|
import net.minecraftforge.fml.common.Mod;
|
2019-12-31 02:43:52 +01:00
|
|
|
|
|
|
|
|
import java.util.function.Consumer;
|
|
|
|
|
|
2020-01-22 23:53:24 +01:00
|
|
|
@Mod.EventBusSubscriber(modid = IronChests.MODID, value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
|
2019-12-31 02:43:52 +01:00
|
|
|
public class IronChestsModels {
|
|
|
|
|
|
2020-03-10 22:00:20 +01:00
|
|
|
public static final ResourceLocation IRON_CHEST_LOCATION = new ResourceLocation(IronChests.MODID, "model/iron_chest");
|
|
|
|
|
public static final ResourceLocation GOLD_CHEST_LOCATION = new ResourceLocation(IronChests.MODID, "model/gold_chest");
|
|
|
|
|
public static final ResourceLocation DIAMOND_CHEST_LOCATION = new ResourceLocation(IronChests.MODID, "model/diamond_chest");
|
|
|
|
|
public static final ResourceLocation COPPER_CHEST_LOCATION = new ResourceLocation(IronChests.MODID, "model/copper_chest");
|
|
|
|
|
public static final ResourceLocation SILVER_CHEST_LOCATION = new ResourceLocation(IronChests.MODID, "model/silver_chest");
|
|
|
|
|
public static final ResourceLocation CRYSTAL_CHEST_LOCATION = new ResourceLocation(IronChests.MODID, "model/crystal_chest");
|
|
|
|
|
public static final ResourceLocation OBSIDIAN_CHEST_LOCATION = new ResourceLocation(IronChests.MODID, "model/obsidian_chest");
|
|
|
|
|
public static final ResourceLocation DIRT_CHEST_LOCATION = new ResourceLocation(IronChests.MODID, "model/dirt_chest");
|
|
|
|
|
public static final ResourceLocation VANLLA_CHEST_LOCATION = new ResourceLocation("entity/chest/normal");
|
2019-12-31 02:43:52 +01:00
|
|
|
|
2020-03-10 22:00:20 +01:00
|
|
|
public static ResourceLocation chooseChestTexture(IronChestsTypes type) {
|
2019-12-31 02:43:52 +01:00
|
|
|
switch (type) {
|
|
|
|
|
case IRON:
|
|
|
|
|
return IRON_CHEST_LOCATION;
|
|
|
|
|
case GOLD:
|
|
|
|
|
return GOLD_CHEST_LOCATION;
|
|
|
|
|
case DIAMOND:
|
|
|
|
|
return DIAMOND_CHEST_LOCATION;
|
|
|
|
|
case COPPER:
|
|
|
|
|
return COPPER_CHEST_LOCATION;
|
|
|
|
|
case SILVER:
|
|
|
|
|
return SILVER_CHEST_LOCATION;
|
|
|
|
|
case CRYSTAL:
|
|
|
|
|
return CRYSTAL_CHEST_LOCATION;
|
|
|
|
|
case OBSIDIAN:
|
|
|
|
|
return OBSIDIAN_CHEST_LOCATION;
|
2020-02-28 03:21:03 +01:00
|
|
|
case DIRT:
|
2019-12-31 02:43:52 +01:00
|
|
|
return DIRT_CHEST_LOCATION;
|
|
|
|
|
case WOOD:
|
|
|
|
|
default:
|
2020-03-10 22:00:20 +01:00
|
|
|
return VANLLA_CHEST_LOCATION;
|
2019-12-31 02:43:52 +01:00
|
|
|
}
|
|
|
|
|
}
|
2020-01-22 23:53:24 +01:00
|
|
|
|
|
|
|
|
@SubscribeEvent
|
|
|
|
|
public static void onStitch(TextureStitchEvent.Pre event) {
|
2020-02-28 03:21:03 +01:00
|
|
|
if (!event.getMap().getTextureLocation().equals(Atlases.CHEST_ATLAS)) {
|
2020-01-22 23:53:24 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-10 22:00:20 +01:00
|
|
|
event.addSprite(IRON_CHEST_LOCATION);
|
|
|
|
|
event.addSprite(GOLD_CHEST_LOCATION);
|
|
|
|
|
event.addSprite(DIAMOND_CHEST_LOCATION);
|
|
|
|
|
event.addSprite(COPPER_CHEST_LOCATION);
|
|
|
|
|
event.addSprite(SILVER_CHEST_LOCATION);
|
|
|
|
|
event.addSprite(CRYSTAL_CHEST_LOCATION);
|
|
|
|
|
event.addSprite(OBSIDIAN_CHEST_LOCATION);
|
|
|
|
|
event.addSprite(DIRT_CHEST_LOCATION);
|
2020-01-22 23:53:24 +01:00
|
|
|
}
|
2019-12-31 02:43:52 +01:00
|
|
|
}
|