mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
getting railed
This commit is contained in:
parent
9d6c7d6372
commit
aad9fadda3
@ -1105,8 +1105,9 @@ public class ModBlocks {
|
||||
|
||||
public static Block machine_waste_drum;
|
||||
public static Block machine_storage_drum;
|
||||
|
||||
|
||||
public static Block machine_autocrafter;
|
||||
public static Block machine_funnel;
|
||||
|
||||
public static Block anvil_iron;
|
||||
public static Block anvil_lead;
|
||||
@ -2344,6 +2345,7 @@ public class ModBlocks {
|
||||
machine_electrolyser = new MachineElectrolyser().setBlockName("machine_electrolyser").setHardness(10.0F).setResistance(20.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel_machine");
|
||||
|
||||
machine_autocrafter = new MachineAutocrafter().setBlockName("machine_autocrafter").setHardness(10.0F).setResistance(20.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_funnel = new MachineFunnel().setBlockName("machine_funnel").setHardness(10.0F).setResistance(20.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
|
||||
anvil_iron = new NTMAnvil(Material.iron, 1).setBlockName("anvil_iron").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_iron");
|
||||
anvil_lead = new NTMAnvil(Material.iron, 1).setBlockName("anvil_lead").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_lead");
|
||||
@ -3122,7 +3124,8 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(boat, boat.getUnlocalizedName());
|
||||
|
||||
//Machines
|
||||
GameRegistry.registerBlock(machine_autocrafter, ItemBlockBase.class, machine_autocrafter.getUnlocalizedName());
|
||||
register(machine_autocrafter);
|
||||
register(machine_funnel);
|
||||
|
||||
GameRegistry.registerBlock(anvil_iron, ItemBlockBase.class, anvil_iron.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(anvil_lead, ItemBlockBase.class, anvil_lead.getUnlocalizedName());
|
||||
|
||||
@ -24,10 +24,8 @@ import net.minecraft.world.World;
|
||||
|
||||
public class MachineAutocrafter extends BlockContainer {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBottom;
|
||||
@SideOnly(Side.CLIENT) private IIcon iconTop;
|
||||
@SideOnly(Side.CLIENT) private IIcon iconBottom;
|
||||
|
||||
public MachineAutocrafter() {
|
||||
super(Material.iron);
|
||||
@ -67,48 +65,48 @@ public class MachineAutocrafter extends BlockContainer {
|
||||
}
|
||||
}
|
||||
|
||||
private final Random field_149933_a = new Random();
|
||||
private final Random rand = new Random();
|
||||
|
||||
@Override
|
||||
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) {
|
||||
ISidedInventory tileentityfurnace = (ISidedInventory) p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_);
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
ISidedInventory tile = (ISidedInventory) world.getTileEntity(x, y, z);
|
||||
|
||||
if(tileentityfurnace != null) {
|
||||
if(tile != null) {
|
||||
|
||||
for(int i1 = 10; i1 < tileentityfurnace.getSizeInventory(); ++i1) {
|
||||
ItemStack itemstack = tileentityfurnace.getStackInSlot(i1);
|
||||
for(int i1 = 10; i1 < tile.getSizeInventory(); ++i1) {
|
||||
ItemStack itemstack = tile.getStackInSlot(i1);
|
||||
|
||||
if(itemstack != null) {
|
||||
float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f = this.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = this.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = this.rand.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while(itemstack.stackSize > 0) {
|
||||
int j1 = this.field_149933_a.nextInt(21) + 10;
|
||||
int j1 = this.rand.nextInt(21) + 10;
|
||||
|
||||
if(j1 > itemstack.stackSize) {
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
if(itemstack.hasTagCompound()) {
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) this.field_149933_a.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) this.field_149933_a.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) this.field_149933_a.nextGaussian() * f3;
|
||||
p_149749_1_.spawnEntityInWorld(entityitem);
|
||||
entityitem.motionX = (float) this.rand.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) this.rand.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) this.rand.nextGaussian() * f3;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_);
|
||||
world.func_147453_f(x, y, z, block);
|
||||
}
|
||||
|
||||
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
}
|
||||
|
||||
138
src/main/java/com/hbm/blocks/machine/MachineFunnel.java
Normal file
138
src/main/java/com/hbm/blocks/machine/MachineFunnel.java
Normal file
@ -0,0 +1,138 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.blocks.rail.IRenderBlock;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.util.ObjUtil;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineFunnel;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.obj.WavefrontObject;
|
||||
|
||||
public class MachineFunnel extends BlockContainer implements ITooltipProvider, IRenderBlock {
|
||||
|
||||
@SideOnly(Side.CLIENT) private IIcon iconTop;
|
||||
@SideOnly(Side.CLIENT) private IIcon iconBottom;
|
||||
|
||||
public MachineFunnel() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
@Override public int getRenderType() { return renderID; }
|
||||
@Override public boolean isOpaqueCube() { return false; }
|
||||
@Override public boolean renderAsNormalBlock() { return false; }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":machine_funnel_top");
|
||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_funnel_side");
|
||||
this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + ":machine_funnel_bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return side == 1 ? this.iconTop : (side == 0 ? this.iconBottom : this.blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityMachineFunnel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote) {
|
||||
return true;
|
||||
} else if(!player.isSneaking()) {
|
||||
TileEntity entity = world.getTileEntity(x, y, z);
|
||||
if(entity instanceof TileEntityMachineFunnel) {
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private final Random rand = new Random();
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
ISidedInventory tile = (ISidedInventory) world.getTileEntity(x, y, z);
|
||||
if(tile != null) {
|
||||
for(int i1 = 0; i1 < tile.getSizeInventory(); ++i1) {
|
||||
ItemStack itemstack = tile.getStackInSlot(i1);
|
||||
if(itemstack != null) {
|
||||
float f = this.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = this.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = this.rand.nextFloat() * 0.8F + 0.1F;
|
||||
while(itemstack.stackSize > 0) {
|
||||
int j1 = this.rand.nextInt(21) + 10;
|
||||
if(j1 > itemstack.stackSize) j1 = itemstack.stackSize;
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
if(itemstack.hasTagCompound()) entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) this.rand.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) this.rand.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) this.rand.nextGaussian() * f3;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
world.func_147453_f(x, y, z, block);
|
||||
}
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
this.addStandardInfo(stack, player, list, ext);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderInventory(Tessellator tessellator, Block block, int metadata) {
|
||||
GL11.glTranslatef(0F, -0.5F, 0F);
|
||||
tessellator.startDrawingQuads();
|
||||
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.funnel, "Top", block.getIcon(1, 0), tessellator, 0, false);
|
||||
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.funnel, "Bottom", block.getIcon(0, 0), tessellator, 0, false);
|
||||
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.funnel, "Side", block.getIcon(2, 0), tessellator, 0, false);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderWorld(Tessellator tessellator, Block block, int meta, IBlockAccess world, int x, int y, int z) {
|
||||
tessellator.addTranslation(x + 0.5F, y, z + 0.5F);
|
||||
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.funnel, "Top", block.getIcon(1, 0), tessellator, 0, true);
|
||||
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.funnel, "Bottom", block.getIcon(0, 0), tessellator, 0, true);
|
||||
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.funnel, "Side", block.getIcon(2, 0), tessellator, 0, true);
|
||||
tessellator.addTranslation(-x - 0.5F, -y, -z - 0.5F);
|
||||
}
|
||||
}
|
||||
@ -7,7 +7,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public interface IRenderRail {
|
||||
public interface IRenderBlock {
|
||||
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@ -22,7 +22,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.obj.WavefrontObject;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class RailNarrowCurve extends BlockDummyable implements IRailNTM, IRenderRail {
|
||||
public class RailNarrowCurve extends BlockDummyable implements IRailNTM, IRenderBlock {
|
||||
|
||||
public RailNarrowCurve() {
|
||||
super(Material.iron);
|
||||
|
||||
@ -22,7 +22,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.obj.WavefrontObject;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class RailNarrowStraight extends BlockDummyable implements IRailNTM, IRenderRail {
|
||||
public class RailNarrowStraight extends BlockDummyable implements IRailNTM, IRenderBlock {
|
||||
|
||||
public RailNarrowStraight() {
|
||||
super(Material.iron);
|
||||
|
||||
@ -21,7 +21,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.obj.WavefrontObject;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class RailStandardBuffer extends BlockDummyable implements IRailNTM, IRenderRail {
|
||||
public class RailStandardBuffer extends BlockDummyable implements IRailNTM, IRenderBlock {
|
||||
|
||||
public RailStandardBuffer() {
|
||||
super(Material.iron);
|
||||
|
||||
@ -22,7 +22,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.obj.WavefrontObject;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class RailStandardCurve extends BlockDummyable implements IRailNTM, IRenderRail {
|
||||
public class RailStandardCurve extends BlockDummyable implements IRailNTM, IRenderBlock {
|
||||
|
||||
public RailStandardCurve() {
|
||||
super(Material.iron);
|
||||
|
||||
@ -22,7 +22,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.obj.WavefrontObject;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class RailStandardCurveWide extends BlockDummyable implements IRailNTM, IRenderRail {
|
||||
public class RailStandardCurveWide extends BlockDummyable implements IRailNTM, IRenderBlock {
|
||||
|
||||
public RailStandardCurveWide() {
|
||||
super(Material.iron);
|
||||
|
||||
@ -23,7 +23,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.obj.WavefrontObject;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class RailStandardRamp extends BlockDummyable implements IRailNTM, IRenderRail {
|
||||
public class RailStandardRamp extends BlockDummyable implements IRailNTM, IRenderBlock {
|
||||
|
||||
public RailStandardRamp() {
|
||||
super(Material.iron);
|
||||
|
||||
@ -22,7 +22,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.obj.WavefrontObject;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class RailStandardStraight extends BlockDummyable implements IRailNTM, IRenderRail {
|
||||
public class RailStandardStraight extends BlockDummyable implements IRailNTM, IRenderBlock {
|
||||
|
||||
public RailStandardStraight() {
|
||||
super(Material.iron);
|
||||
|
||||
@ -22,7 +22,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.obj.WavefrontObject;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class RailStandardStraightShort extends BlockDummyable implements IRailNTM, IRenderRail {
|
||||
public class RailStandardStraightShort extends BlockDummyable implements IRailNTM, IRenderBlock {
|
||||
|
||||
public RailStandardStraightShort() {
|
||||
super(Material.iron);
|
||||
|
||||
@ -28,7 +28,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.obj.WavefrontObject;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class RailStandardSwitch extends BlockRailWaypointSystem implements IRenderRail {
|
||||
public class RailStandardSwitch extends BlockRailWaypointSystem implements IRenderBlock {
|
||||
|
||||
@SideOnly(Side.CLIENT) private IIcon iconSign;
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.obj.WavefrontObject;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class RailStandardSwitchFlipped extends BlockRailWaypointSystem implements IRenderRail {
|
||||
public class RailStandardSwitchFlipped extends BlockRailWaypointSystem implements IRenderBlock {
|
||||
|
||||
@SideOnly(Side.CLIENT) private IIcon iconSign;
|
||||
|
||||
|
||||
@ -362,7 +362,7 @@ public class OreDictManager {
|
||||
TCALLOY .ingot(ingot_tcalloy) .dust(powder_tcalloy) .block(block_tcalloy);
|
||||
CDALLOY .ingot(ingot_cdalloy) .block(block_cdalloy);
|
||||
PB .nugget(nugget_lead) .ingot(ingot_lead) .dust(powder_lead) .plate(plate_lead) .block(block_lead) .ore(ore_lead, ore_meteor_lead);
|
||||
BI .nugget(nugget_bismuth) .billet(billet_bismuth) .ingot(ingot_bismuth) .dust(powder_bismuth);
|
||||
BI .nugget(nugget_bismuth) .billet(billet_bismuth) .ingot(ingot_bismuth) .dust(powder_bismuth) .block(block_bismuth);
|
||||
AS .nugget(nugget_arsenic) .ingot(ingot_arsenic);
|
||||
CA .ingot(ingot_calcium) .dust(powder_calcium);
|
||||
CD .ingot(ingot_cadmium) .dust(powder_cadmium) .block(block_cadmium);
|
||||
|
||||
@ -0,0 +1,64 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotCraftingOutput;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineFunnel;
|
||||
|
||||
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 ContainerFunnel extends Container {
|
||||
|
||||
private TileEntityMachineFunnel funnel;
|
||||
|
||||
public ContainerFunnel(InventoryPlayer playerInv, TileEntityMachineFunnel tile) {
|
||||
funnel = tile;
|
||||
|
||||
for(int i = 0; i < 9; i++) this.addSlotToContainer(new Slot(tile, i, 8 + 18 * i, 18));
|
||||
for(int i = 0; i < 9; i++) this.addSlotToContainer(new SlotCraftingOutput(playerInv.player, tile, i + 9, 8 + 18 * i, 54));
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 86 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 144));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return funnel.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) this.inventorySlots.get(index);
|
||||
|
||||
if(var4 != null && var4.getHasStack()) {
|
||||
ItemStack var5 = var4.getStack();
|
||||
var3 = var5.copy();
|
||||
|
||||
if(index <= 17) {
|
||||
if(!this.mergeItemStack(var5, 18, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else if(!this.mergeItemStack(var5, 0, 9, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if(var5.stackSize == 0) {
|
||||
var4.putStack((ItemStack) null);
|
||||
} else {
|
||||
var4.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
}
|
||||
42
src/main/java/com/hbm/inventory/gui/GUIFunnel.java
Normal file
42
src/main/java/com/hbm/inventory/gui/GUIFunnel.java
Normal file
@ -0,0 +1,42 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerFunnel;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineFunnel;
|
||||
|
||||
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.util.ResourceLocation;
|
||||
|
||||
public class GUIFunnel extends GuiContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_funnel.png");
|
||||
private TileEntityMachineFunnel funnel;
|
||||
|
||||
public GUIFunnel(InventoryPlayer invPlayer, TileEntityMachineFunnel tedf) {
|
||||
super(new ContainerFunnel(invPlayer, tedf));
|
||||
funnel = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 168;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.funnel.hasCustomInventoryName() ? this.funnel.getInventoryName() : I18n.format(this.funnel.getInventoryName());
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -312,6 +312,7 @@ public class CraftingManager {
|
||||
addRecipeAuto(new ItemStack(ModBlocks.mass_storage, 1, 2), new Object[] { "PCP", "PMP", "PPP", 'P', ANY_RESISTANTALLOY.ingot(), 'C', ModItems.circuit_gold, 'M', new ItemStack(ModBlocks.mass_storage, 1, 1) });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.mass_storage, 1, 3), new Object[] { "PPP", "PIP", "PPP", 'P', KEY_PLANKS, 'I', IRON.plate() });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.machine_autocrafter, 1), new Object[] { "SCS", "MWM", "SCS", 'S', STEEL.plate(), 'C', ModItems.circuit_copper, 'M', ModItems.motor, 'W', Blocks.crafting_table });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.machine_funnel, 1), new Object[] { "S S", "SRS", " S ", 'S', STEEL.ingot(), 'R', REDSTONE.dust() });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.machine_waste_drum, 1), new Object[] { "LRL", "BRB", "LRL", 'L', PB.ingot(), 'B', Blocks.iron_bars, 'R', ModItems.rod_quad_empty });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.machine_press, 1), new Object[] { "IRI", "IPI", "IBI", 'I', IRON.ingot(), 'R', Blocks.furnace, 'B', IRON.block(), 'P', Blocks.piston });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.machine_siren, 1), new Object[] { "SIS", "ICI", "SRS", 'S', STEEL.plate(), 'I', ANY_RUBBER.ingot(), 'C', ModItems.circuit_copper, 'R', REDSTONE.dust() });
|
||||
|
||||
@ -1472,6 +1472,7 @@ public class ResourceManager {
|
||||
public static final IModelCustom rail_standard_switch = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/rail_standard_switch.obj"));
|
||||
public static final IModelCustom rail_standard_switch_flipped = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/rail_standard_switch_flipped.obj"));
|
||||
public static final IModelCustom capacitor = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/capacitor.obj"));
|
||||
public static final IModelCustom funnel = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/funnel.obj"));
|
||||
|
||||
public static final IModelCustom charge_dynamite = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/charge_dynamite.obj"));
|
||||
public static final IModelCustom charge_c4 = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/charge_c4.obj"));
|
||||
|
||||
@ -2,7 +2,7 @@ package com.hbm.render.block;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.rail.IRenderRail;
|
||||
import com.hbm.blocks.rail.IRenderBlock;
|
||||
import com.hbm.blocks.rail.RailStandardStraight;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
@ -17,7 +17,7 @@ public class RenderRail implements ISimpleBlockRenderingHandler {
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
GL11.glPushMatrix();
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
IRenderRail rail = (IRenderRail) block;
|
||||
IRenderBlock rail = (IRenderBlock) block;
|
||||
rail.renderInventory(tessellator, block, metadata);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
@ -28,7 +28,7 @@ public class RenderRail implements ISimpleBlockRenderingHandler {
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
tessellator.setColorOpaque_F(1, 1, 1);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
IRenderRail rail = (IRenderRail) block;
|
||||
IRenderBlock rail = (IRenderBlock) block;
|
||||
rail.renderWorld(tessellator, block, meta, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -297,8 +297,9 @@ public class TileMappings {
|
||||
put(TileEntityFoundryOutlet.class, "tileentity_foundry_outlet");
|
||||
put(TileEntityFoundrySlagtap.class, "tileentity_foundry_slagtap");
|
||||
put(TileEntitySlag.class, "tileentity_foundry_slag");
|
||||
|
||||
|
||||
put(TileEntityMachineAutocrafter.class, "tileentity_autocrafter");
|
||||
put(TileEntityMachineFunnel.class, "tileentity_funnel");
|
||||
put(TileEntityDiFurnaceRTG.class, "tileentity_rtg_difurnace");
|
||||
put(TileEntityMachineRadiolysis.class, "tileentity_radiolysis");
|
||||
put(TileEntityUVLamp.class, "tileentity_uv_lamp");
|
||||
|
||||
@ -369,6 +369,10 @@ public class TileEntityMachineAutocrafter extends TileEntityMachineBase implemen
|
||||
}
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
for(int i = 0; i < this.getSizeInventory(); i++) this.setInventorySlotContents(i, null);
|
||||
}
|
||||
|
||||
public static class ContainerBlank extends Container {
|
||||
@Override public void onCraftMatrixChanged(IInventory inventory) { }
|
||||
@Override public boolean canInteractWith(EntityPlayer player) { return false; }
|
||||
|
||||
@ -0,0 +1,118 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.inventory.container.ContainerFunnel;
|
||||
import com.hbm.inventory.gui.GUIFunnel;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineAutocrafter.InventoryCraftingAuto;
|
||||
|
||||
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.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityMachineFunnel extends TileEntityMachineBase implements IGUIProvider {
|
||||
|
||||
public TileEntityMachineFunnel() {
|
||||
super(18);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "container.machineFunnel";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
|
||||
if(slots[i] != null) {
|
||||
int stacksize = 9;
|
||||
ItemStack compressed = slots[i].stackSize < 9 ? null : this.getFrom9(slots[i]);
|
||||
if(compressed == null) {
|
||||
compressed = slots[i].stackSize < 4 ? null : this.getFrom4(slots[i]);
|
||||
stacksize = 4;
|
||||
}
|
||||
|
||||
if(compressed != null && slots[i].stackSize >= stacksize) {
|
||||
if(slots[i + 9] == null) {
|
||||
slots[i + 9] = compressed.copy();
|
||||
this.decrStackSize(i, stacksize);
|
||||
} else if(slots[i + 9].getItem() == compressed.getItem() && slots[i + 9].getItemDamage() == compressed.getItemDamage() && slots[i + 9].stackSize + compressed.stackSize <= compressed.getMaxStackSize()) {
|
||||
slots[i + 9].stackSize += compressed.stackSize;
|
||||
this.decrStackSize(i, stacksize);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int[] topAccess = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
|
||||
public int[] bottomAccess = new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 17 };
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return side == 0 ? bottomAccess : topAccess;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack stack, int j) {
|
||||
if(j == 0) return i > 8;
|
||||
return j != 1 && i < 9;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
if(slot > 8) return false;
|
||||
return this.getFrom9(stack) != null || this.getFrom4(stack) != null;
|
||||
}
|
||||
|
||||
protected InventoryCraftingAuto craftingInventory = new InventoryCraftingAuto(3, 3);
|
||||
|
||||
public ItemStack getFrom4(ItemStack ingredient) {
|
||||
this.craftingInventory.clear();
|
||||
this.craftingInventory.setInventorySlotContents(0, ingredient.copy());
|
||||
this.craftingInventory.setInventorySlotContents(1, ingredient.copy());
|
||||
this.craftingInventory.setInventorySlotContents(3, ingredient.copy());
|
||||
this.craftingInventory.setInventorySlotContents(4, ingredient.copy());
|
||||
return getMatch(this.craftingInventory);
|
||||
}
|
||||
|
||||
public ItemStack getFrom9(ItemStack ingredient) {
|
||||
this.craftingInventory.clear();
|
||||
for(int i = 0; i < 9; i++) this.craftingInventory.setInventorySlotContents(i, ingredient.copy());
|
||||
return getMatch(this.craftingInventory);
|
||||
}
|
||||
|
||||
public ItemStack getMatch(InventoryCrafting grid) {
|
||||
for(Object o : CraftingManager.getInstance().getRecipeList()) {
|
||||
IRecipe recipe = (IRecipe) o;
|
||||
|
||||
if(recipe.matches(grid, worldObj)) {
|
||||
return recipe.getCraftingResult(grid);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerFunnel(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIFunnel(player.inventory, this);
|
||||
}
|
||||
}
|
||||
@ -352,6 +352,7 @@ container.machineDiesel=Dieselgenerator
|
||||
container.machineElectricBoiler=Elektrischer Ölwärmer
|
||||
container.machineElectrolyser=Electrolysegerät
|
||||
container.machineFEL=FEL
|
||||
container.machineFunnel=Kombinationstrichter
|
||||
container.machineITER=Kernfusionsreaktor
|
||||
container.machineLargeTurbine=Industrielle Dampfturbine
|
||||
container.machineLiquefactor=Verflüssiger
|
||||
@ -4129,6 +4130,8 @@ tile.machine_fluidtank.name=Tank
|
||||
tile.machine_forcefield.name=Kraftfeldgenerator
|
||||
tile.machine_fracking_tower.name=Hydraulischer Frackingturm
|
||||
tile.machine_fraction_tower.name=Fraktionierungsturm
|
||||
tile.machine_funnel.name=Kombinationstrichter
|
||||
tile.machine_funnel.desc=Verbindet Items in einem 2x2 oder 3x3 Craftingfeld$Oben: Input$Unten: Output$Seite: Output für Item-Eingang
|
||||
tile.machine_gascent.name=Gaszentrifuge
|
||||
tile.machine_generator.name=Atomreaktor (Alt)
|
||||
tile.machine_geo.name=Geothermiegenerator
|
||||
|
||||
@ -711,6 +711,7 @@ container.machineDiesel=Diesel Generator
|
||||
container.machineElectricBoiler=Electric Oil Heater
|
||||
container.machineElectrolyser=Electrolysis Machine
|
||||
container.machineFEL=FEL
|
||||
container.machineFunnel=Combinator Funnel
|
||||
container.machineITER=Fusion Reactor
|
||||
container.machineLargeTurbine=Industrial Steam Turbine
|
||||
container.machineLiquefactor=Liquefactor
|
||||
@ -5125,6 +5126,8 @@ tile.machine_fluidtank.name=Tank
|
||||
tile.machine_forcefield.name=Forcefield Emitter
|
||||
tile.machine_fraction_tower.name=Fractioning Tower
|
||||
tile.machine_fracking_tower.name=Hydraulic Fracking Tower
|
||||
tile.machine_funnel.name=Combinator Funnel
|
||||
tile.machine_funnel.desc=Automatically compresses items in a 2x2 or 3x3 crafting grid$Top: Input$Bottom: Output$Side: Output for clearing incredients
|
||||
tile.machine_gascent.name=Gas Centrifuge
|
||||
tile.machine_generator.name=Nuclear Reactor (Old)
|
||||
tile.machine_geo.name=Geothermal Electric Generator
|
||||
|
||||
90
src/main/resources/assets/hbm/models/blocks/funnel.obj
Normal file
90
src/main/resources/assets/hbm/models/blocks/funnel.obj
Normal file
@ -0,0 +1,90 @@
|
||||
# Blender v2.79 (sub 0) OBJ File: 'funnel.blend'
|
||||
# www.blender.org
|
||||
o Bottom
|
||||
v -0.250000 0.000000 0.250000
|
||||
v -0.250000 0.000000 -0.250000
|
||||
v 0.250000 0.000000 0.250000
|
||||
v 0.250000 0.000000 -0.250000
|
||||
vt 0.750000 0.750000
|
||||
vt 0.250000 0.250000
|
||||
vt 0.750000 0.250000
|
||||
vt 0.250000 0.750000
|
||||
vn 0.0000 -1.0000 0.0000
|
||||
s off
|
||||
f 4/1/1 1/2/1 2/3/1
|
||||
f 4/1/1 3/4/1 1/2/1
|
||||
o Top
|
||||
v -0.500000 1.000000 0.500000
|
||||
v -0.500000 1.000000 -0.500000
|
||||
v 0.500000 1.000000 0.500000
|
||||
v 0.500000 1.000000 -0.500000
|
||||
vt 1.000000 1.000000
|
||||
vt -0.000000 0.000000
|
||||
vt 1.000000 0.000000
|
||||
vt -0.000000 1.000000
|
||||
vn 0.0000 1.0000 0.0000
|
||||
s off
|
||||
f 6/5/2 7/6/2 8/7/2
|
||||
f 6/5/2 5/8/2 7/6/2
|
||||
o Side
|
||||
v -0.250000 0.000000 0.250000
|
||||
v -0.500000 1.000000 0.500000
|
||||
v -0.250000 0.000000 -0.250000
|
||||
v -0.500000 1.000000 -0.500000
|
||||
v 0.250000 0.000000 0.250000
|
||||
v 0.500000 1.000000 0.500000
|
||||
v 0.250000 0.000000 -0.250000
|
||||
v 0.500000 1.000000 -0.500000
|
||||
v -0.500000 0.500000 0.500000
|
||||
v -0.500000 0.500000 -0.500000
|
||||
v 0.500000 0.500000 -0.500000
|
||||
v 0.500000 0.500000 0.500000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 0.500000
|
||||
vt 1.000000 0.500000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 0.500000
|
||||
vt 1.000000 0.500000
|
||||
vt 1.000000 1.000000
|
||||
vt -0.000000 0.500000
|
||||
vt 1.000000 0.500000
|
||||
vt 1.000000 1.000000
|
||||
vt -0.000000 0.500000
|
||||
vt 1.000000 0.500000
|
||||
vt 0.250000 0.000000
|
||||
vt 0.750000 0.000000
|
||||
vt 0.250000 0.000000
|
||||
vt 0.750000 0.000000
|
||||
vt 0.250000 0.000000
|
||||
vt 0.750000 0.000000
|
||||
vt 0.250000 0.000000
|
||||
vt 0.750000 -0.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 0.000097 0.999903
|
||||
vt 0.000097 0.999903
|
||||
vn -1.0000 0.0000 0.0000
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
vn 1.0000 0.0000 0.0000
|
||||
vn 0.0000 0.0000 1.0000
|
||||
vn 0.0000 -0.4472 0.8944
|
||||
vn 0.8944 -0.4472 0.0000
|
||||
vn 0.0000 -0.4472 -0.8944
|
||||
vn -0.8944 -0.4472 0.0000
|
||||
s off
|
||||
f 10/9/3 18/10/3 17/11/3
|
||||
f 12/12/4 19/13/4 18/14/4
|
||||
f 16/15/5 20/16/5 19/17/5
|
||||
f 14/18/6 17/19/6 20/20/6
|
||||
f 20/20/7 9/21/7 13/22/7
|
||||
f 19/17/8 13/23/8 15/24/8
|
||||
f 18/14/9 15/25/9 11/26/9
|
||||
f 17/11/10 11/27/10 9/28/10
|
||||
f 10/9/3 12/29/3 18/10/3
|
||||
f 12/12/4 16/30/4 19/13/4
|
||||
f 16/15/5 14/31/5 20/16/5
|
||||
f 14/18/6 10/32/6 17/19/6
|
||||
f 20/20/7 17/19/7 9/21/7
|
||||
f 19/17/8 20/16/8 13/23/8
|
||||
f 18/14/9 19/13/9 15/25/9
|
||||
f 17/11/10 18/10/10 11/27/10
|
||||
BIN
src/main/resources/assets/hbm/textures/blocks/machine_funnel.png
Normal file
BIN
src/main/resources/assets/hbm/textures/blocks/machine_funnel.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 263 B |
Binary file not shown.
|
After Width: | Height: | Size: 304 B |
Binary file not shown.
|
After Width: | Height: | Size: 305 B |
Binary file not shown.
|
After Width: | Height: | Size: 316 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Loading…
x
Reference in New Issue
Block a user