Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup: LogisticsNewPipeItemBoxRenderer takes an ItemIdentifierStack #44

Merged
merged 1 commit into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import buildcraft.transport.TravelingItem;
import buildcraft.transport.render.PipeTransportItemsRenderer;
import logisticspipes.renderer.LogisticsRenderPipe;
import logisticspipes.utils.item.ItemIdentifierStack;

public class BCLPPipeTransportItemsRenderer extends PipeTransportItemsRenderer {

Expand All @@ -14,8 +15,9 @@ public void doRenderItem(TravelingItem travellingItem, double x, double y, doubl
if (travellingItem.getItemStack().getTagCompound().getString("LogsitcsPipes_ITEM_ON_TRANSPORTATION")
.equals("YES")) {
if (LogisticsRenderPipe.boxRenderer != null) {
LogisticsRenderPipe.boxRenderer
.doRenderItem(travellingItem.getItemStack(), light, x, y + 0.25, z, 1.0D);
ItemIdentifierStack itemIdentifierStack = ItemIdentifierStack
.getFromStack(travellingItem.getItemStack());
LogisticsRenderPipe.boxRenderer.doRenderItem(itemIdentifierStack, light, x, y + 0.25, z, 1.0D);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,17 +251,18 @@ private void renderSolids(CoreUnroutedPipe pipe, double x, double y, double z, f
GL11.glPopMatrix();
}

public void doRenderItem(ItemIdentifierStack itemstack, World worldObj, double x, double y, double z, float light,
float renderScale, double boxScale, float partialTickTime) {
public void doRenderItem(ItemIdentifierStack itemIdentifierStack, World worldObj, double x, double y, double z,
float light, float renderScale, double boxScale, float partialTickTime) {
if (LogisticsRenderPipe.config.isUseNewRenderer() && boxScale != 0) {
LogisticsRenderPipe.boxRenderer.doRenderItem(itemstack.makeNormalStack(), light, x, y, z, boxScale);
LogisticsRenderPipe.boxRenderer.doRenderItem(itemIdentifierStack, light, x, y, z, boxScale);
}

GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
GL11.glScalef(renderScale, renderScale, renderScale);
GL11.glTranslatef(0.0F, -0.1F, 0.0F);
itemRenderer.setItemIdentifierStack(itemstack).setWorldObj(worldObj).setPartialTickTime(partialTickTime);
itemRenderer.setItemIdentifierStack(itemIdentifierStack).setWorldObj(worldObj)
.setPartialTickTime(partialTickTime);
itemRenderer.renderInWorld();
GL11.glPopMatrix();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;

Expand All @@ -28,7 +27,8 @@ public class LogisticsNewPipeItemBoxRenderer {
private static final ResourceLocation BLOCKS = new ResourceLocation("textures/atlas/blocks.png");
private static final Map<FluidIdentifier, int[]> renderLists = new HashMap<>();

public void doRenderItem(ItemStack itemstack, float light, double x, double y, double z, double boxScale) {
public void doRenderItem(ItemIdentifierStack itemIdentifierStack, float light, double x, double y, double z,
double boxScale) {
if (LogisticsNewRenderPipe.innerTransportBox == null) return;
GL11.glPushMatrix();

Expand All @@ -51,9 +51,8 @@ public void doRenderItem(ItemStack itemstack, float light, double x, double y, d
GL11.glScaled(1 / boxScale, 1 / boxScale, 1 / boxScale);
GL11.glTranslated(-0.5, -0.5, -0.5);

if (itemstack != null && itemstack.getItem() instanceof LogisticsFluidContainer) {
FluidStack f = SimpleServiceLocator.logisticsFluidManager
.getFluidFromContainer(ItemIdentifierStack.getFromStack(itemstack));
if (itemIdentifierStack != null && itemIdentifierStack.getItem().item instanceof LogisticsFluidContainer) {
FluidStack f = SimpleServiceLocator.logisticsFluidManager.getFluidFromContainer(itemIdentifierStack);
if (f != null) {
FluidContainerRenderer.skipNext = true;
int list = getRenderListFor(f);
Expand Down
Loading