mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-10-26 14:24:22 +00:00
Add RenderFull NBT tag override to pools. Closes #228
This commit is contained in:
3 files changed
+42
-20
No files matched your search
@@ -28,6 +28,7 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
@@ -113,6 +114,7 @@ import vazkii.botania.common.block.tile.corporea.TileCorporeaCrystalCube;
|
||||
import vazkii.botania.common.block.tile.corporea.TileCorporeaIndex;
|
||||
import vazkii.botania.common.block.tile.mana.TileBellows;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.item.ItemManaGun;
|
||||
import vazkii.botania.common.item.ItemSpawnerMover;
|
||||
import vazkii.botania.common.item.ItemTwigWand;
|
||||
@@ -158,7 +160,6 @@ public final class ModelHandler {
|
||||
registerAltars();
|
||||
registerQuartzBlocks();
|
||||
registerLuminizers();
|
||||
registerPools();
|
||||
|
||||
/** Normal Items **/
|
||||
registerStandardItems();
|
||||
@@ -172,6 +173,24 @@ public final class ModelHandler {
|
||||
// Cannot use lambdas directly yet because FG/SS can't reobfuscate them, need a dummy wrapper
|
||||
// See https://github.com/MinecraftForge/ForgeGradle/issues/314.
|
||||
|
||||
ModelLoader.registerItemVariants(Item.getItemFromBlock(ModBlocks.pool),
|
||||
new ModelResourceLocation("botania:pool", "variant=default"),
|
||||
new ModelResourceLocation("botania:pool", "variant=diluted"),
|
||||
new ModelResourceLocation("botania:pool", "variant=creative"),
|
||||
new ModelResourceLocation("botania:pool", "variant=fabulous"),
|
||||
new ModelResourceLocation("botania:pool", "default_full"),
|
||||
new ModelResourceLocation("botania:pool", "diluted_full"),
|
||||
new ModelResourceLocation("botania:pool", "creative_full"),
|
||||
new ModelResourceLocation("botania:pool", "fabulous_full"));
|
||||
ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(ModBlocks.pool), MesherWrapper.of(stack -> {
|
||||
int meta = stack.getMetadata();
|
||||
if (meta < 0 || meta > 3)
|
||||
meta = 0;
|
||||
PoolVariant v = PoolVariant.values()[meta];
|
||||
boolean renderFull = v == PoolVariant.CREATIVE || (stack.hasTagCompound() && stack.getTagCompound().getBoolean("RenderFull"));
|
||||
return new ModelResourceLocation("botania:pool", renderFull ? v.getName() + "_full" : "variant=" + v.getName());
|
||||
}));
|
||||
|
||||
ModelLoader.registerItemVariants(elementiumShears,
|
||||
new ModelResourceLocation("botania:elementiumShears", "inventory"),
|
||||
new ModelResourceLocation("botania:dammitReddit", "inventory"));
|
||||
@@ -898,19 +917,6 @@ public final class ModelHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerPools() {
|
||||
Item item = Item.getItemFromBlock(ModBlocks.pool);
|
||||
String name = Block.blockRegistry.getNameForObject(ModBlocks.pool).toString();
|
||||
for (PoolVariant v : PoolVariant.values()) {
|
||||
if (v == PoolVariant.CREATIVE) {
|
||||
// Special case to have mana water layer
|
||||
ModelLoader.setCustomModelResourceLocation(item, v.ordinal(), new ModelResourceLocation(name, "inventory_creative"));
|
||||
} else {
|
||||
ModelLoader.setCustomModelResourceLocation(item, v.ordinal(), new ModelResourceLocation(name, "variant=" + v.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static <T extends Enum<T> & IStringSerializable> void registerVariantsDefaulted(Block b, Class<T> enumclazz, String variantHeader) {
|
||||
Item item = Item.getItemFromBlock(b);
|
||||
for (T e : enumclazz.getEnumConstants()) {
|
||||
|
||||
@@ -42,18 +42,22 @@ import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.mana.TilePool;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
|
||||
public class PageManaInfusionRecipe extends PageRecipe {
|
||||
|
||||
private static final ResourceLocation manaInfusionOverlay = new ResourceLocation(LibResources.GUI_MANA_INFUSION_OVERLAY);
|
||||
|
||||
List<RecipeManaInfusion> recipes;
|
||||
int ticksElapsed = 0;
|
||||
int recipeAt = 0;
|
||||
private List<RecipeManaInfusion> recipes;
|
||||
private int ticksElapsed = 0;
|
||||
private int recipeAt = 0;
|
||||
private final ItemStack renderStack;
|
||||
|
||||
public PageManaInfusionRecipe(String unlocalizedName, List<RecipeManaInfusion> recipes) {
|
||||
super(unlocalizedName);
|
||||
this.recipes = recipes;
|
||||
renderStack = new ItemStack(ModBlocks.pool, 1, 0);
|
||||
ItemNBTHelper.setBoolean(renderStack, "RenderFull", true);
|
||||
}
|
||||
|
||||
public PageManaInfusionRecipe(String unlocalizedName, RecipeManaInfusion recipe) {
|
||||
@@ -79,8 +83,8 @@ public class PageManaInfusionRecipe extends PageRecipe {
|
||||
|
||||
renderItemAtGridPos(gui, 1, 1, (ItemStack) input, false);
|
||||
|
||||
RenderTilePool.forceMana = true;
|
||||
renderItemAtGridPos(gui, 2, 1, new ItemStack(ModBlocks.pool, 1, recipe.getOutput().getItem() == Item.getItemFromBlock(ModBlocks.pool) ? 2 : 0), false);
|
||||
renderStack.setItemDamage(recipe.getOutput().getItem() == Item.getItemFromBlock(ModBlocks.pool) ? 2 : 0);
|
||||
renderItemAtGridPos(gui, 2, 1, renderStack, false);
|
||||
|
||||
renderItemAtGridPos(gui, 3, 1, recipe.getOutput(), false);
|
||||
|
||||
|
||||
@@ -11,9 +11,21 @@
|
||||
"creative": { "textures": { "all": "botania:model/infinitePool" } },
|
||||
"fabulous": { "textures": { "all": "botania:model/pool" } }
|
||||
},
|
||||
"inventory_creative": [{
|
||||
"default_full": [{
|
||||
"model": "botania:pool_filled",
|
||||
"textures": { "all": "botania:model/pool", "liquid": "botania:blocks/manaWater" }
|
||||
}],
|
||||
"diluted_full": [{
|
||||
"model": "botania:pool_filled",
|
||||
"textures": { "all": "botania:model/dilutedPool", "liquid": "botania:blocks/manaWater" }
|
||||
}],
|
||||
"creative_full": [{
|
||||
"model": "botania:pool_filled",
|
||||
"textures": { "all": "botania:model/infinitePool", "liquid": "botania:blocks/manaWater" }
|
||||
}],
|
||||
"fabulous_full": [{
|
||||
"model": "botania:pool_filled",
|
||||
"textures": { "all": "botania:model/pool", "liquid": "botania:blocks/manaWater" }
|
||||
}]
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user