blowtorches, repairable tanks, more drill work

This commit is contained in:
Bob 2022-12-18 21:39:27 +01:00
parent e609272ec5
commit 05b5d17a1e
26 changed files with 5278 additions and 2349 deletions

View File

@ -11,6 +11,7 @@ public interface IToolable {
SCREWDRIVER,
HAND_DRILL,
DEFUSER,
WRENCH
WRENCH,
TORCH
}
}

View File

@ -1,11 +1,14 @@
package com.hbm.blocks.machine;
import com.hbm.blocks.BlockDummyable;
import com.hbm.handler.MultiblockHandlerXR;
import com.hbm.tileentity.machine.TileEntityMachineExcavator;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class MachineExcavator extends BlockDummyable {
@ -15,17 +18,49 @@ public class MachineExcavator extends BlockDummyable {
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityMachineExcavator();
if(meta >= 12) return new TileEntityMachineExcavator();
return null;
}
@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);
}
@Override
public int[] getDimensions() {
return new int[] {0, 0, 0, 0, 0, 0};
return new int[] {3, 0, 3, 3, 3, 3};
}
@Override
public int getOffset() {
return 0;
return 3;
}
@Override
public int getHeightOffset() {
return 3;
}
@Override
protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
x += dir.offsetX * o;
y += dir.offsetY * o;
z += dir.offsetZ * o;
return MultiblockHandlerXR.checkSpace(world, x, y, z, getDimensions(), x, y, z, dir);
}
@Override
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
x += dir.offsetX * o;
y += dir.offsetY * o;
z += dir.offsetZ * o;
MultiblockHandlerXR.fillSpace(world, x, y, z, getDimensions(), this, dir);
MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {-1, 3, 3, -2, 3, -2}, this, dir);
MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {-1, 3, 3, -2, -2, 3}, this, dir);
MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {-1, 3, -2, 3, 3, 3}, this, dir);
}
}

View File

@ -4,15 +4,25 @@ import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ILookOverlay;
import com.hbm.blocks.IPersistentInfoProvider;
import com.hbm.inventory.RecipesCommon.AStack;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.items.ModItems;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.IPersistentNBT;
import com.hbm.tileentity.IRepairable;
import com.hbm.tileentity.TileEntityProxyCombo;
import com.hbm.tileentity.machine.storage.TileEntityMachineFluidTank;
import com.hbm.util.I18nUtil;
import com.hbm.util.InventoryUtil;
import api.hbm.block.IToolable;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
@ -22,9 +32,10 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
import net.minecraftforge.common.util.ForgeDirection;
public class MachineFluidTank extends BlockDummyable implements IPersistentInfoProvider {
public class MachineFluidTank extends BlockDummyable implements IPersistentInfoProvider, IToolable, ILookOverlay {
public MachineFluidTank(Material mat) {
super(mat);
@ -49,7 +60,24 @@ public class MachineFluidTank extends BlockDummyable implements IPersistentInfoP
@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);
if(world.isRemote) {
return true;
} else if(!player.isSneaking()) {
int[] pos = this.findCore(world, x, y, z);
if(pos == null)
return false;
TileEntityMachineFluidTank tank = (TileEntityMachineFluidTank) world.getTileEntity(pos[0], pos[1], pos[2]);
if(tank.hasExploded) return false;
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]);
return true;
} else {
return true;
}
}
@Override
@ -115,4 +143,50 @@ public class MachineFluidTank extends BlockDummyable implements IPersistentInfoP
world.setBlock(pos[0], pos[1], pos[2], Blocks.air);
}
}
@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.TORCH) return false;
int[] pos = this.findCore(world, x, y, z);
if(pos == null) return false;
TileEntity core = world.getTileEntity(pos[0], pos[1], pos[2]);
if(!(core instanceof TileEntityMachineFluidTank)) return false;
TileEntityMachineFluidTank tank = (TileEntityMachineFluidTank) core;
if(!tank.hasExploded) return false;
List<AStack> list = new ArrayList();
list.add(new ComparableStack(ModItems.plate_steel, 8));
if(InventoryUtil.doesPlayerHaveAStacks(player, list, true)) {
if(!world.isRemote) tank.repair();
return true;
}
return false;
}
@Override
public void printHook(Pre event, World world, int x, int y, int z) {
List<AStack> materials = IRepairable.getRepairMaterials(world, x, y, z, this, Minecraft.getMinecraft().thePlayer);
if(materials == null) return;
List<String> text = new ArrayList();
text.add(EnumChatFormatting.GOLD + "Repair with:");
for(AStack stack : materials) {
try {
ItemStack display = stack.extractForCyclingDisplay(20);
text.add("- " + display.getDisplayName() + " x" + display.stackSize);
} catch(Exception ex) {
text.add(EnumChatFormatting.RED + "- ERROR");
}
}
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
}
}

