solidifier model, version 2

This commit is contained in:
Bob 2022-02-01 23:15:17 +01:00
parent b5b67a7085
commit a2e0edc466
13 changed files with 2004 additions and 20 deletions

View File

@ -76,19 +76,4 @@ public class MachineSolidifier extends BlockDummyable implements ITooltipProvide
EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.ITALIC + "> to display more info");
}
}
@Override
public int getRenderType() {
return 0;
}
@Override
public boolean isOpaqueCube() {
return true;
}
@Override
public boolean renderAsNormalBlock() {
return true;
}
}

View File

@ -874,6 +874,9 @@ public class GUIHandler implements IGuiHandler {
if(entity instanceof TileEntityMachineLiquefactor) {
return new GUILiquefactor(player.inventory, (TileEntityMachineLiquefactor) entity);
}
if(entity instanceof TileEntityMachineSolidifier) {
return new GUISolidifier(player.inventory, (TileEntityMachineSolidifier) entity);
}
switch(ID) {
case ModBlocks.guiID_test_difurnace: {

View File

@ -49,7 +49,7 @@ public class ContainerLiquefactor extends Container {
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if(index <= 2) {
if(index <= 3) {
if(!this.mergeItemStack(var5, 4, this.inventorySlots.size(), true)) {
return null;
}

View File

@ -51,7 +51,7 @@ public class ContainerSolidifier extends Container {
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if(index <= 2) {
if(index <= 4) {
if(!this.mergeItemStack(var5, 5, this.inventorySlots.size(), true)) {
return null;
}

View File

@ -0,0 +1,63 @@
package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.container.ContainerSolidifier;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityMachineSolidifier;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GUISolidifier extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_solidifier.png");
private TileEntityMachineSolidifier solidifier;
public GUISolidifier(InventoryPlayer invPlayer, TileEntityMachineSolidifier tedf) {
super(new ContainerSolidifier(invPlayer, tedf));
solidifier = tedf;
this.xSize = 176;
this.ySize = 204;
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
solidifier.tank.renderTankInfo(this, mouseX, mouseY, guiLeft + 35, guiTop + 36, 16, 52);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 18, 16, 52, solidifier.power, solidifier.maxPower);
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.solidifier.hasCustomInventoryName() ? this.solidifier.getInventoryName() : I18n.format(this.solidifier.getInventoryName());
this.fontRendererObj.drawString(name, 70 - this.fontRendererObj.getStringWidth(name) / 2, 6, 0xC7C1A3);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
int i = (int)(solidifier.getPower() * 52 / solidifier.getMaxPower());
drawTexturedModalRect(guiLeft + 134, guiTop + 70 - i, 176, 52 - i, 16, i);
int j = solidifier.progress * 42 / solidifier.processTime;
drawTexturedModalRect(guiLeft + 42, guiTop + 17, 192, 0, j, 35);
if(i > 0)
drawTexturedModalRect(guiLeft + 138, guiTop + 4, 176, 52, 9, 12);
Minecraft.getMinecraft().getTextureManager().bindTexture(solidifier.tank.getSheet());
solidifier.tank.renderTank(this, guiLeft + 35, guiTop + 88, solidifier.tank.getTankType().textureX() * FluidTank.x, solidifier.tank.getTankType().textureY() * FluidTank.y, 16, 52);
}
}

View File

@ -204,6 +204,7 @@ public class ClientProxy extends ServerProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDeuteriumTower.class, new RenderDeuteriumTower());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineCatalyticCracker.class, new RenderCatalyticCracker());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineLiquefactor.class, new RenderLiquefactor());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineSolidifier.class, new RenderSolidifier());
//AMS
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAMSBase.class, new RenderAMSBase());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAMSEmitter.class, new RenderAMSEmitter());

View File

@ -67,6 +67,7 @@ public class ResourceManager {
public static final IModelCustom fraction_spacer = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/fraction_spacer.obj"));
public static final IModelCustom cracking_tower = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/cracking_tower.obj"));
public static final IModelCustom liquefactor = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/liquefactor.obj"));
public static final IModelCustom solidifier = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/solidifier.obj"));
//Flare Stack
public static final IModelCustom oilflare = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/oilFlare.obj"));
@ -345,6 +346,7 @@ public class ResourceManager {
public static final ResourceLocation fraction_spacer_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/fraction_spacer.png");
public static final ResourceLocation cracking_tower_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/cracking_tower.png");
public static final ResourceLocation liquefactor_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/liquefactor.png");
public static final ResourceLocation solidifier_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/solidifier.png");
//Flare Stack
public static final ResourceLocation oilflare_tex = new ResourceLocation(RefStrings.MODID, "textures/models/oilFlareTexture.png");

View File

@ -1194,6 +1194,17 @@ public class ItemRenderLibrary {
bindTexture(ResourceManager.liquefactor_tex); ResourceManager.liquefactor.renderPart("Main");
GL11.glShadeModel(GL11.GL_FLAT);
}});
renderers.put(Item.getItemFromBlock(ModBlocks.machine_solidifier), new ItemRenderBase( ) {
public void renderInventory() {
GL11.glTranslated(0, -2.5, 0);
GL11.glScaled(3, 3, 3);
}
public void renderCommon() {
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.solidifier_tex); ResourceManager.solidifier.renderPart("Main");
GL11.glShadeModel(GL11.GL_FLAT);
}});
}
private static void bindTexture(ResourceLocation res) {

View File

@ -57,6 +57,7 @@ public class RenderLiquefactor extends TileEntitySpecialRenderer {
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
}

View File

@ -0,0 +1,71 @@
package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.BlockDummyable;
import com.hbm.main.ResourceManager;
import com.hbm.tileentity.machine.TileEntityMachineSolidifier;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
public class RenderSolidifier extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
switch(tileEntity.getBlockMetadata() - BlockDummyable.offset) {
case 2: GL11.glRotatef(90, 0F, 1F, 0F); break;
case 4: GL11.glRotatef(180, 0F, 1F, 0F); break;
case 3: GL11.glRotatef(270, 0F, 1F, 0F); break;
case 5: GL11.glRotatef(0, 0F, 1F, 0F); break;
}
TileEntityMachineSolidifier liq = (TileEntityMachineSolidifier) tileEntity;
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.solidifier_tex);
ResourceManager.solidifier.renderPart("Main");
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_TEXTURE_2D);
if(liq.tank.getFill() > 0) {
int color = liq.tank.getTankType().getColor();
GL11.glColor3ub((byte) ((color & 0xFF0000) >> 16), (byte) ((color & 0x00FF00) >> 8), (byte) ((color & 0x0000FF) >> 0));
double height = (double)liq.tank.getFill() / (double)liq.tank.getMaxFill();
GL11.glPushMatrix();
GL11.glTranslated(0, 1, 0);
GL11.glScaled(1, height, 1);
GL11.glTranslated(0, -1, 0);
ResourceManager.solidifier.renderPart("Fluid");
GL11.glPopMatrix();
}
GL11.glEnable(GL11.GL_BLEND);
GL11.glAlphaFunc(GL11.GL_GREATER, 0);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glColor4f(0.75F, 1.0F, 1.0F, 0.15F);
GL11.glDepthMask(false);
ResourceManager.solidifier.renderPart("Glass");
GL11.glDepthMask(true);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
}

View File

@ -3,11 +3,9 @@ package com.hbm.tileentity.machine;
import java.util.List;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.inventory.FluidStack;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.recipes.LiquefactionRecipes;
import com.hbm.inventory.recipes.SolidificationRecipes;
import com.hbm.lib.Library;
import com.hbm.tileentity.TileEntityMachineBase;
@ -18,7 +16,6 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
public class TileEntityMachineSolidifier extends TileEntityMachineBase implements IEnergyUser, IFluidAcceptor {

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB