mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-03-09 19:25:37 +00:00
caster is finished, woo!
This commit is contained in:
parent
b6f1d422e8
commit
9340287403
@ -32,16 +32,19 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class MachineStrandCaster extends BlockDummyable implements ICrucibleAcceptor, ILookOverlay {
|
||||
public class MachineStrandCaster extends BlockDummyable implements ICrucibleAcceptor, ILookOverlay, IToolable {
|
||||
|
||||
public MachineStrandCaster() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
//reminder, if the machine is a solid brick, get dimensions will already handle it without the need to use fillSapce
|
||||
//the order is up, down, forward, backward, left, right
|
||||
//x is for left(-)/right(+), z is for forward(+)/backward(-), y you already know
|
||||
@Override
|
||||
public int[] getDimensions() {return new int[]{0, 0, 6, 0, 1, 0};}
|
||||
public int[] getDimensions() {
|
||||
return new int[]{0, 0, 6, 0, 1, 0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset() {
|
||||
@ -194,6 +197,7 @@ public class MachineStrandCaster extends BlockDummyable implements ICrucibleAcce
|
||||
}
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(this.getUnlocalizedName() + ".name"), 0xFF4000, 0x401000, text);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
x += dir.offsetX * o;
|
||||
@ -202,5 +206,31 @@ public class MachineStrandCaster extends BlockDummyable implements ICrucibleAcce
|
||||
if (!MultiblockHandlerXR.checkSpace(world, x, y, z, getDimensions(), x, y, z, dir)) return false;
|
||||
return MultiblockHandlerXR.checkSpace(world, x, y, z, new int[]{2, 0, 1, 0, 1, 0}, x, y, z, dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
|
||||
if (tool != ToolType.SCREWDRIVER)
|
||||
return false;
|
||||
|
||||
TileEntityFoundryCastingBase cast = (TileEntityFoundryCastingBase) world.getTileEntity(x, y, z);
|
||||
|
||||
if (cast.slots[0] == null)
|
||||
return false;
|
||||
|
||||
if (!player.inventory.addItemStackToInventory(cast.slots[0].copy())) {
|
||||
EntityItem item = new EntityItem(world, x + 0.5, y + this.maxY, z + 0.5, cast.slots[0].copy());
|
||||
world.spawnEntityInWorld(item);
|
||||
} else {
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
}
|
||||
|
||||
cast.markDirty();
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
|
||||
cast.slots[0] = null;
|
||||
cast.markDirty();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@ public class GUIMachineStrandCaster extends GuiInfoContainer {
|
||||
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
|
||||
int targetHeight = (caster.amount) * 79 / caster.getCapacity();
|
||||
int targetHeight = Math.min((caster.amount) * 79 / caster.getCapacity(), 92);
|
||||
|
||||
int hex = caster.type.moltenColor;
|
||||
//hex = 0xC18336;
|
||||
@ -83,18 +83,16 @@ public class GUIMachineStrandCaster extends GuiInfoContainer {
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void drawStackInfo(int mouseX, int mouseY, int x, int y) {
|
||||
|
||||
List<String> list = new ArrayList();
|
||||
|
||||
if (caster.type == null) list.add(EnumChatFormatting.RED + "Empty");
|
||||
else list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey(caster.type.getUnlocalizedName()) + ": " + Mats.formatAmount(caster.amount, Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)));
|
||||
else
|
||||
list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey(caster.type.getUnlocalizedName()) + ": " + Mats.formatAmount(caster.amount, Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)));
|
||||
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + x, guiTop + y, 36, 81, mouseX, mouseY, list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -445,6 +445,15 @@ public class AssemblerRecipes {
|
||||
new ComparableStack(ModItems.wire_red_copper, 24),
|
||||
new ComparableStack(ModItems.circuit_copper, 1)
|
||||
}, 300);
|
||||
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_strand_caster, 1), new AStack[] {
|
||||
new ComparableStack(ModItems.ingot_firebrick, 12),
|
||||
new OreDictStack(STEEL.plateCast(), 6),
|
||||
new OreDictStack(CU.plateWelded(), 2),
|
||||
new ComparableStack(ModItems.tank_steel, 2),
|
||||
new OreDictStack(ANY_CONCRETE.any(), 8)
|
||||
}, 100);
|
||||
|
||||
makeRecipe(new ComparableStack(ModItems.piston_set, 1, EnumPistonType.STEEL.ordinal()), new AStack[] {
|
||||
new OreDictStack(STEEL.plate(), 16),
|
||||
new OreDictStack(CU.plate(), 4),
|
||||
|
||||
@ -2,18 +2,34 @@ package com.hbm.render.tileentity;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.item.ItemRenderBase;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineStrandCaster;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.awt.*;
|
||||
import java.nio.DoubleBuffer;
|
||||
|
||||
public class RenderStrandCaster extends TileEntitySpecialRenderer implements IItemRendererProvider {
|
||||
public static final ResourceLocation lava = new ResourceLocation(RefStrings.MODID, "textures/models/machines/lava_gray.png");
|
||||
private static DoubleBuffer buf = null;
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float interp) {
|
||||
TileEntityMachineStrandCaster caster = (TileEntityMachineStrandCaster) te;
|
||||
|
||||
if(buf == null){
|
||||
buf = GLAllocation.createDirectByteBuffer(8*4).asDoubleBuffer();
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y, z + 0.5);
|
||||
@ -31,7 +47,53 @@ public class RenderStrandCaster extends TileEntitySpecialRenderer implements IIt
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
|
||||
bindTexture(ResourceManager.strand_caster_tex);
|
||||
ResourceManager.strand_caster.renderAll();
|
||||
ResourceManager.strand_caster.renderPart("caster");
|
||||
|
||||
|
||||
if (caster.amount != 0 && caster.getInstalledMold() != null) {
|
||||
|
||||
double level = ((double) caster.amount / (double) caster.getCapacity()) * 0.675D;
|
||||
double offset = ((double) caster.amount / (double) caster.getInstalledMold().getCost()) * 0.375D;
|
||||
|
||||
int color = caster.type.moltenColor;
|
||||
|
||||
int r = color >> 16 & 0xFF;
|
||||
int g = color >> 8 & 0xFF;
|
||||
int b = color & 0xFF;
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor3f( r/ 255F, g/ 255F, b/ 255F);
|
||||
GL11.glEnable(GL11.GL_CLIP_PLANE0);
|
||||
buf.put(new double[] { 0, 0, -1, 0.5} );
|
||||
buf.rewind();
|
||||
GL11.glClipPlane(GL11.GL_CLIP_PLANE0, buf);
|
||||
GL11.glTranslated(0,0,-offset + 3.4);
|
||||
ResourceManager.strand_caster.renderPart("plate");
|
||||
GL11.glDisable(GL11.GL_CLIP_PLANE0);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240F, 240F);
|
||||
Tessellator tess = Tessellator.instance;
|
||||
tess.setNormal(0F, 1F, 0F);
|
||||
tess.setColorOpaque_F(r / 255F, g / 255F, b / 255F);
|
||||
bindTexture(lava);
|
||||
tess.startDrawingQuads();
|
||||
tess.addVertexWithUV(-0.9, 2.3 + level, -0.999, 0, 0);
|
||||
tess.addVertexWithUV(-0.9, 2.3 + level, 0.999, 0, 1);
|
||||
tess.addVertexWithUV(0.9, 2.3 + level, 0.999, 1, 1);
|
||||
tess.addVertexWithUV(0.9, 2.3 + level, -0.999, 1, 0);
|
||||
tess.draw();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
|
||||
@ -48,11 +110,11 @@ public class RenderStrandCaster extends TileEntitySpecialRenderer implements IIt
|
||||
public IItemRenderer getRenderer() {
|
||||
return new ItemRenderBase( ) {
|
||||
public void renderInventory() {
|
||||
GL11.glTranslated(1, 1, 0);
|
||||
GL11.glScaled(2.5, 2.5, 2.5);
|
||||
GL11.glTranslated(2, 0, 2);
|
||||
GL11.glScaled( 2, 2, 2);
|
||||
}
|
||||
public void renderCommon() {
|
||||
GL11.glScaled(0.5, 0.5, 0.5);
|
||||
GL11.glScaled(1, 1, 1);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.strand_caster_tex); ResourceManager.strand_caster.renderAll();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
|
||||
@ -158,7 +158,7 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getOpposite();
|
||||
Vec3 impact = Vec3.createVectorHelper(0, 0, 0);
|
||||
MaterialStack didPour = CrucibleUtil.pourFullStack(worldObj, xCoord + 0.5D + dir.offsetX * 1.875D, yCoord + 0.25D, zCoord + 0.5D + dir.offsetZ * 1.875D, 6, true, this.wasteStack, MaterialShapes.NUGGET.q(2), impact);
|
||||
MaterialStack didPour = CrucibleUtil.pourFullStack(worldObj, xCoord + 0.5D + dir.offsetX * 1.875D, yCoord + 0.25D, zCoord + 0.5D + dir.offsetZ * 1.875D, 6, true, this.wasteStack, MaterialShapes.NUGGET.q(3), impact);
|
||||
|
||||
if(didPour != null) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
@ -198,7 +198,7 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro
|
||||
}
|
||||
|
||||
Vec3 impact = Vec3.createVectorHelper(0, 0, 0);
|
||||
MaterialStack didPour = CrucibleUtil.pourFullStack(worldObj, xCoord + 0.5D + dir.offsetX * 1.875D, yCoord + 0.25D, zCoord + 0.5D + dir.offsetZ * 1.875D, 6, true, toCast, MaterialShapes.NUGGET.q(2), impact);
|
||||
MaterialStack didPour = CrucibleUtil.pourFullStack(worldObj, xCoord + 0.5D + dir.offsetX * 1.875D, yCoord + 0.25D, zCoord + 0.5D + dir.offsetZ * 1.875D, 6, true, toCast, MaterialShapes.NUGGET.q(3), impact);
|
||||
|
||||
if(didPour != null) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
@ -36,10 +36,12 @@ public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase
|
||||
|
||||
public FluidTank water;
|
||||
public FluidTank steam;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "container.machineStrandCaster";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return getName();
|
||||
@ -123,15 +125,15 @@ public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase
|
||||
ItemMold.Mold mold = this.getInstalledMold();
|
||||
if (type != null && mold != null && this.amount >= mold.getCost() * 9 && mold.getOutput(type) != null) {
|
||||
for (int i = 1; i < 7; i++) {
|
||||
|
||||
if (slots[i] == null || slots[i].isItemEqual(mold.getOutput(type)) && slots[i].stackSize + mold.getOutput(type).stackSize <= mold.getOutput(type).getMaxStackSize())
|
||||
return water.getFill() >= getWaterRequired() && steam.getFill() < steam.getMaxFill();;
|
||||
return water.getFill() >= getWaterRequired() && steam.getFill() < steam.getMaxFill();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public DirPos[] getFluidConPos() {
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
||||
@ -157,6 +159,7 @@ public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase
|
||||
new int[]{xCoord, yCoord + 2, zCoord},
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemMold.Mold getInstalledMold() {
|
||||
if (slots[0] == null) return null;
|
||||
@ -167,6 +170,7 @@ public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMoldSize() {
|
||||
return getInstalledMold().size;
|
||||
@ -190,11 +194,13 @@ public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase
|
||||
if (this.type != null && this.type != stack.material) return false;
|
||||
return !(this.amount >= this.getCapacity() || getInstalledMold() == null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
ItemMold.Mold mold = this.getInstalledMold();
|
||||
return mold == null ? 50000 : mold.getCost() * 50;
|
||||
return mold == null ? 50000 : mold.getCost() * 10;
|
||||
}
|
||||
|
||||
private int getWaterRequired() {
|
||||
return getInstalledMold() != null ? 5 * getInstalledMold().getCost() : 50;
|
||||
}
|
||||
@ -235,16 +241,17 @@ public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase
|
||||
}
|
||||
|
||||
public void networkPack(NBTTagCompound nbt, int range) {
|
||||
|
||||
if (!worldObj.isRemote)
|
||||
PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(nbt, xCoord, yCoord, zCoord), new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
water.readFromNBT(nbt, "w");
|
||||
steam.readFromNBT(nbt, "s");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
@ -258,6 +265,7 @@ public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase
|
||||
water.readFromNBT(nbt, "w");
|
||||
steam.readFromNBT(nbt, "s");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack) {
|
||||
|
||||
@ -282,6 +290,7 @@ public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase
|
||||
public void markChanged() {
|
||||
this.worldObj.markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) {
|
||||
@ -301,6 +310,7 @@ public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase
|
||||
public boolean canExtractItem(int slot, ItemStack itemStack, int side) {
|
||||
return !this.isItemValidForSlot(slot, itemStack);
|
||||
}
|
||||
|
||||
AxisAlignedBB bb = null;
|
||||
|
||||
@Override
|
||||
@ -311,15 +321,13 @@ public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase
|
||||
xCoord - 1,
|
||||
yCoord,
|
||||
zCoord - 1,
|
||||
xCoord + 2,
|
||||
xCoord + 6,
|
||||
yCoord + 3,
|
||||
zCoord + 7
|
||||
zCoord + 6
|
||||
);
|
||||
}
|
||||
|
||||
return bb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user