Fix rendering of the dummy fluid item (i.e. in cell workbenches, fluid terminals are unaffected).

This commit is contained in:
Sebastian Hartte
2020-06-29 15:32:49 +02:00
parent 346e58ff25
commit 57fa5576af
5 changed files with 43 additions and 46 deletions
@@ -128,15 +128,6 @@ public class CellWorkbenchContainer extends UpgradeableContainer {
upgradeInventory, this, iSLot, 187 + zz * 18, 8 + 18 * z, iSLot, this.getPlayerInventory()));
}
}
/*
* if ( supportCapacity() ) { for (int w = 0; w < 2; w++) for (int z = 0; z < 9;
* z++) addSlotToContainer( new OptionalSlotFakeTypeOnly( inv, this, offset++,
* x, y, z, w, 1 ) ); for (int w = 0; w < 2; w++) for (int z = 0; z < 9; z++)
* addSlotToContainer( new OptionalSlotFakeTypeOnly( inv, this, offset++, x, y,
* z, w + 2, 2 ) ); for (int w = 0; w < 2; w++) for (int z = 0; z < 9; z++)
* addSlotToContainer( new OptionalSlotFakeTypeOnly( inv, this, offset++, x, y,
* z, w + 4, 3 ) ); }
*/
}
@Override
@@ -20,9 +20,14 @@ package appeng.core.api.definitions;
import java.util.function.Consumer;
import appeng.bootstrap.IItemRendering;
import appeng.bootstrap.ItemRenderingCustomizer;
import appeng.fluids.items.FluidDummyItemColor;
import net.minecraft.entity.EntityClassification;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.ToolType;
import appeng.api.definitions.IItemDefinition;
@@ -42,7 +47,6 @@ import appeng.debug.ReplicatorCardItem;
import appeng.entity.GrowingCrystalEntity;
import appeng.fluids.items.BasicFluidStorageCell;
import appeng.fluids.items.FluidDummyItem;
import appeng.fluids.items.FluidDummyItemRendering;
import appeng.hooks.BlockToolDispenseItemBehavior;
import appeng.hooks.MatterCannonDispenseItemBehavior;
import appeng.items.materials.MaterialType;
@@ -303,7 +307,14 @@ public final class ApiItems implements IItems {
debugTools.item("debug_part_placer", DebugPartPlacerItem::new).build();
this.dummyFluidItem = registry.item("dummy_fluid_item", FluidDummyItem::new)
.rendering(new FluidDummyItemRendering()).build();
.rendering(new ItemRenderingCustomizer() {
@Override
@OnlyIn(Dist.CLIENT)
public void customize(IItemRendering rendering) {
rendering.color(new FluidDummyItemColor());
}
})
.build();
}
private static AEColoredItemDefinition createPaintBalls(FeatureFactory registry, String idSuffix, boolean lumen) {
@@ -0,0 +1,27 @@
package appeng.fluids.items;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fluids.FluidStack;
@OnlyIn(Dist.CLIENT)
public class FluidDummyItemColor implements IItemColor {
@Override
public int getColor(ItemStack stack, int tintIndex) {
Item item = stack.getItem();
if (!(item instanceof FluidDummyItem)) {
return -1;
}
FluidDummyItem fluidItem = (FluidDummyItem) item;
FluidStack fluidStack = fluidItem.getFluidStack(stack);
return fluidStack.getFluid().getAttributes().getColor(fluidStack);
}
}
@@ -1,35 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2018, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.fluids.items;
import appeng.bootstrap.IItemRendering;
import appeng.bootstrap.ItemRenderingCustomizer;
/**
* @author DrummerMC
* @version rv6 - 2018-01-22
* @since rv6 2018-01-22
*/
public class FluidDummyItemRendering extends ItemRenderingCustomizer {
@Override
public void customize(IItemRendering rendering) {
// FIXME rendering.builtInModel( "models/item/dummy_fluid_item", new
// DummyFluidItemModel() );
}
}