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 {
|
|
|
|
|
|
|
|
|
|
public static final ResourceLocation chestAtlas = new ResourceLocation("textures/atlas/chest.png");
|
|
|
|
|
|
|
|
|
|
public static final Material IRON_CHEST_LOCATION = getChestMaterial("iron");
|
|
|
|
|
public static final Material GOLD_CHEST_LOCATION = getChestMaterial("gold");
|
|
|
|
|
public static final Material DIAMOND_CHEST_LOCATION = getChestMaterial("diamond");
|
|
|
|
|
public static final Material COPPER_CHEST_LOCATION = getChestMaterial("copper");
|
|
|
|
|
public static final Material SILVER_CHEST_LOCATION = getChestMaterial("silver");
|
|
|
|
|
public static final Material CRYSTAL_CHEST_LOCATION = getChestMaterial("crystal");
|
|
|
|
|
public static final Material OBSIDIAN_CHEST_LOCATION = getChestMaterial("obsidian");
|
|
|
|
|
public static final Material DIRT_CHEST_LOCATION = getChestMaterial("dirt");
|
|
|
|
|
|
|
|
|
|
public static void addTextures(Consumer<Material> p_228775_0_) {
|
|
|
|
|
p_228775_0_.accept(IRON_CHEST_LOCATION);
|
|
|
|
|
p_228775_0_.accept(GOLD_CHEST_LOCATION);
|
|
|
|
|
p_228775_0_.accept(DIAMOND_CHEST_LOCATION);
|
|
|
|
|
p_228775_0_.accept(COPPER_CHEST_LOCATION);
|
|
|
|
|
p_228775_0_.accept(SILVER_CHEST_LOCATION);
|
|
|
|
|
p_228775_0_.accept(CRYSTAL_CHEST_LOCATION);
|
|
|
|
|
p_228775_0_.accept(OBSIDIAN_CHEST_LOCATION);
|
|
|
|
|
p_228775_0_.accept(DIRT_CHEST_LOCATION);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static Material getChestMaterial(String name) {
|
2020-01-22 23:53:24 +01:00
|
|
|
return new Material(Atlases.CHEST_ATLAS, new ResourceLocation(IronChests.MODID, "model/" + name + "_chest"));
|
2019-12-31 02:43:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Material chooseChestModel(TileEntity tileEntity, IronChestsTypes type) {
|
|
|
|
|
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;
|
|
|
|
|
case DIRTCHEST9000:
|
|
|
|
|
return DIRT_CHEST_LOCATION;
|
|
|
|
|
case WOOD:
|
|
|
|
|
default:
|
2020-01-22 23:53:24 +01:00
|
|
|
return Atlases.CHEST_MATERIAL;
|
2019-12-31 02:43:52 +01:00
|
|
|
}
|
|
|
|
|
}
|
2020-01-22 23:53:24 +01:00
|
|
|
|
|
|
|
|
@SubscribeEvent
|
|
|
|
|
public static void onStitch(TextureStitchEvent.Pre event) {
|
|
|
|
|
if (!event.getMap().getBasePath().equals(Atlases.CHEST_ATLAS)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
event.addSprite(IRON_CHEST_LOCATION.func_229313_b_());
|
|
|
|
|
event.addSprite(GOLD_CHEST_LOCATION.func_229313_b_());
|
|
|
|
|
event.addSprite(DIAMOND_CHEST_LOCATION.func_229313_b_());
|
|
|
|
|
event.addSprite(COPPER_CHEST_LOCATION.func_229313_b_());
|
|
|
|
|
event.addSprite(SILVER_CHEST_LOCATION.func_229313_b_());
|
|
|
|
|
event.addSprite(CRYSTAL_CHEST_LOCATION.func_229313_b_());
|
|
|
|
|
event.addSprite(OBSIDIAN_CHEST_LOCATION.func_229313_b_());
|
|
|
|
|
event.addSprite(DIRT_CHEST_LOCATION.func_229313_b_());
|
|
|
|
|
}
|
2019-12-31 02:43:52 +01:00
|
|
|
}
|