From 27fa32dfbecbe30f16faa6d607f3346050d5d343 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 22 Sep 2020 15:08:38 +0200 Subject: [PATCH] fixed color changer bucket overrides --- .../de/ellpeck/naturesaura/items/ItemColorChanger.java | 10 ++-------- .../java/de/ellpeck/naturesaura/proxy/ClientProxy.java | 10 ++++++++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemColorChanger.java b/src/main/java/de/ellpeck/naturesaura/items/ItemColorChanger.java index 47b5e9d1..4a38bc93 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemColorChanger.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemColorChanger.java @@ -24,12 +24,6 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem, I public ItemColorChanger() { super("color_changer", new Properties().maxStackSize(1)); - - // TODO move to using ItemModelsProperties.func_239418_a_ it seems like - /*this.addPropertyOverride(new ResourceLocation(NaturesAura.MOD_ID, "fill_mode"), - (stack, worldIn, entityIn) -> isFillMode(stack) ? 1F : 0F); - this.addPropertyOverride(new ResourceLocation(NaturesAura.MOD_ID, "has_color"), - (stack, worldIn, entityIn) -> getStoredColor(stack) != null ? 1F : 0F);*/ } private static boolean changeOrCopyColor(PlayerEntity player, ItemStack stack, World world, BlockPos pos, DyeColor firstColor) { @@ -72,7 +66,7 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem, I return false; } - private static DyeColor getStoredColor(ItemStack stack) { + public static DyeColor getStoredColor(ItemStack stack) { if (!stack.hasTag()) { return null; } else { @@ -85,7 +79,7 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem, I stack.getOrCreateTag().putInt("color", color.getId()); } - private static boolean isFillMode(ItemStack stack) { + public static boolean isFillMode(ItemStack stack) { if (!stack.hasTag()) { return false; } else { diff --git a/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java b/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java index 37015431..3617a29e 100644 --- a/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java +++ b/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java @@ -1,9 +1,12 @@ package de.ellpeck.naturesaura.proxy; +import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.compat.Compat; import de.ellpeck.naturesaura.events.ClientEvents; import de.ellpeck.naturesaura.gui.GuiEnderCrate; import de.ellpeck.naturesaura.gui.ModContainers; +import de.ellpeck.naturesaura.items.ItemColorChanger; +import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.particles.ParticleHandler; import de.ellpeck.naturesaura.particles.ParticleMagic; import de.ellpeck.naturesaura.recipes.ModRecipes; @@ -22,10 +25,12 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.item.Item; +import net.minecraft.item.ItemModelsProperties; import net.minecraft.resources.IReloadableResourceManager; import net.minecraft.resources.IResourceManager; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.Tuple; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.registry.ClientRegistry; @@ -45,6 +50,11 @@ public class ClientProxy implements IProxy { Compat.setupClient(); ScreenManager.registerFactory(ModContainers.ENDER_CRATE, GuiEnderCrate::new); ScreenManager.registerFactory(ModContainers.ENDER_ACCESS, GuiEnderCrate::new); + + ItemModelsProperties.func_239418_a_(ModItems.COLOR_CHANGER, new ResourceLocation(NaturesAura.MOD_ID, "fill_mode"), + (stack, worldIn, entityIn) -> ItemColorChanger.isFillMode(stack) ? 1F : 0F); + ItemModelsProperties.func_239418_a_(ModItems.COLOR_CHANGER, new ResourceLocation(NaturesAura.MOD_ID, "has_color"), + (stack, worldIn, entityIn) -> ItemColorChanger.getStoredColor(stack) != null ? 1F : 0F); } @Override