mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
cast yourself a whole house, cast yourself a new mother,
cast a vacation straight to fucking hell
This commit is contained in:
parent
2f74d17823
commit
fd04024706
@ -7,9 +7,13 @@
|
||||
* Rebar
|
||||
* When hooked up to liquid concrete using pipes, will fill to create reinforced concrete
|
||||
* Fills bottom to top, so connect the pipes to the top
|
||||
* Rebar placer
|
||||
* Can be configured with different types of concrete, reinforced or not, or even colored
|
||||
* Rebar created with the rebar placer will remember its type and assume it when being filled with liquid concrete
|
||||
|
||||
## Changed
|
||||
* The alternate recipes for nitric acid and xenon gas in the chemical plant now require blueprints
|
||||
* The chemical plant now has a recipe for making cobblestone from 25mB of lava (which can be liquefacted into even more lava, useful for cobblestone generation)
|
||||
|
||||
## Fixed
|
||||
* Fixed a few assembler recipes using the old crafting numbers which sometimes exceed the stack limit
|
||||
|
||||
@ -7,11 +7,16 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.config.ClientConfig;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.tool.ItemRebarPlacer;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.main.ServerProxy;
|
||||
import com.hbm.render.block.ISBRHUniversal;
|
||||
import com.hbm.render.util.RenderBlocksNT;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
@ -24,6 +29,7 @@ import com.hbm.uninos.networkproviders.RebarNetwork;
|
||||
import com.hbm.uninos.networkproviders.RebarNetworkProvider;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.Compat;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
@ -41,9 +47,13 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@ -97,10 +107,18 @@ public class BlockRebar extends BlockContainer implements ISBRHUniversal {
|
||||
|
||||
public static class TileEntityRebar extends TileEntityLoadedBase implements IFluidReceiverMK2, IBufPacketReceiver {
|
||||
|
||||
public Block concrete;
|
||||
public int concreteMeta;
|
||||
public int progress;
|
||||
public int prevProgress;
|
||||
protected RebarNode node;
|
||||
public boolean hasConnection = false;
|
||||
|
||||
public TileEntityRebar setup(Block b, int m) {
|
||||
this.concrete = b;
|
||||
this.concreteMeta = m;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
@ -115,7 +133,11 @@ public class BlockRebar extends BlockContainer implements ISBRHUniversal {
|
||||
}
|
||||
|
||||
if(this.progress >= 1_000) {
|
||||
worldObj.setBlock(xCoord, yCoord, zCoord, ModBlocks.concrete_rebar);
|
||||
if(concrete != null && ItemRebarPlacer.isValidConk(Item.getItemFromBlock(concrete), concreteMeta)) {
|
||||
worldObj.setBlock(xCoord, yCoord, zCoord, concrete, concreteMeta, 3);
|
||||
} else {
|
||||
worldObj.setBlock(xCoord, yCoord, zCoord, ModBlocks.concrete_rebar);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -158,6 +180,11 @@ public class BlockRebar extends BlockContainer implements ISBRHUniversal {
|
||||
super.readFromNBT(nbt);
|
||||
this.progress = nbt.getInteger("progress");
|
||||
this.hasConnection = nbt.getBoolean("hasConnection");
|
||||
|
||||
if(nbt.hasKey("block")) {
|
||||
this.concrete = Block.getBlockById(nbt.getInteger("block"));
|
||||
this.concreteMeta = nbt.getInteger("meta");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -165,6 +192,11 @@ public class BlockRebar extends BlockContainer implements ISBRHUniversal {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setInteger("progress", this.progress);
|
||||
nbt.setBoolean("hasConnection", this.hasConnection);
|
||||
|
||||
if(this.concrete != null) {
|
||||
nbt.setInteger("block", Block.getIdFromBlock(this.concrete));
|
||||
nbt.setInteger("meta", this.concreteMeta);
|
||||
}
|
||||
}
|
||||
|
||||
public RebarNode createNode() {
|
||||
@ -341,6 +373,14 @@ public class BlockRebar extends BlockContainer implements ISBRHUniversal {
|
||||
TileEntityRebar rebar = (TileEntityRebar) o;
|
||||
if(rebar.progress > 0) rebars.add(rebar);
|
||||
}
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
World world = mc.theWorld;
|
||||
|
||||
double dx = player.prevPosX + (player.posX - player.prevPosX) * interp;
|
||||
double dy = player.prevPosY + (player.posY - player.prevPosY) * interp;
|
||||
double dz = player.prevPosZ + (player.posZ - player.prevPosZ) * interp;
|
||||
|
||||
if(!rebars.isEmpty()) {
|
||||
|
||||
@ -348,19 +388,12 @@ public class BlockRebar extends BlockContainer implements ISBRHUniversal {
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
//RenderHelper.enableStandardItemLighting();
|
||||
|
||||
EntityRenderer entityRenderer = Minecraft.getMinecraft().entityRenderer;
|
||||
EntityRenderer entityRenderer = mc.entityRenderer;
|
||||
entityRenderer.enableLightmap(interp);
|
||||
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
|
||||
double dx = player.prevPosX + (player.posX - player.prevPosX) * interp;
|
||||
double dy = player.prevPosY + (player.posY - player.prevPosY) * interp;
|
||||
double dz = player.prevPosZ + (player.posZ - player.prevPosZ) * interp;
|
||||
|
||||
RenderBlocksNT renderer = RenderBlocksNT.INSTANCE.setWorld(world);
|
||||
renderer.setOverrideBlockTexture(((BlockRebar) ModBlocks.rebar).concrete);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||
mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||
|
||||
Tessellator tess = Tessellator.instance;
|
||||
tess.startDrawingQuads();
|
||||
@ -370,26 +403,6 @@ public class BlockRebar extends BlockContainer implements ISBRHUniversal {
|
||||
tess.setColorRGBA_F(1F, 1F, 1F, 1F);
|
||||
renderer.setRenderBounds(0, 0, 0, 1, rebar.progress / 1000D, 1);
|
||||
renderer.renderStandardBlock(ModBlocks.rebar, rebar.xCoord, rebar.yCoord, rebar.zCoord);
|
||||
|
||||
/*IIcon icon = ((BlockRebar) ModBlocks.rebar).concrete;
|
||||
double minU = icon.getInterpolatedU(renderer.renderMinX * 16.0D);
|
||||
double maxU = icon.getInterpolatedU(renderer.renderMaxX * 16.0D);
|
||||
double minV = icon.getInterpolatedV(renderer.renderMinZ * 16.0D);
|
||||
double maxV = icon.getInterpolatedV(renderer.renderMaxZ * 16.0D);
|
||||
|
||||
double minX = rebar.xCoord + renderer.renderMinX;
|
||||
double maxX = rebar.xCoord + renderer.renderMaxX;
|
||||
double minY = rebar.yCoord + renderer.renderMinY;
|
||||
double maxY = rebar.yCoord + renderer.renderMaxY;
|
||||
double minZ = rebar.zCoord + renderer.renderMinZ;
|
||||
double maxZ = rebar.zCoord + renderer.renderMaxZ;
|
||||
|
||||
//tess.setColorOpaque_F(0.5F, 1F, 1F);
|
||||
tess.setNormal(0, 1, 0);
|
||||
tess.addVertexWithUV(maxX, maxY, maxZ, maxU, maxV);
|
||||
tess.addVertexWithUV(maxX, maxY, minZ, maxU, minV);
|
||||
tess.addVertexWithUV(minX, maxY, minZ, minU, minV);
|
||||
tess.addVertexWithUV(minX, maxY, maxZ, minU, maxV);*/
|
||||
}
|
||||
|
||||
tess.draw();
|
||||
@ -400,5 +413,84 @@ public class BlockRebar extends BlockContainer implements ISBRHUniversal {
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.rebar_placer && player.getHeldItem().hasTagCompound() &&
|
||||
player.getHeldItem().stackTagCompound.hasKey("pos") && mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == MovingObjectType.BLOCK) {
|
||||
|
||||
int[] pos = player.getHeldItem().stackTagCompound.getIntArray("pos");
|
||||
MovingObjectPosition mop = mc.objectMouseOver;
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(mop.sideHit);
|
||||
int iX = mop.blockX + dir.offsetX;
|
||||
int iY = mop.blockY + dir.offsetY;
|
||||
int iZ = mop.blockZ + dir.offsetZ;
|
||||
|
||||
double minX = Math.min(pos[0], iX) + 0.125;
|
||||
double maxX = Math.max(pos[0], iX) + 0.875;
|
||||
double minY = Math.min(pos[1], iY) + 0.125;
|
||||
double maxY = Math.max(pos[1], iY) + 0.875;
|
||||
double minZ = Math.min(pos[2], iZ) + 0.125;
|
||||
double maxZ = Math.max(pos[2], iZ) + 0.875;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
|
||||
Tessellator tess = Tessellator.instance;
|
||||
tess.setTranslation(-dx, -dy, -dz);
|
||||
tess.startDrawing(GL11.GL_LINES);
|
||||
tess.setBrightness(240);
|
||||
tess.setColorRGBA_F(1F, 1F, 1F, 1F);
|
||||
|
||||
// top
|
||||
tess.addVertex(minX, maxY, minZ);
|
||||
tess.addVertex(minX, maxY, maxZ);
|
||||
|
||||
tess.addVertex(minX, maxY, maxZ);
|
||||
tess.addVertex(maxX, maxY, maxZ);
|
||||
|
||||
tess.addVertex(maxX, maxY, maxZ);
|
||||
tess.addVertex(maxX, maxY, minZ);
|
||||
|
||||
tess.addVertex(maxX, maxY, minZ);
|
||||
tess.addVertex(minX, maxY, minZ);
|
||||
|
||||
// bottom
|
||||
tess.addVertex(minX, minY, minZ);
|
||||
tess.addVertex(minX, minY, maxZ);
|
||||
|
||||
tess.addVertex(minX, minY, maxZ);
|
||||
tess.addVertex(maxX, minY, maxZ);
|
||||
|
||||
tess.addVertex(maxX, minY, maxZ);
|
||||
tess.addVertex(maxX, minY, minZ);
|
||||
|
||||
tess.addVertex(maxX, minY, minZ);
|
||||
tess.addVertex(minX, minY, minZ);
|
||||
|
||||
// sides
|
||||
tess.addVertex(minX, minY, minZ);
|
||||
tess.addVertex(minX, maxY, minZ);
|
||||
|
||||
tess.addVertex(maxX, minY, minZ);
|
||||
tess.addVertex(maxX, maxY, minZ);
|
||||
|
||||
tess.addVertex(maxX, minY, maxZ);
|
||||
tess.addVertex(maxX, maxY, maxZ);
|
||||
|
||||
tess.addVertex(minX, minY, maxZ);
|
||||
tess.addVertex(minX, maxY, maxZ);
|
||||
|
||||
tess.draw();
|
||||
tess.setTranslation(0, 0, 0);
|
||||
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
int rebarLeft = InventoryUtil.countAStackMatches(player, new ComparableStack(ModBlocks.rebar), true);
|
||||
int rebarRequired = (Math.max(pos[0], iX) - Math.min(pos[0], iX) + 1) * (Math.max(pos[1], iY) - Math.min(pos[1], iY) + 1) * (Math.max(pos[2], iZ) - Math.min(pos[2], iZ) + 1);
|
||||
MainRegistry.proxy.displayTooltip((rebarRequired > rebarLeft ? EnumChatFormatting.RED : EnumChatFormatting.GREEN) + (rebarLeft + " / " + rebarRequired), 1_000, ServerProxy.ID_CABLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,6 +156,7 @@ public class ToolRecipes {
|
||||
CraftingManager.addRecipeAuto(ItemBlowtorch.getEmptyTool(ModItems.blowtorch), new Object[] { "CC ", " I ", "CCC", 'C', CU.plate528(), 'I', IRON.ingot() });
|
||||
CraftingManager.addRecipeAuto(ItemBlowtorch.getEmptyTool(ModItems.acetylene_torch), new Object[] { "SS ", " PS", " T ", 'S', STEEL.plate528(), 'P', ANY_PLASTIC.ingot(), 'T', ModItems.tank_steel });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.boltgun), new Object[] { "DPS", " RD", " D ", 'D', DURA.ingot(), 'P', DictFrame.fromOne(ModItems.part_generic, EnumPartType.PISTON_PNEUMATIC), 'R', RUBBER.ingot(), 'S', STEEL.shell() });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.rebar_placer), new Object[] { "RDR", "DWD", "RDR", 'R', ModBlocks.rebar, 'D', ModItems.ducttape, 'W', ModItems.wrench });
|
||||
|
||||
//Bobmazon
|
||||
CraftingManager.addShapelessAuto(new ItemStack(ModItems.bobmazon), new Object[] { Items.book, Items.gold_nugget, Items.string, KEY_BLUE });
|
||||
|
||||
@ -3,6 +3,7 @@ package com.hbm.inventory.container;
|
||||
import com.hbm.inventory.SlotCraftingOutput;
|
||||
import com.hbm.inventory.SlotNonRetarded;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemBlueprints;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
|
||||
@ -53,6 +54,14 @@ public class ContainerMachineChemicalFactory extends ContainerBase {
|
||||
|
||||
if(slotOriginal.getItem() instanceof IBatteryItem || slotOriginal.getItem() == ModItems.battery_creative) {
|
||||
if(!this.mergeItemStack(slotStack, 0, 1, false)) return null;
|
||||
} else if(slotOriginal.getItem() instanceof ItemBlueprints) {
|
||||
if(!this.mergeItemStack(slotStack, 4, 5, false)) return null;
|
||||
} else if(slotOriginal.getItem() instanceof ItemBlueprints) {
|
||||
if(!this.mergeItemStack(slotStack, 11, 12, false)) return null;
|
||||
} else if(slotOriginal.getItem() instanceof ItemBlueprints) {
|
||||
if(!this.mergeItemStack(slotStack, 18, 19, false)) return null;
|
||||
} else if(slotOriginal.getItem() instanceof ItemBlueprints) {
|
||||
if(!this.mergeItemStack(slotStack, 25, 26, false)) return null;
|
||||
} else if(slotOriginal.getItem() instanceof ItemMachineUpgrade) {
|
||||
if(!this.mergeItemStack(slotStack, 1, 4, false)) return null;
|
||||
} else {
|
||||
|
||||
@ -3,7 +3,7 @@ package com.hbm.inventory.container;
|
||||
import com.hbm.inventory.SlotCraftingOutput;
|
||||
import com.hbm.inventory.SlotNonRetarded;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemChemistryTemplate;
|
||||
import com.hbm.items.machine.ItemBlueprints;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
|
||||
@ -57,7 +57,7 @@ public class ContainerMachineChemicalPlant extends ContainerBase {
|
||||
|
||||
if(slotOriginal.getItem() instanceof IBatteryItem || slotOriginal.getItem() == ModItems.battery_creative) {
|
||||
if(!this.mergeItemStack(slotStack, 0, 1, false)) return null;
|
||||
} else if(slotOriginal.getItem() instanceof ItemChemistryTemplate) {
|
||||
} else if(slotOriginal.getItem() instanceof ItemBlueprints) {
|
||||
if(!this.mergeItemStack(slotStack, 1, 2, false)) return null;
|
||||
} else if(slotOriginal.getItem() instanceof ItemMachineUpgrade) {
|
||||
if(!this.mergeItemStack(slotStack, 2, 4, false)) return null;
|
||||
|
||||
@ -292,6 +292,8 @@ public abstract class GuiInfoContainer extends GuiContainer implements INEIGuiHa
|
||||
this.drawGradientRect(minX + indent, minY, minX + indent + 16, minY + 16, 0xffb0b0b0, 0xffb0b0b0);
|
||||
}
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), stack, minX + indent, minY);
|
||||
itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), stack, minX + indent, minY, null);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
@ -116,6 +116,12 @@ public class ChemicalPlantRecipes extends GenericRecipes<GenericRecipe> {
|
||||
.outputItems(DictFrame.fromOne(ModItems.fuel_additive, EnumFuelAdditive.DEICER)));
|
||||
|
||||
/// THE CONC AND ASPHALE ///
|
||||
this.register(new GenericRecipe("chem.cobble").setup(20, 100)
|
||||
.inputFluids(new FluidStack(Fluids.WATER, 1_000), new FluidStack(Fluids.LAVA, 25))
|
||||
.outputItems(new ItemStack(Blocks.cobblestone)));
|
||||
this.register(new GenericRecipe("chem.stone").setup(60, 500).setPools(GenericRecipes.POOL_PREFIX_DISCOVER)
|
||||
.inputFluids(new FluidStack(Fluids.WATER, 1_000), new FluidStack(Fluids.LAVA, 25), new FluidStack(Fluids.AIR, 4_000))
|
||||
.outputItems(new ItemStack(Blocks.stone)));
|
||||
this.register(new GenericRecipe("chem.concrete").setup(100, 100)
|
||||
.inputItems(new ComparableStack(ModItems.powder_cement, 1), new ComparableStack(Blocks.gravel, 8), new OreDictStack(KEY_SAND, 8))
|
||||
.inputFluids(new FluidStack(Fluids.WATER, 2_000))
|
||||
|
||||
@ -264,12 +264,12 @@ public class ShredderRecipes extends SerializableRecipe {
|
||||
ShredderRecipes.setRecipe(ModItems.crystal_cobalt, new ItemStack(ModItems.powder_cobalt, 3));
|
||||
|
||||
/* Misc recycling */
|
||||
ShredderRecipes.setRecipe(ModBlocks.steel_poles, new ItemStack(ModItems.powder_steel_tiny, 3));
|
||||
ShredderRecipes.setRecipe(ModBlocks.steel_roof, new ItemStack(ModItems.powder_steel_tiny, 13));
|
||||
ShredderRecipes.setRecipe(ModBlocks.steel_wall, new ItemStack(ModItems.powder_steel_tiny, 13));
|
||||
ShredderRecipes.setRecipe(ModBlocks.steel_corner, new ItemStack(ModItems.powder_steel_tiny, 26));
|
||||
ShredderRecipes.setRecipe(ModBlocks.steel_poles, new ItemStack(ModItems.powder_steel_tiny, 2));
|
||||
ShredderRecipes.setRecipe(ModBlocks.steel_roof, new ItemStack(ModItems.powder_steel_tiny, 9));
|
||||
ShredderRecipes.setRecipe(ModBlocks.steel_wall, new ItemStack(ModItems.powder_steel_tiny, 9));
|
||||
ShredderRecipes.setRecipe(ModBlocks.steel_corner, new ItemStack(ModItems.powder_steel_tiny, 18));
|
||||
ShredderRecipes.setRecipe(ModBlocks.steel_beam, new ItemStack(ModItems.powder_steel_tiny, 3));
|
||||
ShredderRecipes.setRecipe(new ItemStack(ModBlocks.steel_scaffold, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.powder_steel_tiny, 7));
|
||||
ShredderRecipes.setRecipe(new ItemStack(ModBlocks.steel_scaffold, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.powder_steel_tiny, 4));
|
||||
ShredderRecipes.setRecipe(ModItems.coil_copper, new ItemStack(ModItems.powder_red_copper, 1));
|
||||
ShredderRecipes.setRecipe(ModItems.coil_copper_torus, new ItemStack(ModItems.powder_red_copper, 2));
|
||||
ShredderRecipes.setRecipe(ModItems.coil_advanced_alloy, new ItemStack(ModItems.powder_advanced_alloy, 1));
|
||||
|
||||
@ -2075,6 +2075,8 @@ public class ModItems {
|
||||
public static Item hazmat_paa_legs;
|
||||
public static Item hazmat_paa_boots;
|
||||
|
||||
public static Item rebar_placer;
|
||||
|
||||
public static Item wand;
|
||||
public static Item wand_s;
|
||||
public static Item wand_d;
|
||||
@ -4003,6 +4005,7 @@ public class ModItems {
|
||||
upgrade_stack = new ItemMetaUpgrade(3).setUnlocalizedName("upgrade_stack").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_stack");
|
||||
upgrade_ejector = new ItemMetaUpgrade(3).setUnlocalizedName("upgrade_ejector").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_ejector");
|
||||
|
||||
rebar_placer = new ItemRebarPlacer().setUnlocalizedName("rebar_placer").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setFull3D().setTextureName(RefStrings.MODID + ":rebar_placer");
|
||||
wand = new ItemWand().setUnlocalizedName("wand_k").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setFull3D().setTextureName(RefStrings.MODID + ":wand");
|
||||
wand_s = new ItemWandS().setUnlocalizedName("wand_s").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setFull3D().setTextureName(RefStrings.MODID + ":wand_s");
|
||||
wand_d = new ItemWandD().setUnlocalizedName("wand_d").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setFull3D().setTextureName(RefStrings.MODID + ":wand_d");
|
||||
@ -7047,7 +7050,8 @@ public class ModItems {
|
||||
GameRegistry.registerItem(crystal_horn, crystal_horn.getUnlocalizedName());
|
||||
GameRegistry.registerItem(crystal_charred, crystal_charred.getUnlocalizedName());
|
||||
|
||||
//OP Tools
|
||||
//Wands, Tools, Other Crap
|
||||
GameRegistry.registerItem(rebar_placer, rebar_placer.getUnlocalizedName());
|
||||
GameRegistry.registerItem(wand, wand.getUnlocalizedName());
|
||||
GameRegistry.registerItem(wand_s, wand_s.getUnlocalizedName());
|
||||
GameRegistry.registerItem(wand_d, wand_d.getUnlocalizedName());
|
||||
|
||||
337
src/main/java/com/hbm/items/tool/ItemRebarPlacer.java
Normal file
337
src/main/java/com/hbm/items/tool/ItemRebarPlacer.java
Normal file
@ -0,0 +1,337 @@
|
||||
package com.hbm.items.tool;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.generic.BlockConcreteColoredExt.EnumConcreteType;
|
||||
import com.hbm.blocks.generic.BlockRebar.TileEntityRebar;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.inventory.SlotPattern;
|
||||
import com.hbm.inventory.gui.GuiInfoContainer;
|
||||
import com.hbm.items.ItemInventory;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.util.ChatBuilder;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
import com.hbm.util.ItemStackUtil;
|
||||
import com.hbm.util.Tuple.Pair;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.Entity;
|
||||
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.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class ItemRebarPlacer extends Item implements IGUIProvider {
|
||||
|
||||
public static List<Pair<Block, Integer>> acceptableConk = new ArrayList();
|
||||
|
||||
public ItemRebarPlacer() {
|
||||
this.setMaxStackSize(1);
|
||||
|
||||
acceptableConk.add(new Pair(ModBlocks.concrete, 0));
|
||||
acceptableConk.add(new Pair(ModBlocks.concrete_rebar, 0));
|
||||
acceptableConk.add(new Pair(ModBlocks.concrete_smooth, 0));
|
||||
acceptableConk.add(new Pair(ModBlocks.concrete_pillar, 0));
|
||||
|
||||
for(int i = 0; i < 16; i++) acceptableConk.add(new Pair(ModBlocks.concrete_colored, i));
|
||||
for(int i = 0; i < EnumConcreteType.values().length; i++) acceptableConk.add(new Pair(ModBlocks.concrete_colored_ext, i));
|
||||
}
|
||||
|
||||
public static boolean isValidConk(Item item, int meta) {
|
||||
|
||||
for(Pair<Block, Integer> conk : acceptableConk) {
|
||||
if(item == Item.getItemFromBlock(conk.getKey()) && meta == conk.getValue()) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration(ItemStack stack) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// if the placer isn't equipped or no concrete is loaded, forget the cached position
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean held) {
|
||||
if(stack.hasTagCompound() && stack.stackTagCompound.hasKey("pos")) {
|
||||
ItemStack theConk = ItemStackUtil.readStacksFromNBT(stack, 1)[0];
|
||||
|
||||
if(!held || theConk == null) {
|
||||
stack.stackTagCompound.removeTag("pos");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!isValidConk(theConk.getItem(), theConk.getItemDamage())) {
|
||||
stack.stackTagCompound.removeTag("pos");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if(!world.isRemote && player.isSneaking()) player.openGui(MainRegistry.instance, 0, world, 0, 0, 0);
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float fx, float fy, float fz) {
|
||||
if(world.isRemote) return true;
|
||||
if(!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound();
|
||||
ItemStack theConk = ItemStackUtil.readStacksFromNBT(stack, 1)[0];
|
||||
|
||||
boolean hasConk = theConk != null && isValidConk(theConk.getItem(), theConk.getItemDamage());
|
||||
|
||||
if(!hasConk) {
|
||||
player.addChatMessage(ChatBuilder.start("[").color(EnumChatFormatting.DARK_AQUA)
|
||||
.nextTranslation(this.getUnlocalizedName() + ".name").color(EnumChatFormatting.DARK_AQUA)
|
||||
.next("] ").color(EnumChatFormatting.DARK_AQUA)
|
||||
.next("No valid concrete type set!").color(EnumChatFormatting.RED).flush());
|
||||
return true;
|
||||
}
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(side);
|
||||
|
||||
if(!stack.stackTagCompound.hasKey("pos")) {
|
||||
stack.stackTagCompound.setIntArray("pos", new int[] {x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ});
|
||||
} else {
|
||||
int rebarLeft = InventoryUtil.countAStackMatches(player, new ComparableStack(ModBlocks.rebar), true);
|
||||
if(rebarLeft <= 0) {
|
||||
player.addChatMessage(ChatBuilder.start("[").color(EnumChatFormatting.DARK_AQUA)
|
||||
.nextTranslation(this.getUnlocalizedName() + ".name").color(EnumChatFormatting.DARK_AQUA)
|
||||
.next("] ").color(EnumChatFormatting.DARK_AQUA)
|
||||
.next("Out of rebar!").color(EnumChatFormatting.RED).flush());
|
||||
stack.stackTagCompound.removeTag("pos");
|
||||
return true;
|
||||
}
|
||||
|
||||
int[] pos = stack.stackTagCompound.getIntArray("pos");
|
||||
int iX = x + dir.offsetX;
|
||||
int iY = y + dir.offsetY;
|
||||
int iZ = z + dir.offsetZ;
|
||||
|
||||
int minX = Math.min(pos[0], iX);
|
||||
int maxX = Math.max(pos[0], iX);
|
||||
int minY = Math.min(pos[1], iY);
|
||||
int maxY = Math.max(pos[1], iY);
|
||||
int minZ = Math.min(pos[2], iZ);
|
||||
int maxZ = Math.max(pos[2], iZ);
|
||||
|
||||
int rebarUsed = 0;
|
||||
|
||||
outer: for(int k = minY; k <= maxY; k++) {
|
||||
for(int j = minZ; j <= maxZ; j++) {
|
||||
for(int i = minX; i<= maxX; i++) {
|
||||
if(rebarLeft <= 0) break outer;
|
||||
|
||||
if(world.getBlock(i, k, j).isReplaceable(world, i, k, j) && player.canPlayerEdit(i, k, j, side, stack)) {
|
||||
world.setBlock(i, k, j, ModBlocks.rebar);
|
||||
TileEntity tile = world.getTileEntity(i, k, j);
|
||||
if(tile instanceof TileEntityRebar) {
|
||||
((TileEntityRebar) tile).setup(Block.getBlockFromItem(theConk.getItem()), theConk.getItemDamage());
|
||||
}
|
||||
rebarUsed++;
|
||||
rebarLeft--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
InventoryUtil.tryConsumeAStack(player.inventory.mainInventory, 0, player.inventory.mainInventory.length - 1, new ComparableStack(ModBlocks.rebar, rebarUsed));
|
||||
|
||||
player.addChatMessage(ChatBuilder.start("[").color(EnumChatFormatting.DARK_AQUA)
|
||||
.nextTranslation(this.getUnlocalizedName() + ".name").color(EnumChatFormatting.DARK_AQUA)
|
||||
.next("] ").color(EnumChatFormatting.DARK_AQUA)
|
||||
.next("Placed " + rebarUsed + " rebar!").color(EnumChatFormatting.GREEN).flush());
|
||||
|
||||
stack.stackTagCompound.removeTag("pos");
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerRebar(player.inventory, new InventoryRebar(player, player.getHeldItem()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIRebar(player.inventory, new InventoryRebar(player, player.getHeldItem()));
|
||||
}
|
||||
|
||||
public static class InventoryRebar extends ItemInventory {
|
||||
|
||||
public InventoryRebar(EntityPlayer player, ItemStack box) {
|
||||
this.player = player;
|
||||
this.target = box;
|
||||
slots = new ItemStack[this.getSizeInventory()];
|
||||
|
||||
if(!box.hasTagCompound()) box.setTagCompound(new NBTTagCompound());
|
||||
|
||||
ItemStack[] fromNBT = ItemStackUtil.readStacksFromNBT(box, slots.length);
|
||||
if(fromNBT != null) System.arraycopy(fromNBT, 0, slots, 0, slots.length);
|
||||
}
|
||||
|
||||
@Override public int getSizeInventory() { return 1; }
|
||||
@Override public String getInventoryName() { return "container.rebar"; }
|
||||
@Override public boolean hasCustomInventoryName() { return target.hasDisplayName(); }
|
||||
@Override public int getInventoryStackLimit() { return 1; }
|
||||
}
|
||||
|
||||
public static class ContainerRebar extends Container {
|
||||
|
||||
private InventoryRebar rebar;
|
||||
|
||||
public ContainerRebar(InventoryPlayer invPlayer, InventoryRebar rebar) {
|
||||
this.rebar = rebar;
|
||||
|
||||
this.addSlotToContainer(new SlotPattern(rebar, 0, 53, 36));
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 100 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 158));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick(int index, int button, int mode, EntityPlayer player) {
|
||||
|
||||
//L/R: 0
|
||||
//M3: 3
|
||||
//SHIFT: 1
|
||||
//DRAG: 5
|
||||
|
||||
// prevents the player from moving around the currently open box
|
||||
if(mode == 2 && button == player.inventory.currentItem) return null;
|
||||
if(index == player.inventory.currentItem + 47) return null;
|
||||
|
||||
if(index != 0) return super.slotClick(index, button, mode, player);
|
||||
|
||||
Slot slot = this.getSlot(index);
|
||||
|
||||
ItemStack ret = null;
|
||||
ItemStack held = player.inventory.getItemStack();
|
||||
|
||||
if(slot.getHasStack()) ret = slot.getStack().copy();
|
||||
slot.putStack(held);
|
||||
rebar.markDirty();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return rebar.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer player) {
|
||||
super.onContainerClosed(player);
|
||||
}
|
||||
}
|
||||
|
||||
public static class GUIRebar extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_rebar.png");
|
||||
private final InventoryRebar inventory;
|
||||
|
||||
public GUIRebar(InventoryPlayer invPlayer, InventoryRebar box) {
|
||||
super(new ContainerRebar(invPlayer, box));
|
||||
this.inventory = box;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 182;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
if(this.isMouseOverSlot(this.inventorySlots.getSlot(0), mouseX, mouseY) && !this.inventorySlots.getSlot(0).getHasStack()) {
|
||||
|
||||
List<Object[]> lines = new ArrayList();
|
||||
List<ItemStack> list = new ArrayList();
|
||||
for(Pair<Block, Integer> conk : acceptableConk) list.add(new ItemStack(conk.getKey(), 1, conk.getValue()));
|
||||
ItemStack selected = list.get(0);
|
||||
|
||||
if(list.size() > 1) {
|
||||
int cycle = (int) ((System.currentTimeMillis() % (1000 * list.size())) / 1000);
|
||||
selected = ((ItemStack) list.get(cycle)).copy();
|
||||
selected.stackSize = 0;
|
||||
list.set(cycle, selected);
|
||||
}
|
||||
|
||||
if(list.size() < 10) {
|
||||
lines.add(list.toArray());
|
||||
} else if(list.size() < 24) {
|
||||
lines.add(list.subList(0, list.size() / 2).toArray());
|
||||
lines.add(list.subList(list.size() / 2, list.size()).toArray());
|
||||
} else {
|
||||
int bound0 = (int) Math.ceil(list.size() / 3D);
|
||||
int bound1 = (int) Math.ceil(list.size() / 3D * 2D);
|
||||
lines.add(list.subList(0, bound0).toArray());
|
||||
lines.add(list.subList(bound0, bound1).toArray());
|
||||
lines.add(list.subList(bound1, list.size()).toArray());
|
||||
}
|
||||
|
||||
lines.add(new Object[] {I18nUtil.resolveKey(selected.getDisplayName())});
|
||||
this.drawStackText(lines, mouseX, mouseY, this.fontRendererObj);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = I18n.format(this.inventory.getInventoryName());
|
||||
if(inventory.hasCustomInventoryName()) name = inventory.target.getDisplayName();
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
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);
|
||||
|
||||
if(inventory.slots[0] == null || !ItemRebarPlacer.isValidConk(inventory.slots[0].getItem(), inventory.slots[0].getItemDamage()))
|
||||
drawTexturedModalRect(guiLeft + 87, guiTop + 17, 176, 0, 56, 56);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -458,7 +458,7 @@ public class CraftingManager {
|
||||
addRecipeAuto(new ItemStack(Item.getItemFromBlock(ModBlocks.steel_grate), 4), new Object[] { "SS", "SS", 'S', ModBlocks.steel_beam });
|
||||
addRecipeAuto(new ItemStack(Item.getItemFromBlock(ModBlocks.steel_grate_wide), 4), new Object[] { "SS", 'S', ModBlocks.steel_grate });
|
||||
addRecipeAuto(new ItemStack(Item.getItemFromBlock(ModBlocks.steel_grate), 1), new Object[] { "SS", 'S', ModBlocks.steel_grate_wide });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.rebar, 1), new Object[] { "BB", "BB", 'B', STEEL.bolt() });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.rebar, 8), new Object[] { "BB", "BB", 'B', STEEL.bolt() });
|
||||
|
||||
addRecipeAuto(new ItemStack(ModBlocks.steel_scaffold, 8, 0), new Object[] { "SSS", "SDS", "SSS", 'S', ModBlocks.steel_scaffold, 'D', "dyeGray" });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.steel_scaffold, 8, 1), new Object[] { "SSS", "SDS", "SSS", 'S', ModBlocks.steel_scaffold, 'D', "dyeRed" });
|
||||
|
||||
@ -449,6 +449,7 @@ container.reactor=Brutreaktor
|
||||
container.reactorControl=Reaktorfernsteuerung
|
||||
container.reactorLarge=Großer Atomreaktor
|
||||
container.reactorSmall=Atomreaktor
|
||||
container.rebar=Armiereisen-Platzierer
|
||||
container.reix=Rei-X Hauptrechner
|
||||
container.rtg=Radioisotopengenerator
|
||||
container.rtgFurnace=RTG-Ofen
|
||||
@ -3118,6 +3119,7 @@ item.rbmk_tool.set=RBMK verlinkt!
|
||||
item.reacher.name=Wolfram-Greifzange
|
||||
item.reactor_core.name=Brutreaktorkern
|
||||
item.reactor_sensor.name=Reaktor-Fernsensor
|
||||
item.rebar_placer.name=Armiereisen-Platzierer
|
||||
item.record.glass.desc=? ? ?
|
||||
item.record.lc.desc=Valve - Diabolic Adrenaline Guitar/Lambda Core
|
||||
item.record.ss.desc=Valve - Sector Sweep
|
||||
|
||||
@ -853,6 +853,7 @@ container.reactorBreeding=Breeding Reactor
|
||||
container.reactorControl=Reactor Remote Control Block
|
||||
container.reactorLarge=Big Nuclear Reactor
|
||||
container.reactorResearch=Research Reactor
|
||||
container.rebar=Rebar Placer
|
||||
container.reix=Rei-X Mainframe
|
||||
container.rtg=RT Generator
|
||||
container.rtgFurnace=RTG Furnace
|
||||
@ -4073,6 +4074,7 @@ item.rbmk_tool.set=RBMK linked!
|
||||
item.reacher.name=Tungsten Reacher
|
||||
item.reactor_core.name=Breeding Reactor Core
|
||||
item.reactor_sensor.name=Reactor Remote Sensor
|
||||
item.rebar_placer.name=Rebar Placer
|
||||
item.record.glass.desc=? ? ?
|
||||
item.record.lc.desc=Valve - Diabolic Adrenaline Guitar/Lambda Core
|
||||
item.record.ss.desc=Valve - Sector Sweep
|
||||
|
||||
BIN
src/main/resources/assets/hbm/textures/gui/gui_rebar.png
Normal file
BIN
src/main/resources/assets/hbm/textures/gui/gui_rebar.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
BIN
src/main/resources/assets/hbm/textures/items/rebar_placer.png
Normal file
BIN
src/main/resources/assets/hbm/textures/items/rebar_placer.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 513 B |
Loading…
x
Reference in New Issue
Block a user