View File

@ -7,6 +7,7 @@ import com.hbm.inventory.fluid.Fluids;
import static com.hbm.inventory.OreDictManager.*;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemBattery;
import com.hbm.items.tool.ItemBlowtorch;
import com.hbm.items.tool.ItemModMinecart;
import com.hbm.items.tool.ItemModMinecart.EnumCartBase;
import com.hbm.items.tool.ItemModMinecart.EnumMinecart;
@ -134,6 +135,8 @@ public class ToolRecipes {
CraftingManager.addRecipeAuto(new ItemStack(ModItems.hand_drill_desh), new Object[] { " D", "S ", " S", 'D', DESH.ingot(), 'S', ANY_PLASTIC.ingot() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.chemistry_set), new Object[] { "GIG", "GCG", 'G', KEY_ANYGLASS, 'I', IRON.ingot(), 'C', CU.ingot() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.chemistry_set_boron), new Object[] { "GIG", "GCG", 'G', ModBlocks.glass_boron, 'I', STEEL.ingot(), 'C', CO.ingot() });
CraftingManager.addRecipeAuto(ItemBlowtorch.getEmptyTool(ModItems.blowtorch), new Object[] { "CC ", " I ", "CCC", 'C', CU.plate(), 'I', IRON.ingot() });
CraftingManager.addRecipeAuto(ItemBlowtorch.getEmptyTool(ModItems.acetylene_torch), new Object[] { "SS ", " PS", " T ", 'S', STEEL.plate(), 'P', ANY_PLASTIC.ingot(), 'T', ModItems.tank_steel });
//Bobmazon
CraftingManager.addShapelessAuto(new ItemStack(ModItems.bobmazon_materials), new Object[] { Items.book, Items.gold_nugget, Items.string });

View File

@ -1,12 +1,15 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotMachineOutput;
import com.hbm.items.machine.IItemFluidIdentifier;
import com.hbm.tileentity.machine.TileEntityMachineExcavator;
import api.hbm.energy.IBatteryItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerMachineExcavator extends Container {
@ -41,8 +44,48 @@ public class ContainerMachineExcavator extends Container {
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) {
ItemStack var3 = null;
Slot var4 = (Slot) this.inventorySlots.get(par2);
if(var4 != null && var4.getHasStack()) {
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if(par2 <= 4) {
if(!this.mergeItemStack(var5, 5, this.inventorySlots.size(), true)) {
return null;
}
} else {
if(var3.getItem() instanceof IBatteryItem) {
if(!this.mergeItemStack(var5, 0, 1, false)) {
return null;
}
} else if(var3.getItem() instanceof IItemFluidIdentifier) {
if(!this.mergeItemStack(var5, 1, 2, false)) {
return null;
}
} else {
if(!this.mergeItemStack(var5, 2, 5, false)) {
return null;
}
}
}
if(var5.stackSize == 0) {
var4.putStack((ItemStack) null);
} else {
var4.onSlotChanged();
}
}
return var3;
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return false;
return excavator.isUseableByPlayer(player);
}
}

View File

@ -1,18 +1,94 @@
package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerMachineExcavator;
import com.hbm.lib.RefStrings;
import com.hbm.packet.NBTControlPacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.tileentity.machine.TileEntityMachineExcavator;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
public class GUIMachineExcavator extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/machine/gui_mining_drill.png");
private TileEntityMachineExcavator drill;
public GUIMachineExcavator(InventoryPlayer inventory, TileEntityMachineExcavator tile) {
super(new ContainerMachineExcavator(inventory, tile));
this.drill = tile;
this.xSize = 242;
this.ySize = 204;
}
@Override
public void drawScreen(int x, int y, float interp) {
super.drawScreen(x, y, interp);
}
@Override
protected void mouseClicked(int x, int y, int i) {
super.mouseClicked(x, y, i);
String toggle = null;
if(guiLeft + 6 <= x && guiLeft + 6 + 20 > x && guiTop + 42 < y && guiTop + 42 + 40 >= y) toggle = "drill";
if(guiLeft + 30 <= x && guiLeft + 30 + 20 > x && guiTop + 42 < y && guiTop + 42 + 40 >= y) toggle = "crusher";
if(guiLeft + 54 <= x && guiLeft + 54 + 20 > x && guiTop + 42 < y && guiTop + 42 + 40 >= y) toggle = "walling";
if(guiLeft + 78 <= x && guiLeft + 78 + 20 > x && guiTop + 42 < y && guiTop + 42 + 40 >= y) toggle = "veinminer";
if(guiLeft + 102 <= x && guiLeft + 102 + 20 > x && guiTop + 42 < y && guiTop + 42 + 40 >= y) toggle = "silktouch";
if(toggle != null) {
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:block.leverLarge"), 1.0F));
NBTTagCompound data = new NBTTagCompound();
data.setBoolean(toggle, true);
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, drill.xCoord, drill.yCoord, drill.zCoord));
}
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8 + 33, this.ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float interp, int x, int y) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 242, 96);
drawTexturedModalRect(guiLeft + 33, guiTop + 104, 33, 104, 176, 100);
if(drill.enableDrill) {
drawTexturedModalRect(guiLeft + 6, guiTop + 42, 209, 114, 20, 40);
drawTexturedModalRect(guiLeft + 11, guiTop + 5, 209, 104, 10, 10);
}
if(drill.enableCrusher) {
drawTexturedModalRect(guiLeft + 30, guiTop + 42, 209, 114, 20, 40);
drawTexturedModalRect(guiLeft + 35, guiTop + 5, 209, 104, 10, 10);
}
if(drill.enableWalling) {
drawTexturedModalRect(guiLeft + 54, guiTop + 42, 209, 114, 20, 40);
drawTexturedModalRect(guiLeft + 59, guiTop + 5, 209, 104, 10, 10);
}
if(drill.enableVeinMiner) {
drawTexturedModalRect(guiLeft + 78, guiTop + 42, 209, 114, 20, 40);
drawTexturedModalRect(guiLeft + 83, guiTop + 5, 209, 104, 10, 10);
}
if(drill.enableSilkTouch) {
drawTexturedModalRect(guiLeft + 102, guiTop + 42, 209, 114, 20, 40);
drawTexturedModalRect(guiLeft + 107, guiTop + 5, 209, 104, 10, 10);
}
}
}

