fixed color changer bucket overrides

This commit is contained in:
Ell 2020-09-22 15:08:38 +02:00
parent 4d3b7e8249
commit 27fa32dfbe
2 changed files with 12 additions and 8 deletions

View file

@ -24,12 +24,6 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem, I
public ItemColorChanger() { public ItemColorChanger() {
super("color_changer", new Properties().maxStackSize(1)); 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) { 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; return false;
} }
private static DyeColor getStoredColor(ItemStack stack) { public static DyeColor getStoredColor(ItemStack stack) {
if (!stack.hasTag()) { if (!stack.hasTag()) {
return null; return null;
} else { } else {
@ -85,7 +79,7 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem, I
stack.getOrCreateTag().putInt("color", color.getId()); stack.getOrCreateTag().putInt("color", color.getId());
} }
private static boolean isFillMode(ItemStack stack) { public static boolean isFillMode(ItemStack stack) {
if (!stack.hasTag()) { if (!stack.hasTag()) {
return false; return false;
} else { } else {

View file

@ -1,9 +1,12 @@
package de.ellpeck.naturesaura.proxy; package de.ellpeck.naturesaura.proxy;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.compat.Compat; import de.ellpeck.naturesaura.compat.Compat;
import de.ellpeck.naturesaura.events.ClientEvents; import de.ellpeck.naturesaura.events.ClientEvents;
import de.ellpeck.naturesaura.gui.GuiEnderCrate; import de.ellpeck.naturesaura.gui.GuiEnderCrate;
import de.ellpeck.naturesaura.gui.ModContainers; 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.ParticleHandler;
import de.ellpeck.naturesaura.particles.ParticleMagic; import de.ellpeck.naturesaura.particles.ParticleMagic;
import de.ellpeck.naturesaura.recipes.ModRecipes; 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.Entity;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemModelsProperties;
import net.minecraft.resources.IReloadableResourceManager; import net.minecraft.resources.IReloadableResourceManager;
import net.minecraft.resources.IResourceManager; import net.minecraft.resources.IResourceManager;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType; import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Tuple; import net.minecraft.util.Tuple;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.client.registry.ClientRegistry;
@ -45,6 +50,11 @@ public class ClientProxy implements IProxy {
Compat.setupClient(); Compat.setupClient();
ScreenManager.registerFactory(ModContainers.ENDER_CRATE, GuiEnderCrate::new); ScreenManager.registerFactory(ModContainers.ENDER_CRATE, GuiEnderCrate::new);
ScreenManager.registerFactory(ModContainers.ENDER_ACCESS, 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 @Override