-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stovetop grill, pot, refactors, fixes
- Loading branch information
1 parent
1727251
commit bb2503e
Showing
60 changed files
with
1,612 additions
and
419 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/main/java/com/eerussianguy/firmalife/client/render/StovetopGrillBlockEntityRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.eerussianguy.firmalife.client.render; | ||
|
||
import com.eerussianguy.firmalife.common.blockentities.StovetopGrillBlockEntity; | ||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.renderer.MultiBufferSource; | ||
import net.minecraft.client.renderer.block.model.ItemTransforms; | ||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; | ||
import net.minecraft.world.item.ItemStack; | ||
|
||
import net.dries007.tfc.client.RenderHelpers; | ||
import net.dries007.tfc.common.capabilities.Capabilities; | ||
|
||
public class StovetopGrillBlockEntityRenderer implements BlockEntityRenderer<StovetopGrillBlockEntity> | ||
{ | ||
@Override | ||
public void render(StovetopGrillBlockEntity grill, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int combinedLight, int combinedOverlay) | ||
{ | ||
grill.getCapability(Capabilities.ITEM).ifPresent(cap -> { | ||
for (int i = 0; i < StovetopGrillBlockEntity.SLOTS; i++) | ||
{ | ||
ItemStack item = cap.getStackInSlot(i); | ||
if (!item.isEmpty()) | ||
{ | ||
float yOffset = 1f / 16; | ||
poseStack.pushPose(); | ||
poseStack.translate(0.3, 0.003125D + yOffset, 0.28); | ||
poseStack.scale(0.3f, 0.3f, 0.3f); | ||
poseStack.mulPose(RenderHelpers.rotateDegreesX(90F)); | ||
poseStack.mulPose(RenderHelpers.rotateDegreesZ(180F)); | ||
|
||
float translateAmount = -1.4F; | ||
if (i == 1 || i == 3) | ||
{ | ||
poseStack.translate(translateAmount, 0, 0); | ||
} | ||
if (i == 2 || i == 3) | ||
{ | ||
poseStack.translate(0, translateAmount, 0); | ||
} | ||
|
||
Minecraft.getInstance().getItemRenderer().renderStatic(item, ItemTransforms.TransformType.FIXED, combinedLight, combinedOverlay, poseStack, buffer, 0); | ||
poseStack.popPose(); | ||
} | ||
} | ||
}); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
src/main/java/com/eerussianguy/firmalife/client/render/StovetopPotBlockEntityRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package com.eerussianguy.firmalife.client.render; | ||
|
||
import com.eerussianguy.firmalife.common.blockentities.StovetopPotBlockEntity; | ||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.renderer.MultiBufferSource; | ||
import net.minecraft.client.renderer.block.model.ItemTransforms; | ||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.level.material.Fluids; | ||
import net.minecraftforge.fluids.FluidStack; | ||
|
||
import net.dries007.tfc.client.RenderHelpers; | ||
import net.dries007.tfc.common.capabilities.Capabilities; | ||
import net.dries007.tfc.common.fluids.TFCFluids; | ||
|
||
public class StovetopPotBlockEntityRenderer implements BlockEntityRenderer<StovetopPotBlockEntity> | ||
{ | ||
@Override | ||
public void render(StovetopPotBlockEntity pot, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int combinedLight, int combinedOverlay) | ||
{ | ||
if (pot.getLevel() == null) return; | ||
|
||
FluidStack fluidStack = pot.getCapability(Capabilities.FLUID).map(cap -> cap.getFluidInTank(0)).orElse(FluidStack.EMPTY); | ||
if (pot.hasOutput()) | ||
{ | ||
fluidStack = new FluidStack(Fluids.WATER, 1000); | ||
} | ||
if (!fluidStack.isEmpty()) | ||
{ | ||
final int color = pot.hasOutput() ? (TFCFluids.ALPHA_MASK | 0xA64214) : RenderHelpers.getFluidColor(fluidStack); | ||
RenderHelpers.renderFluidFace(poseStack, fluidStack, buffer, color, 0.3125F, 0.3125F, 0.6875F, 0.6875F, 5f / 16, combinedOverlay, combinedLight); | ||
} | ||
|
||
pot.getCapability(Capabilities.ITEM).ifPresent(cap -> { | ||
int ordinal = 0; | ||
for (int slot = 0; slot < StovetopPotBlockEntity.SLOTS; slot++) | ||
{ | ||
ItemStack item = cap.getStackInSlot(slot); | ||
if (!item.isEmpty()) | ||
{ | ||
float yOffset = 1f / 16; | ||
poseStack.pushPose(); | ||
poseStack.translate(0.5, 0.003125D + yOffset, 0.5); | ||
poseStack.scale(0.3f, 0.3f, 0.3f); | ||
poseStack.mulPose(RenderHelpers.rotateDegreesX(90F)); | ||
poseStack.mulPose(RenderHelpers.rotateDegreesZ(180F)); | ||
|
||
ordinal++; | ||
poseStack.translate(0, 0, -0.12F * ordinal); | ||
|
||
Minecraft.getInstance().getItemRenderer().renderStatic(item, ItemTransforms.TransformType.FIXED, combinedLight, combinedOverlay, poseStack, buffer, 0); | ||
poseStack.popPose(); | ||
} | ||
} | ||
}); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/com/eerussianguy/firmalife/client/screen/StovetopGrillScreen.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.eerussianguy.firmalife.client.screen; | ||
|
||
import com.eerussianguy.firmalife.common.container.StovetopGrillContainer; | ||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.world.entity.player.Inventory; | ||
|
||
import net.dries007.tfc.client.screen.TFCContainerScreen; | ||
import net.dries007.tfc.common.capabilities.heat.Heat; | ||
|
||
public class StovetopGrillScreen extends TFCContainerScreen<StovetopGrillContainer> | ||
{ | ||
public StovetopGrillScreen(StovetopGrillContainer container, Inventory playerInventory, Component name) | ||
{ | ||
super(container, playerInventory, name, INVENTORY_2x2); | ||
} | ||
|
||
|
||
@Override | ||
protected void renderLabels(PoseStack poseStack, int mouseX, int mouseY) | ||
{ | ||
super.renderLabels(poseStack, mouseX, mouseY); | ||
Heat heat = Heat.getHeat(menu.getBlockEntity().getTemperature()); | ||
if (heat != null) | ||
{ | ||
drawCenteredLine(poseStack, heat.getDisplayName(), 64); | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/com/eerussianguy/firmalife/client/screen/StovetopPotScreen.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.eerussianguy.firmalife.client.screen; | ||
|
||
import com.eerussianguy.firmalife.common.container.StovetopPotContainer; | ||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.world.entity.player.Inventory; | ||
|
||
import net.dries007.tfc.client.screen.TFCContainerScreen; | ||
import net.dries007.tfc.common.capabilities.heat.Heat; | ||
|
||
public class StovetopPotScreen extends TFCContainerScreen<StovetopPotContainer> | ||
{ | ||
public StovetopPotScreen(StovetopPotContainer container, Inventory playerInventory, Component name) | ||
{ | ||
super(container, playerInventory, name, INVENTORY_2x2); | ||
} | ||
|
||
@Override | ||
protected void renderLabels(PoseStack poseStack, int mouseX, int mouseY) | ||
{ | ||
super.renderLabels(poseStack, mouseX, mouseY); | ||
Heat heat = Heat.getHeat(menu.getBlockEntity().getTemperature()); | ||
if (heat != null) | ||
{ | ||
drawCenteredLine(poseStack, heat.getDisplayName(), 64); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/eerussianguy/firmalife/client/screen/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* Licensed under the EUPL, Version 1.2. | ||
* You may obtain a copy of the Licence at: | ||
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12 | ||
*/ | ||
|
||
@ParametersAreNonnullByDefault | ||
@MethodsReturnNonnullByDefault | ||
@FieldsAreNonnullByDefault | ||
package com.eerussianguy.firmalife.client.screen; | ||
|
||
import javax.annotation.ParametersAreNonnullByDefault; | ||
import net.minecraft.FieldsAreNonnullByDefault; | ||
import net.minecraft.MethodsReturnNonnullByDefault; |
Oops, something went wrong.