View File

@ -1934,6 +1934,8 @@ public class ModItems {
public static Item wrench_archineer;
public static Item chemistry_set;
public static Item chemistry_set_boron;
public static Item blowtorch;
public static Item acetylene_torch;
public static Item overfuse;
public static Item arc_electrode;
public static Item arc_electrode_burnt;
@ -4702,6 +4704,8 @@ public class ModItems {
wrench_archineer = new ItemToolingWeapon(ToolType.WRENCH, 1000, 12F).setUnlocalizedName("wrench_archineer").setTextureName(RefStrings.MODID + ":wrench_archineer_hd");
chemistry_set = new ItemCraftingDegradation(100).setUnlocalizedName("chemistry_set");
chemistry_set_boron = new ItemCraftingDegradation(0).setUnlocalizedName("chemistry_set_boron");
blowtorch = new ItemBlowtorch().setUnlocalizedName("blowtorch");
acetylene_torch = new ItemBlowtorch().setUnlocalizedName("acetylene_torch");
overfuse = new ItemCustomLore().setUnlocalizedName("overfuse").setMaxStackSize(1).setFull3D().setTextureName(RefStrings.MODID + ":overfuse");
arc_electrode = new ItemCustomLore().setUnlocalizedName("arc_electrode").setMaxDamage(250).setCreativeTab(MainRegistry.controlTab).setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setFull3D().setTextureName(RefStrings.MODID + ":arc_electrode");
arc_electrode_burnt = new Item().setUnlocalizedName("arc_electrode_burnt").setMaxStackSize(1).setFull3D().setTextureName(RefStrings.MODID + ":arc_electrode_burnt");
@ -6715,6 +6719,8 @@ public class ModItems {
GameRegistry.registerItem(hand_drill_desh, hand_drill_desh.getUnlocalizedName());
GameRegistry.registerItem(chemistry_set, chemistry_set.getUnlocalizedName());
GameRegistry.registerItem(chemistry_set_boron, chemistry_set_boron.getUnlocalizedName());
GameRegistry.registerItem(blowtorch, blowtorch.getUnlocalizedName());
GameRegistry.registerItem(acetylene_torch, acetylene_torch.getUnlocalizedName());
GameRegistry.registerItem(overfuse, overfuse.getUnlocalizedName());
GameRegistry.registerItem(arc_electrode, arc_electrode.getUnlocalizedName());
GameRegistry.registerItem(arc_electrode_burnt, arc_electrode_burnt.getUnlocalizedName());

View File

@ -0,0 +1,204 @@
package com.hbm.items.tool;
import java.util.List;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.items.ModItems;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
import com.hbm.util.I18nUtil;
import api.hbm.block.IToolable;
import api.hbm.block.IToolable.ToolType;
import api.hbm.fluid.IFillableItem;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
public class ItemBlowtorch extends Item implements IFillableItem {
public ItemBlowtorch() {
this.setFull3D();
this.setCreativeTab(MainRegistry.controlTab);
}
@Override
public Item setUnlocalizedName(String unlocalizedName) {
super.setUnlocalizedName(unlocalizedName);
this.setTextureName(RefStrings.MODID + ":"+ unlocalizedName);
return this;
}
@Override
public boolean acceptsFluid(FluidType type, ItemStack stack) {
if(this == ModItems.blowtorch) return type == Fluids.GAS;
if(this == ModItems.acetylene_torch) return type == Fluids.UNSATURATEDS || type == Fluids.OXYGEN;
return false;
}
@Override
public int tryFill(FluidType type, int amount, ItemStack stack) {
if(!acceptsFluid(type, stack))
return amount;
int toFill = Math.min(amount, 50);
toFill = Math.min(toFill, getMaxFill(type) - this.getFill(stack, type));
this.setFill(stack, type, this.getFill(stack, type) + toFill);
return amount - toFill;
}
public int getFill(ItemStack stack, FluidType type) {
if(!stack.hasTagCompound()) {
initNBT(stack);
}
return stack.stackTagCompound.getInteger(type.getUnlocalizedName());
}
public int getMaxFill(FluidType type) {
if(type == Fluids.GAS) return 4_000;
if(type == Fluids.UNSATURATEDS) return 8_000;
if(type == Fluids.OXYGEN) return 16_000;
return 0;
}
public void setFill(ItemStack stack, FluidType type, int fill) {
if(!stack.hasTagCompound()) {
initNBT(stack);
}
stack.stackTagCompound.setInteger(type.getUnlocalizedName(), fill);
}
public void initNBT(ItemStack stack) {
stack.stackTagCompound = new NBTTagCompound();
if(this == ModItems.blowtorch) {
this.setFill(stack, Fluids.GAS, this.getMaxFill(Fluids.GAS));
}
if(this == ModItems.acetylene_torch) {
this.setFill(stack, Fluids.UNSATURATEDS, this.getMaxFill(Fluids.UNSATURATEDS));
this.setFill(stack, Fluids.OXYGEN, this.getMaxFill(Fluids.OXYGEN));
}
}
public static ItemStack getEmptyTool(Item item) {
ItemBlowtorch tool = (ItemBlowtorch) item;
ItemStack stack = new ItemStack(item);
if(item == ModItems.blowtorch) {
tool.setFill(stack, Fluids.GAS, 0);
}
if(item == ModItems.acetylene_torch) {
tool.setFill(stack, Fluids.UNSATURATEDS, 0);
tool.setFill(stack, Fluids.OXYGEN, 0);
}
return stack;
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float fX, float fY, float fZ) {
Block b = world.getBlock(x, y, z);
if(b instanceof IToolable) {
if(this == ModItems.blowtorch) {
if(this.getFill(stack, Fluids.GAS) < 1000) return false;
}
if(this == ModItems.acetylene_torch) {
if(this.getFill(stack, Fluids.UNSATURATEDS) < 20) return false;
if(this.getFill(stack, Fluids.OXYGEN) < 10) return false;
}
if(((IToolable)b).onScrew(world, player, x, y, z, side, fX, fY, fZ, ToolType.TORCH)) {
if(!world.isRemote) {
if(this == ModItems.blowtorch) {
this.setFill(stack, Fluids.GAS, this.getFill(stack, Fluids.GAS) - 1000);
}
if(this == ModItems.acetylene_torch) {
this.setFill(stack, Fluids.UNSATURATEDS, this.getFill(stack, Fluids.UNSATURATEDS) - 20);
this.setFill(stack, Fluids.OXYGEN, this.getFill(stack, Fluids.OXYGEN) - 10);
}
player.inventoryContainer.detectAndSendChanges();
NBTTagCompound dPart = new NBTTagCompound();
dPart.setString("type", "tau");
dPart.setByte("count", (byte) 10);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(dPart, x + fX, y + fY, z + fZ), new TargetPoint(world.provider.dimensionId, x, y, z, 50));
}
return true;
}
}
return false;
}
@Override
public boolean showDurabilityBar(ItemStack stack) {
return getDurabilityForDisplay(stack) > 0;
}
@Override
public double getDurabilityForDisplay(ItemStack stack) {
double frac = 0D;
if(this == ModItems.blowtorch) {
frac = (double) this.getFill(stack, Fluids.GAS) / (double) this.getMaxFill(Fluids.GAS);
}
if(this == ModItems.acetylene_torch) {
frac = Math.min(
(double) this.getFill(stack, Fluids.UNSATURATEDS) / (double) this.getMaxFill(Fluids.UNSATURATEDS),
(double) this.getFill(stack, Fluids.OXYGEN) / (double) this.getMaxFill(Fluids.OXYGEN)
);
}
return 1 - frac;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
if(this == ModItems.blowtorch) {
list.add(EnumChatFormatting.YELLOW + getFillGauge(stack, Fluids.GAS));
}
if(this == ModItems.acetylene_torch) {
list.add(EnumChatFormatting.YELLOW + getFillGauge(stack, Fluids.UNSATURATEDS));
list.add(EnumChatFormatting.AQUA + getFillGauge(stack, Fluids.OXYGEN));
}
}
@SideOnly(Side.CLIENT)
private String getFillGauge(ItemStack stack, FluidType type) {
return I18nUtil.resolveKey(type.getUnlocalizedName()) + ": " + String.format("%,d", this.getFill(stack, type)) + " / " + String.format("%,d", this.getMaxFill(type));
}
@Override public boolean providesFluid(FluidType type, ItemStack stack) { return false; }
@Override public int tryEmpty(FluidType type, int amount, ItemStack stack) { return amount; }
}

View File

@ -1,7 +1,5 @@
package com.hbm.lib;
import java.util.HashMap;
import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.items.ModItems;
@ -10,10 +8,6 @@ import com.hbm.items.special.ItemBookLore.BookLoreType;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.util.WeightedRandomChestContent;
public class HbmChestContents {

View File

@ -76,7 +76,7 @@ public class Library {
public static String SolsticeUnlimitd = "f5574fd2-ec28-4927-9d11-3c0c731771f4";
public static String FrizzleFrazzle = "fc4cc2ee-12e8-4097-b26a-1c6cb1b96531";
public static String the_NCR = "28ae585f-4431-4491-9ce8-3def6126e3c6";
public static String Barnaby99_x = "711aaf78-a862-4b7e-921a-216349716e9a";
public static String Barnaby99_x = "b04cf173-cff0-4acd-aa19-3d835224b43d";
public static String Ma118 = "1121cb7a-8773-491f-8e2b-221290c93d81";
public static String Adam29Adam29 = "bbae7bfa-0eba-40ac-a0dd-f3b715e73e61";

View File

@ -29,10 +29,28 @@ public class RenderExcavator extends TileEntitySpecialRenderer implements IItemR
case 4: GL11.glRotatef(270, 0F, 1F, 0F); break;
}
GL11.glTranslated(0, -((BlockDummyable) ModBlocks.machine_excavator).getHeightOffset(), 0);
TileEntityMachineExcavator drill = (TileEntityMachineExcavator) tile;
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.mining_drill_tex);
ResourceManager.mining_drill.renderAll();
ResourceManager.mining_drill.renderPart("Main");
ResourceManager.mining_drill.renderPart("Crusher1");
ResourceManager.mining_drill.renderPart("Crusher2");
GL11.glRotatef(drill.prevDrillRotation + (drill.drillRotation - drill.prevDrillRotation) * interp, 0F, -1F, 0F);
float ext = drill.prevDrillExtension + (drill.drillExtension - drill.prevDrillExtension) * interp;
GL11.glTranslatef(0.0F, -ext, 0.0F);
ResourceManager.mining_drill.renderPart("Drillbit");
while(ext >= -1.5) {
ResourceManager.mining_drill.renderPart("Shaft");
GL11.glTranslated(0.0D, 2.0D, 0.0D);
ext -= 2;
}
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix();
}
@ -46,11 +64,15 @@ public class RenderExcavator extends TileEntitySpecialRenderer implements IItemR
public IItemRenderer getRenderer() {
return new ItemRenderBase( ) {
public void renderInventory() {
GL11.glTranslated(0, -1.5, 0);
GL11.glScaled(2, 2, 2);
GL11.glTranslated(0, -2, 0);
GL11.glScaled(3, 3, 3);
}
public void renderCommon() {
GL11.glRotatef(90, 0F, 1F, 0F);
GL11.glScaled(0.5, 0.5, 0.5);
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.mining_drill_tex); ResourceManager.mining_drill.renderAll();
GL11.glShadeModel(GL11.GL_FLAT);
}};
}
}

View File

@ -0,0 +1,37 @@
package com.hbm.tileentity;
import java.util.List;
import com.hbm.blocks.BlockDummyable;
import com.hbm.inventory.RecipesCommon.AStack;
import com.hbm.items.tool.ItemBlowtorch;
import com.hbm.tileentity.machine.storage.TileEntityMachineFluidTank;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public interface IRepairable {
public boolean isDamaged();
public List<AStack> getRepairMaterials();
public void repair();
public static List<AStack> getRepairMaterials(World world, int x, int y, int z, BlockDummyable dummy, EntityPlayer player) {
ItemStack held = player.getHeldItem();
if(held == null || !(held.getItem() instanceof ItemBlowtorch)) return null;
int[] pos = dummy.findCore(world, x, y, z);
if(pos == null) return null;
TileEntity core = world.getTileEntity(pos[0], pos[1], pos[2]);
if(!(core instanceof TileEntityMachineFluidTank)) return null;
IRepairable repairable = (IRepairable) core;
if(!repairable.isDamaged()) return null;
return repairable.getRepairMaterials();
}
}

View File

@ -85,6 +85,7 @@ public class TileMappings {
put(TileEntityMachineRTG.class, "tileentity_machine_rtg");
put(TileEntityStructureMarker.class, "tileentity_structure_marker");
put(TileEntityMachineMiningDrill.class, "tileentity_mining_drill");
put(TileEntityMachineExcavator.class, "tileentity_ntm_excavator");
put(TileEntityFluidDuctSimple.class, "tileentity_universal_duct_simple");
put(TileEntityFluidDuct.class, "tileentity_universal_duct");
put(TileEntityMachineFluidTank.class, "tileentity_fluid_tank");

View File

@ -1,5 +1,6 @@
package com.hbm.tileentity.machine;
import com.hbm.interfaces.IControlReceiver;
import com.hbm.inventory.container.ContainerMachineExcavator;
import com.hbm.inventory.gui.GUIMachineExcavator;
import com.hbm.tileentity.IGUIProvider;
@ -10,9 +11,11 @@ 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.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
public class TileEntityMachineExcavator extends TileEntityMachineBase implements IGUIProvider {
public class TileEntityMachineExcavator extends TileEntityMachineBase implements IControlReceiver, IGUIProvider {
public boolean enableDrill = false;
public boolean enableCrusher = false;
@ -20,6 +23,11 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
public boolean enableVeinMiner = false;
public boolean enableSilkTouch = false;
public float drillRotation = 0F;
public float prevDrillRotation = 0F;
public float drillExtension = 0F;
public float prevDrillExtension = 0F;
public TileEntityMachineExcavator() {
super(14);
}
@ -32,6 +40,52 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
NBTTagCompound data = new NBTTagCompound();
data.setBoolean("drill", enableDrill);
data.setBoolean("crusher", enableCrusher);
data.setBoolean("walling", enableWalling);
data.setBoolean("veinminer", enableVeinMiner);
data.setBoolean("silktouch", enableSilkTouch);
this.networkPack(data, 150);
} else {
this.prevDrillExtension = this.drillExtension;
//this.drillExtension += 0.05F;
this.prevDrillRotation = this.drillRotation;
this.drillRotation += 15F;
if(this.drillRotation >= 360F) {
this.drillRotation -= 360F;
this.prevDrillRotation -= 360F;
}
}
}
public void networkUnpack(NBTTagCompound nbt) {
this.enableDrill = nbt.getBoolean("drill");
this.enableCrusher = nbt.getBoolean("crusher");
this.enableWalling = nbt.getBoolean("walling");
this.enableVeinMiner = nbt.getBoolean("veinminer");
this.enableSilkTouch = nbt.getBoolean("silktouch");
}
@Override
public void receiveControl(NBTTagCompound data) {
if(data.hasKey("drill")) this.enableDrill = !this.enableDrill;
if(data.hasKey("crusher")) this.enableCrusher = !this.enableCrusher;
if(data.hasKey("walling")) this.enableWalling = !this.enableWalling;
if(data.hasKey("veinminer")) this.enableVeinMiner = !this.enableVeinMiner;
if(data.hasKey("silktouch")) this.enableSilkTouch = !this.enableSilkTouch;
this.markChanged();
}
@Override
public boolean hasPermission(EntityPlayer player) {
return this.isUseableByPlayer(player);
}
@Override
@ -44,4 +98,29 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new GUIMachineExcavator(player.inventory, this);
}
AxisAlignedBB bb = null;
@Override
public AxisAlignedBB getRenderBoundingBox() {
if(bb == null) {
bb = AxisAlignedBB.getBoundingBox(
xCoord - 3,
0,
zCoord - 3,
xCoord + 4,
yCoord + 5,
zCoord + 4
);
}
return bb;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
}

View File

@ -11,6 +11,9 @@ import com.hbm.handler.MultiblockHandlerXR;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidContainer;
import com.hbm.interfaces.IFluidSource;
import com.hbm.inventory.OreDictManager;
import com.hbm.inventory.RecipesCommon.AStack;
import com.hbm.inventory.RecipesCommon.OreDictStack;
import com.hbm.inventory.container.ContainerMachineFluidTank;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.trait.FT_Corrosive;
@ -27,6 +30,7 @@ import com.hbm.packet.PacketDispatcher;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.IOverpressurable;
import com.hbm.tileentity.IPersistentNBT;
import com.hbm.tileentity.IRepairable;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.util.ParticleUtil;
import com.hbm.util.fauxpointtwelve.DirPos;
@ -45,7 +49,7 @@ import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMachineFluidTank extends TileEntityMachineBase implements IFluidContainer, IFluidSource, IFluidAcceptor, IFluidStandardTransceiver, IPersistentNBT, IOverpressurable, IGUIProvider {
public class TileEntityMachineFluidTank extends TileEntityMachineBase implements IFluidContainer, IFluidSource, IFluidAcceptor, IFluidStandardTransceiver, IPersistentNBT, IOverpressurable, IGUIProvider, IRepairable {
public FluidTank tank;
public short mode = 0;
@ -379,4 +383,26 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new GUIMachineFluidTank(player.inventory, (TileEntityMachineFluidTank) world.getTileEntity(x, y, z));
}
@Override
public boolean isDamaged() {
return this.hasExploded;
}
List<AStack> repair = new ArrayList();
@Override
public List<AStack> getRepairMaterials() {
if(!repair.isEmpty())
return repair;
repair.add(new OreDictStack(OreDictManager.STEEL.plate(), 6));
return repair;
}
@Override
public void repair() {
this.hasExploded = false;
this.markChanged();
}
}

View File

@ -228,4 +228,9 @@ public class TileEntityTurretFritz extends TileEntityTurretBaseNT implements IFl
public FluidTank[] getAllTanks() {
return new FluidTank[] { tank };
}
@Override
public boolean canConnect(FluidType type, ForgeDirection dir) {
return dir != ForgeDirection.UP && dir != ForgeDirection.DOWN;
}
}

View File

@ -127,8 +127,9 @@ public class TileEntityTurretTauon extends TileEntityTurretBaseNT {
NBTTagCompound data = new NBTTagCompound();
data.setBoolean("shot", true);
this.networkPack(data, 250);Vec3 pos = this.getTurretPos();
this.networkPack(data, 250);
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));

View File

@ -218,6 +218,7 @@ public class InventoryUtil {
ItemStack[] original = player.inventory.mainInventory;
ItemStack[] inventory = new ItemStack[original.length];
boolean[] modified = new boolean[original.length];
AStack[] input = new AStack[stacks.size()];
//first we copy the inputs into an array because 1. it's easier to deal with and 2. we can dick around with the stack sized with no repercussions
@ -248,6 +249,7 @@ public class InventoryUtil {
int size = Math.min(stack.stacksize, inv.stackSize);
stack.stacksize -= size;
inv.stackSize -= size;
modified[j] = true;
//spent stacks are removed from the equation so that we don't cross ourselves later on
if(stack.stacksize <= 0) {
@ -271,10 +273,11 @@ public class InventoryUtil {
if(shouldRemove) {
for(int i = 0; i < original.length; i++) {
if(inventory[i] != null && inventory[i].stackSize <= 0)
if(inventory[i] != null && inventory[i].stackSize <= 0) {
original[i] = null;
else
original[i] = inventory[i];
} else {
if(modified[i]) original[i] = inventory[i];
}
}
}

View File

@ -765,6 +765,7 @@ info.template_out_p=Output:
info.template_seconds=Sekunden
info.template_time=Produktionszeit:
item.acetylene_torch.name=Acetylen-Schweißbrenner
item.ajr_boots.name=Steel Ranger Powerrüstungsstiefel
item.ajr_helmet.name=Steel Ranger Powerrüstungshelm
item.ajr_legs.name=Steel Ranger Powerrüstungsbeinschutz
@ -1130,6 +1131,7 @@ item.blades_iron.name=Eisensägeblatt
item.blades_schrabidium.name=Schrabidiumsägeblatt
item.blades_steel.name=Stahlsägeblatt
item.blades_titanium.name=Titansägeblatt
item.blowtorch.name=Lötlampe
item.board_copper.name=Kupfertafel
item.bobmazon_hidden.name=Versteckter Katalog
item.bobmazon_machines.name=Bobmazon: Blöcke und Maschinen

View File

@ -1123,6 +1123,7 @@ info.template_out_p=Outputs:
info.template_seconds=seconds
info.template_time=Production Time:
item.acetylene_torch.name=Acetylene Welding Torch
item.ajr_boots.name=Steel Ranger Boots
item.ajr_helmet.name=Steel Ranger Helmet
item.ajr_legs.name=Steel Ranger Leggings
@ -1504,6 +1505,7 @@ item.blades_iron.name=Iron Shredder Blades
item.blades_schrabidium.name=Schrabidium Shredder Blades
item.blades_steel.name=Steel Shredder Blades
item.blades_titanium.name=Titanium Shredder Blades
item.blowtorch.name=Blowtorch
item.board_copper.name=Copper Panel
item.bobmazon_hidden.name=Hidden Catalog
item.bobmazon_machines.name=Bobmazon: Blocks and Machines

File diff suppressed because it is too large Load Diff

View File

@ -37,6 +37,7 @@
"block.rbmk_explosion": {"category": "block", "sounds": [{"name": "block/rbmk_explosion", "stream": false}]},
"block.rbmk_az5_cover": {"category": "block", "sounds": [{"name": "block/rbmk_az5_cover", "stream": false}]},
"block.chungusLever": {"category": "block", "sounds": [{"name": "block/chungusLever", "stream": false}]},
"block.leverLarge": {"category": "block", "sounds": [{"name": "block/leverLarge", "stream": false}]},
"block.bobble": {"category": "block", "sounds": [{"name": "block/bobble", "stream": false}]},
"block.crateOpen": {"category": "block", "sounds": [{"name": "block/crateOpen", "stream": false}]},
"block.crateClose": {"category": "block", "sounds": [{"name": "block/crateClose", "stream": false}]},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B