diff --git a/src/main/java/com/hbm/blocks/machine/HeaterElectric.java b/src/main/java/com/hbm/blocks/machine/HeaterElectric.java index 40afaef4f..b1f3424c5 100644 --- a/src/main/java/com/hbm/blocks/machine/HeaterElectric.java +++ b/src/main/java/com/hbm/blocks/machine/HeaterElectric.java @@ -2,6 +2,7 @@ package com.hbm.blocks.machine; import java.util.List; +import api.hbm.block.IToolable; import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ITooltipProvider; import com.hbm.tileentity.TileEntityProxyCombo; @@ -14,7 +15,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class HeaterElectric extends BlockDummyable implements ITooltipProvider { +public class HeaterElectric extends BlockDummyable implements ITooltipProvider, IToolable { public HeaterElectric() { super(Material.iron); @@ -52,4 +53,25 @@ public class HeaterElectric extends BlockDummyable implements ITooltipProvider { public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) { this.addStandardInfo(stack, player, list, ext); } + + @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; + + int[] pos = this.findCore(world, x, y, z); + + if(pos == null) return false; + + TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]); + + if(!(te instanceof TileEntityHeaterElectric)) return false; + + TileEntityHeaterElectric tile = (TileEntityHeaterElectric) te; + tile.toggleSetting(); + tile.markDirty(); + + return true; + } } diff --git a/src/main/java/com/hbm/inventory/material/Mats.java b/src/main/java/com/hbm/inventory/material/Mats.java index b3cfaf8be..4ede40047 100644 --- a/src/main/java/com/hbm/inventory/material/Mats.java +++ b/src/main/java/com/hbm/inventory/material/Mats.java @@ -85,7 +85,7 @@ public class Mats { public static final NTMMaterial MAT_SOLINIUM = makeSmeltable(12627, SA327, 0).setShapes(NUGGET, BILLET, INGOT, BLOCK); public static final NTMMaterial MAT_SCHRABIDATE = makeSmeltable(12600, SBD, 0).setShapes(INGOT, DUST, BLOCK); public static final NTMMaterial MAT_SCHRARANIUM = makeSmeltable(12601, SRN, 0).setShapes(INGOT, BLOCK); - public static final NTMMaterial MAT_GHIORSIUM = makeSmeltable(11936, GH336, 0).setShapes(NUGGET, BILLET, INGOT, BLOCK); + public static final NTMMaterial MAT_GHIORSIUM = makeSmeltable(12836, GH336, 0).setShapes(NUGGET, BILLET, INGOT, BLOCK); //Base metals public static final NTMMaterial MAT_TITANIUM = makeSmeltable(2200, TI, 0xA99E79).setShapes(INGOT, DUST, PLATE, BLOCK); diff --git a/src/main/java/com/hbm/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index 8f6de38a2..9b0c595be 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -668,6 +668,7 @@ public class CraftingManager { addShapelessAuto(new ItemStack(Items.paper, 1), new Object[] { new ItemStack(ModItems.assembly_template, 1, OreDictionary.WILDCARD_VALUE) }); addShapelessAuto(new ItemStack(Items.paper, 1), new Object[] { new ItemStack(ModItems.chemistry_template, 1, OreDictionary.WILDCARD_VALUE) }); + addShapelessAuto(new ItemStack(Items.paper, 1), new Object[] { new ItemStack(ModItems.crucible_template, 1, OreDictionary.WILDCARD_VALUE) }); addShapelessAuto(new ItemStack(Items.slime_ball, 16), new Object[] { new ItemStack(Items.dye, 1, 15), new ItemStack(Items.dye, 1, 15), new ItemStack(Items.dye, 1, 15), new ItemStack(Items.dye, 1, 15), Fluids.SULFURIC_ACID.getDict(1000) }); for(int i = 1; i < Fluids.getAll().length; ++i) { diff --git a/src/main/java/com/hbm/render/util/HorsePronter.java b/src/main/java/com/hbm/render/util/HorsePronter.java new file mode 100644 index 000000000..94aab581c --- /dev/null +++ b/src/main/java/com/hbm/render/util/HorsePronter.java @@ -0,0 +1,123 @@ +package com.hbm.render.util; + +import org.lwjgl.opengl.GL11; + +import com.hbm.lib.RefStrings; +import com.hbm.render.loader.HFRWavefrontObject; + +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec3; +import net.minecraftforge.client.model.IModelCustom; + +public class HorsePronter { + + public static final IModelCustom horse = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/mobs/horse.obj"), false).asDisplayList(); + + public static final ResourceLocation tex_demohorse = new ResourceLocation(RefStrings.MODID, "textures/models/horse/horse_template.png"); + + private Vec3[] pose = new Vec3[] { + Vec3.createVectorHelper(0, 0, 0), //head + Vec3.createVectorHelper(0, 0, 0), //left front leg + Vec3.createVectorHelper(0, 0, 0), //right front leg + Vec3.createVectorHelper(0, 0, 0), //left back leg + Vec3.createVectorHelper(0, 0, 0), //left back leg + Vec3.createVectorHelper(0, 0, 0), //tail + Vec3.createVectorHelper(0, 0, 0), //body + Vec3.createVectorHelper(0, 0, 0) //body offset + }; + + private Vec3[] offsets = new Vec3[] { + Vec3.createVectorHelper(0, 0, 0), //head + Vec3.createVectorHelper(0, 0, 0), //left front leg + Vec3.createVectorHelper(0, 0, 0), //right front leg + Vec3.createVectorHelper(0, 0, 0), //left back leg + Vec3.createVectorHelper(0, 0, 0), //left back leg + Vec3.createVectorHelper(0, 0, 0), //tail + Vec3.createVectorHelper(0, 0, 0), //body + Vec3.createVectorHelper(0, 0, 0) //body offset + }; + + public static final int id_head = 0; + public static final int id_lfl = 1; + public static final int id_rfl = 2; + public static final int id_lbl = 3; + public static final int id_rbl = 4; + public static final int id_tail = 5; + public static final int id_body = 6; + public static final int id_position = 7; + + private boolean wings = false; + private boolean horn = false; + private boolean maleSnoot = false; + + public void reset() { + + wings = false; + horn = false; + + for(Vec3 angles : pose) { + angles.xCoord = 0; + angles.yCoord = 0; + angles.zCoord = 0; + } + } + + public void enableHorn() { horn = true; } + public void enableWings() { wings = true; } + public void setMaleSnoot() { maleSnoot = true; } + + public void setAlicorn() { + enableHorn(); + enableWings(); + } + + public void pose(int id, double yaw, double pitch, double roll) { + pose[id].xCoord = yaw; + pose[id].yCoord = pitch; + pose[id].zCoord = roll; + } + + public void pront() { + + GL11.glPushMatrix(); + doTransforms(id_body); + + horse.renderPart("Body"); + + if(horn) { + renderWithTransform(id_head, "Head", maleSnoot ? "NoseMale" : "NoseFemale", "HornPointy"); + } else { + renderWithTransform(id_head, "Head", maleSnoot ? "NoseMale" : "NoseFemale"); + } + + renderWithTransform(id_lfl, "LeftFrontLeg"); + renderWithTransform(id_rfl, "RightFrontLeg"); + renderWithTransform(id_lbl, "LeftBackLeg"); + renderWithTransform(id_rbl, "RightBackLeg"); + renderWithTransform(id_tail, "Tail"); + + if(wings) { + horse.renderPart("LeftWing"); + horse.renderPart("RightWing"); + } + + GL11.glPopMatrix(); + } + + private void doTransforms(int id) { + Vec3 rotation = pose[id]; + Vec3 offset = offsets[id]; + GL11.glTranslated(offset.xCoord, offset.yCoord, offset.zCoord); + GL11.glRotated(rotation.xCoord, 0, 1, 0); + GL11.glRotated(rotation.yCoord, 1, 0, 0); + GL11.glRotated(rotation.zCoord, 0, 0, 1); //TODO: check pitch and roll axis + GL11.glTranslated(-offset.xCoord, -offset.yCoord, -offset.zCoord); + } + + private void renderWithTransform(int id, String... parts) { + GL11.glPushMatrix(); + doTransforms(id); + for(String part : parts) horse.renderPart(part); + GL11.glPopMatrix(); + } +} diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityHeaterElectric.java b/src/main/java/com/hbm/tileentity/machine/TileEntityHeaterElectric.java index 6092d5a11..e60cea253 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityHeaterElectric.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityHeaterElectric.java @@ -1,34 +1,95 @@ package com.hbm.tileentity.machine; +import com.hbm.blocks.BlockDummyable; +import com.hbm.tileentity.INBTPacketReceiver; import com.hbm.tileentity.TileEntityLoadedBase; import api.hbm.energy.IEnergyUser; import api.hbm.tile.IHeatSource; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityHeaterElectric extends TileEntityLoadedBase implements IHeatSource, IEnergyUser { +public class TileEntityHeaterElectric extends TileEntityLoadedBase implements IHeatSource, IEnergyUser, INBTPacketReceiver { + + public long power; + public int heatEnergy; + protected int setting = 0; + + @Override + public void updateEntity() { + + if(!worldObj.isRemote) { + + if(worldObj.getTotalWorldTime() % 20 == 0) { //doesn't have to happen constantly + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); + this.trySubscribe(worldObj, xCoord + dir.offsetX * 3, yCoord, zCoord + dir.offsetZ * 3, dir); + } + + this.heatEnergy = 0; + + this.tryPullHeat(); + + if(setting > 0 && this.power >= this.getConsumption()) { + this.power -= this.getConsumption(); + this.heatEnergy += setting * 100; + } + + NBTTagCompound data = new NBTTagCompound(); + data.setByte("s", (byte) this.setting); + data.setInteger("h", heatEnergy); + } + } + + @Override + public void networkUnpack(NBTTagCompound nbt) { + this.setting = nbt.getByte("s"); + this.heatEnergy = nbt.getInteger("h"); + } + + protected void tryPullHeat() { + TileEntity con = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord); + + if(con instanceof IHeatSource) { + IHeatSource source = (IHeatSource) con; + this.heatEnergy += source.getHeatStored() * 0.75; + source.useUpHeat(source.getHeatStored()); + } + } + + public void toggleSetting() { + setting++; + + if(setting > 10) + setting = 0; + } @Override public long getPower() { - return 0; + return power; + } + + public long getConsumption() { + return (long) Math.pow(setting * 200, 1.4D); } @Override public long getMaxPower() { - return 0; + return getConsumption() * 20; } @Override public void setPower(long power) { - + this.power = power; } @Override public int getHeatStored() { - return 0; + return heatEnergy; } @Override public void useUpHeat(int heat) { - + this.heatEnergy = Math.max(0, this.heatEnergy - heat); } } diff --git a/src/main/resources/assets/hbm/textures/models/horse/horse_demo.png b/src/main/resources/assets/hbm/textures/models/horse/horse_demo.png new file mode 100644 index 000000000..ecb0e8764 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/models/horse/horse_demo.png differ