finished iron furnace, artillery turret

This commit is contained in:
Bob 2022-06-16 22:59:28 +02:00
parent 34d72b4f80
commit caa6b31b93
29 changed files with 4740 additions and 19 deletions

View File

@ -1098,6 +1098,7 @@ public class ModBlocks {
public static final int guiID_fritz = 122;
public static Block turret_brandon;
public static final int guiID_brandon = 122;
public static Block turret_arty;
public static Block rbmk_rod;
public static Block rbmk_rod_mod;
@ -1787,7 +1788,7 @@ public class ModBlocks {
semtex = new BlockSemtex().setBlockName("semtex").setStepSound(Block.soundTypeGrass).setCreativeTab(MainRegistry.nukeTab).setHardness(0.0F).setBlockTextureName(RefStrings.MODID + ":semtex");
c4 = new BlockC4().setBlockName("c4").setStepSound(Block.soundTypeGrass).setCreativeTab(MainRegistry.nukeTab).setHardness(0.0F).setBlockTextureName(RefStrings.MODID + ":c4");
furnace_iron = new FurnaceIron().setBlockName("furnace_iron").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
furnace_iron = new FurnaceIron().setBlockName("furnace_iron").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_aluminium");
machine_difurnace_off = new MachineDiFurnace(false).setBlockName("machine_difurnace_off").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
machine_difurnace_on = new MachineDiFurnace(true).setBlockName("machine_difurnace_on").setHardness(5.0F).setLightLevel(1.0F).setResistance(10.0F);
@ -2081,6 +2082,7 @@ public class ModBlocks {
turret_maxwell = new TurretMaxwell(Material.iron).setBlockName("turret_maxwell").setHardness(5.0F).setResistance(600.0F).setCreativeTab(MainRegistry.weaponTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
turret_fritz = new TurretFritz(Material.iron).setBlockName("turret_fritz").setHardness(5.0F).setResistance(600.0F).setCreativeTab(MainRegistry.weaponTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
turret_brandon = new TurretBrandon(Material.iron).setBlockName("turret_brandon").setHardness(5.0F).setResistance(600.0F).setCreativeTab(MainRegistry.weaponTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
turret_arty = new TurretArty(Material.iron).setBlockName("turret_arty").setHardness(5.0F).setResistance(600.0F).setCreativeTab(MainRegistry.weaponTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
rbmk_rod = new RBMKRod(false).setBlockName("rbmk_rod").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_element");
rbmk_rod_mod = new RBMKRod(true).setBlockName("rbmk_rod_mod").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_element_mod");
@ -2836,6 +2838,7 @@ public class ModBlocks {
GameRegistry.registerBlock(turret_maxwell, turret_maxwell.getUnlocalizedName());
GameRegistry.registerBlock(turret_fritz, turret_fritz.getUnlocalizedName());
GameRegistry.registerBlock(turret_brandon, turret_brandon.getUnlocalizedName());
GameRegistry.registerBlock(turret_arty, turret_arty.getUnlocalizedName());
//Wall-mounted Explosives
GameRegistry.registerBlock(charge_dynamite, ItemBlockBase.class, charge_dynamite.getUnlocalizedName());

View File

@ -1,11 +1,9 @@
package com.hbm.blocks.machine;
import com.hbm.blocks.BlockDummyable;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.TileEntityProxyCombo;
import com.hbm.tileentity.machine.TileEntityFurnaceIron;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;

View File

@ -0,0 +1,41 @@
package com.hbm.blocks.turret;
import com.hbm.blocks.BlockDummyable;
import com.hbm.tileentity.TileEntityProxyCombo;
import com.hbm.tileentity.turret.TileEntityTurretArty;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class TurretArty extends BlockDummyable {
public TurretArty(Material mat) {
super(mat);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
if(meta >= 12)
return new TileEntityTurretArty();
return new TileEntityProxyCombo(true, true, false);
}
@Override
public int[] getDimensions() {
return new int[] { 1, 0, 2, 1, 2, 1 };
}
@Override
public int getOffset() {
return 1;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
return this.standardOpenBehavior(world, x, y, z, player, 0);
}
}

View File

@ -25,7 +25,11 @@ public class TurretChekhov extends BlockDummyable {
if(meta >= 12)
return new TileEntityTurretChekhov();
return new TileEntityProxyCombo(true, true, false);
if(meta >= 6)
return new TileEntityProxyCombo(true, true, false);
return null;
}
@Override

View File

@ -88,8 +88,4 @@ public class GUICraneExtractor extends GuiInfoContainer {
drawTexturedModalRect(guiLeft + 139, guiTop + 47, 176, 0, 3, 6);
}
}
protected boolean isMouseOverSlot(Slot slot, int x, int y) {
return this.func_146978_c(slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, x, y);
}
}

View File

@ -9,13 +9,12 @@ import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityFurnaceIron;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.util.ResourceLocation;
public class GUIFurnaceIron extends GuiContainer {
public class GUIFurnaceIron extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_furnace_iron.png");
private TileEntityFurnaceIron diFurnace;
@ -33,10 +32,11 @@ public class GUIFurnaceIron extends GuiContainer {
super.drawScreen(x, y, interp);
if(this.mc.thePlayer.inventory.getItemStack() == null) {
for(int i = 1; i < 3; ++i) {
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(i);
if(!slot.getHasStack()) {
if(this.isMouseOverSlot(slot, x, y) && !slot.getHasStack()) {
List<String> bonuses = this.diFurnace.burnModule.getDesc();
@ -46,6 +46,9 @@ public class GUIFurnaceIron extends GuiContainer {
}
}
}
this.drawCustomInfoStat(x, y, guiLeft + 52, guiTop + 35, 71, 7, x, y, new String[] { (diFurnace.progress * 100 / Math.max(diFurnace.processingTime, 1)) + "%" });
this.drawCustomInfoStat(x, y, guiLeft + 52, guiTop + 44, 71, 7, x, y, new String[] { (diFurnace.burnTime / 20) + "s" });
}
@Override
@ -61,5 +64,14 @@ public class GUIFurnaceIron extends GuiContainer {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
int i = diFurnace.progress * 70 / Math.max(diFurnace.processingTime, 1);
drawTexturedModalRect(guiLeft + 53, guiTop + 36, 176, 18, i, 5);
int j = diFurnace.burnTime * 70 / Math.max(diFurnace.maxBurnTime, 1);
drawTexturedModalRect(guiLeft + 53, guiTop + 45, 176, 23, j, 5);
if(diFurnace.canSmelt())
drawTexturedModalRect(guiLeft + 70, guiTop + 16, 176, 0, 18, 18);
}
}

View File

@ -0,0 +1,45 @@
package com.hbm.inventory.gui;
import com.hbm.lib.RefStrings;
import com.hbm.packet.AuxButtonPacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.tileentity.turret.TileEntityTurretArty;
import com.hbm.tileentity.turret.TileEntityTurretBaseNT;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GUITurretArty extends GUITurretBase {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/weapon/gui_turret_arty.png");
public GUITurretArty(InventoryPlayer invPlayer, TileEntityTurretBaseNT tedf) {
super(invPlayer, tedf);
}
@Override
protected void mouseClicked(int x, int y, int i) {
super.mouseClicked(x, y, i);
if(guiLeft + 151 <= x && guiLeft + 151 + 18 > x && guiTop + 16 < y && guiTop + 16 + 18 >= y) {
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(turret.xCoord, turret.yCoord, turret.zCoord, 0, 5));
return;
}
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int mX, int mY) {
super.drawGuiContainerBackgroundLayer(p_146976_1_, mX, mY);
if(((TileEntityTurretArty)turret).directMode)
drawTexturedModalRect(guiLeft + 151, guiTop + 16, 210, 0, 18, 18);
}
@Override
protected ResourceLocation getTexture() {
return texture;
}
}

View File

@ -16,6 +16,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
@ -92,6 +93,10 @@ public abstract class GuiInfoContainer extends GuiContainer {
}
}
protected boolean isMouseOverSlot(Slot slot, int x, int y) {
return this.func_146978_c(slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, x, y);
}
/**
* Seven segment style displays for GUIs, tried to be as adaptable as possible. Still has some bugs that need to be ironed out but it works for the most part.
* @author UFFR

View File

@ -189,6 +189,7 @@ public class ClientProxy extends ServerProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTurretMaxwell.class, new RenderTurretMaxwell());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTurretFritz.class, new RenderTurretFritz());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTurretBrandon.class, new RenderTurretBrandon());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTurretArty.class, new RenderTurretArty());
//mines
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLandmine.class, new RenderLandmine());
//cel prime

View File

@ -289,6 +289,7 @@ public class CraftingManager {
addRecipeAuto(new ItemStack(ModBlocks.anvil_murky, 1), new Object[] { "UUU", "UAU", "UUU", 'U', ModItems.undefined, 'A', ModBlocks.anvil_steel });
addRecipeAuto(new ItemStack(ModBlocks.machine_fraction_tower), new Object[] { "SHS", "SGS", "SHS", 'S', STEEL.plate(), 'H', ModItems.hull_big_steel, 'G', ModBlocks.steel_grate });
addRecipeAuto(new ItemStack(ModBlocks.fraction_spacer), new Object[] { "BHB", 'H', ModItems.hull_big_steel, 'B', Blocks.iron_bars });
addRecipeAuto(new ItemStack(ModBlocks.furnace_iron), new Object[] { "III", "IFI", "BBB", 'I', IRON.ingot(), 'F', Blocks.furnace, 'B', Blocks.stonebrick });
addRecipeAuto(new ItemStack(ModBlocks.muffler, 1), new Object[] { "III", "IWI", "III", 'I', ModItems.plate_polymer, 'W', Blocks.wool });

View File

@ -4,7 +4,6 @@ import java.lang.reflect.Field;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@ -46,6 +45,7 @@ import com.hbm.items.armor.IDamageHandler;
import com.hbm.items.armor.ItemArmorMod;
import com.hbm.items.armor.ItemModRevive;
import com.hbm.items.armor.ItemModShackles;
import com.hbm.items.tool.ItemGuideBook.BookType;
import com.hbm.items.weapon.ItemGunBase;
import com.hbm.lib.Library;
import com.hbm.lib.ModDamageSource;
@ -63,8 +63,6 @@ import com.hbm.util.EntityDamageUtil;
import com.hbm.world.WorldProviderNTM;
import com.hbm.world.generator.TimedGenerator;
import cpw.mods.fml.common.event.FMLMissingMappingsEvent;
import cpw.mods.fml.common.event.FMLMissingMappingsEvent.MissingMapping;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@ -73,7 +71,6 @@ import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.common.gameevent.TickEvent.WorldTickEvent;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.ReflectionHelper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBush;
@ -183,6 +180,12 @@ public class ModEventHandler {
if(MobConfig.enableDucks && event.player instanceof EntityPlayerMP && !event.player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG).getBoolean("hasDucked"))
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket("Press O to Duck!", MainRegistry.proxy.ID_DUCK, 30_000), (EntityPlayerMP) event.player);
if(event.player instanceof EntityPlayerMP && !event.player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG).getBoolean("hasGuide")) {
event.player.inventory.addItemStackToInventory(new ItemStack(ModItems.book_guide, 1, BookType.STARTER.ordinal()));
event.player.inventoryContainer.detectAndSendChanges();
event.player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG).setBoolean("hasGuide", true);
}
}
}
@ -1512,4 +1515,24 @@ public class ModEventHandler {
}
}
}
@SubscribeEvent
public void filterBrokenEntity(EntityJoinWorldEvent event) {
Entity entity = event.entity;
Entity[] parts = entity.getParts();
//MainRegistry.logger.error("Trying to spawn entity " + entity.getClass().getCanonicalName());
if(parts != null) {
for(int i = 0; i < parts.length; i++) {
if(parts[i] == null) {
MainRegistry.logger.error("Prevented spawning of multipart entity " + entity.getClass().getCanonicalName() + " due to parts being null!");
event.setCanceled(true);
return;
}
}
}
}
}

View File

@ -51,6 +51,7 @@ public class ResourceManager {
public static final IModelCustom turret_maxwell = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/turrets/turret_microwave.obj"));
public static final IModelCustom turret_fritz = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/turrets/turret_fritz.obj"));
public static final IModelCustom turret_brandon = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/turrets/turret_brandon.obj"));
public static final IModelCustom turret_arty = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/turrets/turret_arty.obj"));
public static final IModelCustom turret_howard_damaged = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/turrets/turret_howard_damaged.obj"));
@ -344,6 +345,7 @@ public class ResourceManager {
public static final ResourceLocation turret_maxwell_tex = new ResourceLocation(RefStrings.MODID, "textures/models/turrets/maxwell.png");
public static final ResourceLocation turret_fritz_tex = new ResourceLocation(RefStrings.MODID, "textures/models/turrets/fritz.png");
public static final ResourceLocation turret_brandon_tex = new ResourceLocation(RefStrings.MODID, "textures/models/turrets/brandon.png");
public static final ResourceLocation turret_arty_tex = new ResourceLocation(RefStrings.MODID, "textures/models/turrets/arty.png");
public static final ResourceLocation turret_base_rusted= new ResourceLocation(RefStrings.MODID, "textures/models/turrets/rusted/base.png");

View File

@ -53,7 +53,7 @@ public class ModuleBurnTime {
public List<String> getDesc() {
List<String> list = new ArrayList();
list.add(EnumChatFormatting.YELLOW + "Burn time bonuses:");
list.add(EnumChatFormatting.GOLD + "Burn time bonuses:");
addIf(list, "Logs", modLog);
addIf(list, "Wood", modWood);
@ -77,7 +77,7 @@ public class ModuleBurnTime {
private String getPercent(double mod) {
mod -= 1D;
String num = (((int) (mod * 1000)) / 10D) + "%";
String num = ((int) (mod * 100)) + "%";
if(mod < 0)
num = EnumChatFormatting.RED + "-" + num;

View File

@ -1307,6 +1307,18 @@ public class ItemRenderLibrary {
}
GL11.glShadeModel(GL11.GL_FLAT);
}});
renderers.put(Item.getItemFromBlock(ModBlocks.furnace_iron), new ItemRenderBase( ) {
public void renderInventory() {
GL11.glTranslated(0, -2, 0);
GL11.glScaled(5, 5, 5);
}
public void renderCommon() {
GL11.glRotated(90, 0, 1, 0);
bindTexture(ResourceManager.furnace_iron_tex);
ResourceManager.furnace_iron.renderPart("Main");
ResourceManager.furnace_iron.renderPart("Off");
}});
}
private static void bindTexture(ResourceLocation res) {

View File

@ -4,7 +4,9 @@ import org.lwjgl.opengl.GL11;
import com.hbm.blocks.BlockDummyable;
import com.hbm.main.ResourceManager;
import com.hbm.tileentity.machine.TileEntityFurnaceIron;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
@ -26,9 +28,26 @@ public class RenderFurnaceIron extends TileEntitySpecialRenderer {
GL11.glTranslated(-0.5D, 0, -0.5D);
TileEntityFurnaceIron furnace = (TileEntityFurnaceIron) tileEntity;
bindTexture(ResourceManager.furnace_iron_tex);
ResourceManager.furnace_iron.renderPart("Main");
ResourceManager.furnace_iron.renderPart("Off");
if(furnace.wasOn) {
GL11.glPushMatrix();
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240F, 240F);
ResourceManager.furnace_iron.renderPart("On");
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopAttrib();
GL11.glPopMatrix();
} else {
ResourceManager.furnace_iron.renderPart("Off");
}
GL11.glPopMatrix();
}

View File

@ -0,0 +1,43 @@
package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.main.ResourceManager;
import com.hbm.tileentity.turret.TileEntityTurretArty;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Vec3;
public class RenderTurretArty extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float interp) {
TileEntityTurretArty turret = (TileEntityTurretArty)te;
Vec3 pos = turret.getHorizontalOffset();
GL11.glPushMatrix();
GL11.glTranslated(x + pos.xCoord, y, z + pos.zCoord);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.turret_arty_tex);
ResourceManager.turret_arty.renderPart("Base");
double yaw = -Math.toDegrees(turret.lastRotationYaw + (turret.rotationYaw - turret.lastRotationYaw) * interp) - 90D;
double pitch = Math.toDegrees(turret.lastRotationPitch + (turret.rotationPitch - turret.lastRotationPitch) * interp);
GL11.glRotated(yaw - 90, 0, 1, 0);
ResourceManager.turret_arty.renderPart("Carriage");
GL11.glTranslated(0, 3, 0);
GL11.glRotated(pitch, 1, 0, 0);
GL11.glTranslated(0, -3, 0);
ResourceManager.turret_arty.renderPart("Cannon");
ResourceManager.turret_arty.renderPart("Barrel");
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix();
}
}

View File

@ -243,6 +243,7 @@ public class TileMappings {
put(TileEntityTurretMaxwell.class, "tileentity_turret_maxwell");
put(TileEntityTurretFritz.class, "tileentity_turret_fritz");
put(TileEntityTurretBrandon.class, "tileentity_turret_brandon");
put(TileEntityTurretArty.class, "tileentity_turret_arty");
}
private static void putMachines() {

View File

@ -3,23 +3,31 @@ package com.hbm.tileentity.machine;
import com.hbm.inventory.UpgradeManager;
import com.hbm.inventory.container.ContainerFurnaceIron;
import com.hbm.inventory.gui.GUIFurnaceIron;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
import com.hbm.module.ModuleBurnTime;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import api.hbm.energy.IBatteryItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUIProvider {
public int maxBurnTime;
public int burnTime;
public boolean wasOn = false;
public int progress;
public int processingTime;
@ -51,12 +59,15 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI
UpgradeManager.eval(slots, 4, 4);
this.processingTime = baseTime - (100 * Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3) / 3);
wasOn = false;
if(burnTime <= 0) {
for(int i = 1; i < 3; i++) {
if(slots[i] != null) {
int fuel = burnModule.getBurnTime(slots[i]);
//int fuel = TileEntityFurnace.getItemBurnTime(slots[i]);
if(fuel > 0) {
this.maxBurnTime = this.burnTime = fuel;
@ -73,9 +84,15 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI
}
if(canSmelt()) {
wasOn = true;
this.progress++;
this.burnTime--;
if(this.progress > this.processingTime) {
if(this.progress % 15 == 0) {
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "fire.fire", 1.0F, 0.5F + worldObj.rand.nextFloat() * 0.5F);
}
if(this.progress >= this.processingTime) {
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(slots[0]);
if(slots[3] == null) {
@ -85,7 +102,12 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI
}
this.decrStackSize(0, 1);
this.progress = 0;
this.markDirty();
}
} else {
this.progress = 0;
}
NBTTagCompound data = new NBTTagCompound();
@ -93,7 +115,22 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI
data.setInteger("burnTime", this.burnTime);
data.setInteger("progress", this.progress);
data.setInteger("processingTime", this.processingTime);
data.setBoolean("wasOn", this.wasOn);
this.networkPack(data, 50);
} else {
if(this.progress > 0) {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
double offset = this.progress % 2 == 0 ? 1 : 0.5;
worldObj.spawnParticle("smoke", xCoord + 0.5 - dir.offsetX * offset - rot.offsetX * 0.1875, yCoord + 2, zCoord + 0.5 - dir.offsetZ * offset - rot.offsetZ * 0.1875, 0.0, 0.01, 0.0);
if(this.progress % 5 == 0) {
double rand = worldObj.rand.nextDouble();
worldObj.spawnParticle("flame", xCoord + 0.5 + dir.offsetX * 0.25 + rot.offsetX * rand, yCoord + 0.25 + worldObj.rand.nextDouble() * 0.25, zCoord + 0.5 + dir.offsetZ * 0.25 + rot.offsetZ * rand, 0.0, 0.0, 0.0);
}
}
}
}
@ -103,6 +140,7 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI
this.burnTime = nbt.getInteger("burnTime");
this.progress = nbt.getInteger("progress");
this.processingTime = nbt.getInteger("processingTime");
this.wasOn = nbt.getBoolean("wasOn");
}
public boolean canSmelt() {
@ -120,6 +158,28 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI
return true;
}
@Override
public int[] getAccessibleSlotsFromSide(int meta) {
return new int[] { 0, 1, 2, 3 };
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
if(i == 0)
return FurnaceRecipes.smelting().getSmeltingResult(itemStack) != null;
if(i < 3)
return burnModule.getBurnTime(itemStack) > 0;
return false;
}
@Override
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
return i == 3;
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
@ -130,4 +190,29 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new GUIFurnaceIron(player.inventory, this);
}
AxisAlignedBB bb = null;
@Override
public AxisAlignedBB getRenderBoundingBox() {
if(bb == null) {
bb = AxisAlignedBB.getBoundingBox(
xCoord - 1,
yCoord,
zCoord - 1,
xCoord + 2,
yCoord + 3,
zCoord + 2
);
}
return bb;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
}

View File

@ -0,0 +1,107 @@
package com.hbm.tileentity.turret;
import java.util.ArrayList;
import java.util.List;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.inventory.container.ContainerTurretBase;
import com.hbm.inventory.gui.GUITurretArty;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
import com.hbm.tileentity.IGUIProvider;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUIProvider {
public boolean directMode = false;
static List<Integer> configs = new ArrayList();
static {
configs.add(BulletConfigSyncingUtil.SHELL_NORMAL);
configs.add(BulletConfigSyncingUtil.SHELL_EXPLOSIVE);
configs.add(BulletConfigSyncingUtil.SHELL_AP);
configs.add(BulletConfigSyncingUtil.SHELL_DU);
configs.add(BulletConfigSyncingUtil.SHELL_W9);
}
@Override
protected List<Integer> getAmmoList() {
return configs;
}
@Override
public String getName() {
return "container.turretArty";
}
@Override
public long getMaxPower() {
return 100000;
}
@Override
public double getBarrelLength() {
return 9D;
}
@Override
public double getAcceptableInaccuracy() {
return 0;
}
@Override
public double getHeightOffset() {
return 3D;
}
@Override
public void updateFiringTick() {
BulletConfiguration conf = this.getFirstConfigLoaded();
if(conf != null) {
this.spawnBullet(conf);
this.conusmeAmmo(conf.ammo);
this.worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:turret.jeremy_fire", 4.0F, 1.0F);
Vec3 pos = this.getTurretPos();
Vec3 vec = Vec3.createVectorHelper(this.getBarrelLength(), 0, 0);
vec.rotateAroundZ((float) -this.rotationPitch);
vec.rotateAroundY((float) -(this.rotationYaw + Math.PI * 0.5));
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaExt");
data.setString("mode", "largeexplode");
data.setFloat("size", 0F);
data.setByte("count", (byte)5);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, pos.xCoord + vec.xCoord, pos.yCoord + vec.yCoord, pos.zCoord + vec.zCoord), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
}
}
@Override
public void handleButtonPacket(int value, int meta) {
if(meta == 5) {
this.directMode = !this.directMode;
} else{
super.handleButtonPacket(value, meta);
}
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerTurretBase(player.inventory, this);
}
@Override
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new GUITurretArty(player.inventory, this);
}
}

View File

@ -238,6 +238,7 @@ container.factoryTitanium=Einfache Fabrik
container.fluidtank=Tank
container.forceField=Kraftfeldgenerator
container.frackingTower=Hydraulischer Frackingturm
container.furnaceIron=Eiserner Ofen
container.fusionMultiblock=Großer Fusionsreaktor
container.fusionaryWatzPlant=Fusionares Watzwerk
container.gasCentrifuge=Gaszentrifuge
@ -3231,6 +3232,7 @@ tile.frozen_dirt.name=Gefrorene Erde
tile.frozen_grass.name=Gefrorenes Gras
tile.frozen_log.name=Gefrorener Baumstamm
tile.frozen_planks.name=Gefrorene Holzbretter
tile.furnace_iron.name=Eiserner Ofen
tile.fusion_center.name=Zentralmagnetstück
tile.fusion_conductor.name=Supraleiter-Magnet
tile.fusion_core.name=Fusionsreaktorsteuerung

View File

@ -414,6 +414,7 @@ container.factoryTitanium=Basic Factory
container.fluidtank=Tank
container.forceField=Forcefield Emitter
container.frackingTower=Hydraulic Fracking Tower
container.furnaceIron=Iron Furnace
container.fusionMultiblock=Big Fusion Reactor
container.fusionaryWatzPlant=Fusionary Watz Plant
container.gasCentrifuge=Gas Centrifuge
@ -3623,6 +3624,7 @@ tile.frozen_dirt.name=Frozen Dirt
tile.frozen_grass.name=Frozen Grass
tile.frozen_log.name=Frozen Log
tile.frozen_planks.name=Frozen Planks
tile.furnace_iron.name=Iron Furnace
tile.fusion_center.name=Central Magnet Piece
tile.fusion_conductor.name=Superconducting Magnet
tile.fusion_core.name=Fusion Reactor Control

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB