molds and channels and basins
@ -25,6 +25,7 @@ import net.minecraft.stats.StatList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@ -420,7 +421,8 @@ public abstract class BlockDummyable extends BlockContainer {
|
||||
}
|
||||
|
||||
public List<AxisAlignedBB> bounding = new ArrayList();
|
||||
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB entityBounding, List list, Entity entity) {
|
||||
|
||||
if(!this.useDetailedHitbox()) {
|
||||
@ -462,4 +464,13 @@ public abstract class BlockDummyable extends BlockContainer {
|
||||
|
||||
return AxisAlignedBB.getBoundingBox(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ).offset(x + 0.5, y + 0.5, z + 0.5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
if(!this.useDetailedHitbox()) {
|
||||
super.setBlockBoundsBasedOnState(world, x, y, z);
|
||||
} else {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.999F, 1.0F); //for some fucking reason setting maxY to something that isn't 1 magically fixes item collisions
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,23 +1,24 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityFoundryBasin;
|
||||
|
||||
import api.hbm.block.ICrucibleAcceptor;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class FoundryBasin extends BlockContainer implements ICrucibleAcceptor {
|
||||
public class FoundryBasin extends FoundryCastingBase {
|
||||
|
||||
@SideOnly(Side.CLIENT) public IIcon iconTop;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconSide;
|
||||
@ -25,7 +26,7 @@ public class FoundryBasin extends BlockContainer implements ICrucibleAcceptor {
|
||||
@SideOnly(Side.CLIENT) public IIcon iconInner;
|
||||
|
||||
public FoundryBasin() {
|
||||
super(Material.rock);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -38,24 +39,39 @@ public class FoundryBasin extends BlockContainer implements ICrucibleAcceptor {
|
||||
this.iconInner = iconRegister.registerIcon(RefStrings.MODID + ":foundry_basin_inner");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityFoundryBasin();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptPartialPour(World world, int x, int y, int z, double dX, double dY, double dZ, ForgeDirection side, MaterialStack stack) {
|
||||
return ((TileEntityFoundryBasin) world.getTileEntity(x, y, z)).canAcceptPartialPour(world, x, y, z, dX, dY, dZ, side, stack);
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB entityBounding, List list, Entity entity) {
|
||||
|
||||
AxisAlignedBB[] bbs = new AxisAlignedBB[] {
|
||||
AxisAlignedBB.getBoundingBox(x, y, z, x + 1D, y + 0.125D, z + 1D),
|
||||
AxisAlignedBB.getBoundingBox(x, y, z, x + 1D, y + 1D, z + 0.125D),
|
||||
AxisAlignedBB.getBoundingBox(x, y, z, x + 0.125D, y + 1D, z + 1D),
|
||||
AxisAlignedBB.getBoundingBox(x + 0.875D, y, z, x + 1D, y + 1D, z + 1D),
|
||||
AxisAlignedBB.getBoundingBox(x, y, z + 0.875, x + 1D, y + 1D, z + 1D),
|
||||
};
|
||||
|
||||
for(AxisAlignedBB bb : bbs) {
|
||||
if(entityBounding.intersectsWith(bb)) {
|
||||
list.add(bb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialStack pour(World world, int x, int y, int z, double dX, double dY, double dZ, ForgeDirection side, MaterialStack stack) {
|
||||
return ((TileEntityFoundryBasin) world.getTileEntity(x, y, z)).pour(world, x, y, z, dX, dY, dZ, side, stack);
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.999F, 1.0F); //for some fucking reason setting maxY to something that isn't 1 magically fixes item collisions
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
setBlockBoundsBasedOnState(world, x, y, z);
|
||||
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
||||
}
|
||||
|
||||
@Override public boolean canAcceptPartialFlow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) { return false; }
|
||||
@ -67,14 +83,4 @@ public class FoundryBasin extends BlockContainer implements ICrucibleAcceptor {
|
||||
public int getRenderType() {
|
||||
return renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
54
src/main/java/com/hbm/blocks/machine/FoundryCastingBase.java
Normal file
@ -0,0 +1,54 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||
|
||||
import api.hbm.block.ICrucibleAcceptor;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public abstract class FoundryCastingBase extends BlockContainer implements ICrucibleAcceptor {
|
||||
|
||||
protected FoundryCastingBase() {
|
||||
super(Material.rock);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptPartialPour(World world, int x, int y, int z, double dX, double dY, double dZ, ForgeDirection side, MaterialStack stack) {
|
||||
return ((ICrucibleAcceptor) world.getTileEntity(x, y, z)).canAcceptPartialPour(world, x, y, z, dX, dY, dZ, side, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialStack pour(World world, int x, int y, int z, double dX, double dY, double dZ, ForgeDirection side, MaterialStack stack) {
|
||||
return ((ICrucibleAcceptor) world.getTileEntity(x, y, z)).pour(world, x, y, z, dX, dY, dZ, side, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptPartialFlow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) {
|
||||
return ((ICrucibleAcceptor) world.getTileEntity(x, y, z)).canAcceptPartialFlow(world, x, y, z, side, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialStack flow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) {
|
||||
return ((ICrucibleAcceptor) world.getTileEntity(x, y, z)).flow(world, x, y, z, side, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,11 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityFoundryChannel;
|
||||
|
||||
@ -13,7 +17,9 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
@ -52,6 +58,43 @@ public class FoundryChannel extends BlockContainer implements ICrucibleAcceptor
|
||||
return new TileEntityFoundryChannel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB entityBounding, List list, Entity entity) {
|
||||
|
||||
List<AxisAlignedBB> bbs = new ArrayList();
|
||||
|
||||
bbs.add(AxisAlignedBB.getBoundingBox(x + 0.3125D, y, z + 0.3125D, x + 0.6875D, y + 0.5D, z + 0.6875D));
|
||||
|
||||
if(canConnectTo(world, x, y, z, Library.POS_X)) bbs.add(AxisAlignedBB.getBoundingBox(x + 0.6875D, y, z + 0.3125D, x + 1D, y + 0.5D, z + 0.6875D));
|
||||
if(canConnectTo(world, x, y, z, Library.NEG_X)) bbs.add(AxisAlignedBB.getBoundingBox(x, y, z + 0.3125D, x + 0.3125D, y + 0.5D, z + 0.6875D));
|
||||
if(canConnectTo(world, x, y, z, Library.POS_Z)) bbs.add(AxisAlignedBB.getBoundingBox(x + 0.3125D, y, z + 0.6875D, x + 0.6875D, y + 0.5D, z + 1D));
|
||||
if(canConnectTo(world, x, y, z, Library.NEG_Z)) bbs.add(AxisAlignedBB.getBoundingBox(x + 0.3125D, y, z, x + 0.6875D, y + 0.5D, z + 0.3125D));
|
||||
|
||||
for(AxisAlignedBB bb : bbs) {
|
||||
if(entityBounding.intersectsWith(bb)) {
|
||||
list.add(bb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
setBlockBoundsBasedOnState(world, x, y, z);
|
||||
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
this.setBlockBounds(
|
||||
canConnectTo(world, x, y, z, Library.NEG_X) ? 0F : 0.3125F,
|
||||
0F,
|
||||
canConnectTo(world, x, y, z, Library.NEG_Z) ? 0F : 0.3125F,
|
||||
canConnectTo(world, x, y, z, Library.POS_X) ? 1F : 0.6875F,
|
||||
0.5F,
|
||||
canConnectTo(world, x, y, z, Library.POS_Z) ? 1F : 0.6875F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptPartialPour(World world, int x, int y, int z, double dX, double dY, double dZ, ForgeDirection side, MaterialStack stack) {
|
||||
return ((TileEntityFoundryChannel) world.getTileEntity(x, y, z)).canAcceptPartialPour(world, x, y, z, dX, dY, dZ, side, stack);
|
||||
|
||||
@ -1,23 +1,22 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityFoundryMold;
|
||||
|
||||
import api.hbm.block.ICrucibleAcceptor;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class FoundryMold extends BlockContainer implements ICrucibleAcceptor {
|
||||
public class FoundryMold extends FoundryCastingBase {
|
||||
|
||||
@SideOnly(Side.CLIENT) public IIcon iconTop;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconSide;
|
||||
@ -25,7 +24,7 @@ public class FoundryMold extends BlockContainer implements ICrucibleAcceptor {
|
||||
@SideOnly(Side.CLIENT) public IIcon iconInner;
|
||||
|
||||
public FoundryMold() {
|
||||
super(Material.rock);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -38,34 +37,38 @@ public class FoundryMold extends BlockContainer implements ICrucibleAcceptor {
|
||||
this.iconInner = iconRegister.registerIcon(RefStrings.MODID + ":foundry_mold_inner");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityFoundryMold();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptPartialPour(World world, int x, int y, int z, double dX, double dY, double dZ, ForgeDirection side, MaterialStack stack) {
|
||||
return ((TileEntityFoundryMold) world.getTileEntity(x, y, z)).canAcceptPartialPour(world, x, y, z, dX, dY, dZ, side, stack);
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB entityBounding, List list, Entity entity) {
|
||||
|
||||
AxisAlignedBB[] bbs = new AxisAlignedBB[] {
|
||||
AxisAlignedBB.getBoundingBox(x, y, z, x + 1D, y + 0.125D, z + 1D),
|
||||
AxisAlignedBB.getBoundingBox(x, y, z, x + 1D, y + 0.5D, z + 0.125D),
|
||||
AxisAlignedBB.getBoundingBox(x, y, z, x + 0.125D, y + 0.5D, z + 1D),
|
||||
AxisAlignedBB.getBoundingBox(x + 0.875D, y, z, x + 1D, y + 0.5D, z + 1D),
|
||||
AxisAlignedBB.getBoundingBox(x, y, z + 0.875, x + 1D, y + 0.5D, z + 1D),
|
||||
};
|
||||
|
||||
for(AxisAlignedBB bb : bbs) {
|
||||
if(entityBounding.intersectsWith(bb)) {
|
||||
list.add(bb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialStack pour(World world, int x, int y, int z, double dX, double dY, double dZ, ForgeDirection side, MaterialStack stack) {
|
||||
return ((TileEntityFoundryMold) world.getTileEntity(x, y, z)).pour(world, x, y, z, dX, dY, dZ, side, stack);
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptPartialFlow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) {
|
||||
return ((TileEntityFoundryMold) world.getTileEntity(x, y, z)).canAcceptPartialFlow(world, x, y, z, side, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialStack flow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) {
|
||||
return ((TileEntityFoundryMold) world.getTileEntity(x, y, z)).flow(world, x, y, z, side, stack);
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1D, y + 0.5D, z + 1D);
|
||||
}
|
||||
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
@ -74,14 +77,4 @@ public class FoundryMold extends BlockContainer implements ICrucibleAcceptor {
|
||||
public int getRenderType() {
|
||||
return renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,32 +1,16 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.MultiblockHandler;
|
||||
import com.hbm.interfaces.IMultiblock;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineCentrifuge;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineGasCent;
|
||||
|
||||
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.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
|
||||
@ -742,6 +742,9 @@ public class ModItems {
|
||||
public static Item blades_schrabidium;
|
||||
public static Item blades_desh;
|
||||
|
||||
public static Item mold_base;
|
||||
public static Item mold;
|
||||
|
||||
public static Item part_lithium;
|
||||
public static Item part_beryllium;
|
||||
public static Item part_carbon;
|
||||
@ -3350,6 +3353,9 @@ public class ModItems {
|
||||
blades_schrabidium = new ItemBlades(2000).setUnlocalizedName("blades_schrabidium").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":blades_schrabidium");
|
||||
blades_desh = new ItemBlades(0).setUnlocalizedName("blades_desh").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":blades_desh");
|
||||
|
||||
mold_base = new Item().setUnlocalizedName("mold_base").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":mold_base");
|
||||
mold = new ItemMold().setUnlocalizedName("mold").setCreativeTab(MainRegistry.controlTab);
|
||||
|
||||
part_lithium = new Item().setUnlocalizedName("part_lithium").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":part_lithium");
|
||||
part_beryllium = new Item().setUnlocalizedName("part_beryllium").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":part_beryllium");
|
||||
part_carbon = new Item().setUnlocalizedName("part_carbon").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":part_carbon");
|
||||
@ -6645,6 +6651,10 @@ public class ModItems {
|
||||
GameRegistry.registerItem(stamp_9, stamp_9.getUnlocalizedName());
|
||||
GameRegistry.registerItem(stamp_50, stamp_50.getUnlocalizedName());
|
||||
|
||||
//Molds
|
||||
GameRegistry.registerItem(mold_base, mold_base.getUnlocalizedName());
|
||||
GameRegistry.registerItem(mold, mold.getUnlocalizedName());
|
||||
|
||||
//Machine Upgrades
|
||||
GameRegistry.registerItem(upgrade_template, upgrade_template.getUnlocalizedName());
|
||||
GameRegistry.registerItem(upgrade_speed_1, upgrade_speed_1.getUnlocalizedName());
|
||||
|
||||
107
src/main/java/com/hbm/items/machine/ItemMold.java
Normal file
@ -0,0 +1,107 @@
|
||||
package com.hbm.items.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.material.MaterialShapes;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class ItemMold extends Item {
|
||||
|
||||
public List<Mold> molds = new ArrayList();
|
||||
|
||||
public ItemMold() {
|
||||
this.molds.add(new Mold(0, 0, "nugget", MaterialShapes.NUGGET));
|
||||
this.molds.add(new Mold(1, 0, "billet", MaterialShapes.BILLET));
|
||||
this.molds.add(new Mold(2, 0, "ingot", MaterialShapes.INGOT));
|
||||
this.molds.add(new Mold(3, 0, "plate", MaterialShapes.PLATE));
|
||||
this.molds.add(new Mold(4, 0, "wire", MaterialShapes.WIRE, 8));
|
||||
this.molds.add(new Mold(5, 1, "ingots", MaterialShapes.INGOT, 9));
|
||||
this.molds.add(new Mold(6, 1, "plates", MaterialShapes.PLATE, 9));
|
||||
this.molds.add(new Mold(7, 1, "block", MaterialShapes.BLOCK));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for(int i = 0; i < molds.size(); i++) {
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
protected IIcon[] icons;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister reg) {
|
||||
|
||||
icons = new IIcon[molds.size()];
|
||||
|
||||
for(int i = 0; i < molds.size(); i++) {
|
||||
Mold mold = molds.get(i);
|
||||
this.icons[i] = reg.registerIcon(RefStrings.MODID + ":mold_" + mold.name);
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
return this.icons[Math.abs(meta % icons.length)];
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
int meta = Math.abs(stack.getItemDamage() % molds.size());
|
||||
return super.getUnlocalizedName(stack) + "_" + molds.get(meta).name;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
|
||||
Mold mold = getMold(stack);
|
||||
list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("shape." + mold.shape.name().toLowerCase()) + " x" + mold.amount);
|
||||
|
||||
if(mold.size == 0) list.add(EnumChatFormatting.GOLD + I18nUtil.resolveKey(ModBlocks.foundry_mold.getUnlocalizedName() + ".name"));
|
||||
if(mold.size == 1) list.add(EnumChatFormatting.RED + I18nUtil.resolveKey(ModBlocks.foundry_basin.getUnlocalizedName() + ".name"));
|
||||
}
|
||||
|
||||
public Mold getMold(ItemStack stack) {
|
||||
int meta = Math.abs(stack.getItemDamage() % molds.size());
|
||||
Mold mold = molds.get(meta);
|
||||
return mold;
|
||||
}
|
||||
|
||||
public class Mold {
|
||||
|
||||
public MaterialShapes shape;
|
||||
public int amount;
|
||||
public int id;
|
||||
public int size;
|
||||
public String name;
|
||||
|
||||
public Mold(int id, int size, String name, MaterialShapes shape) {
|
||||
this(id, size, name, shape, 1);
|
||||
}
|
||||
|
||||
public Mold(int id, int size, String name, MaterialShapes shape, int amount) {
|
||||
this.id = id;
|
||||
this.size = size;
|
||||
this.shape = shape;
|
||||
this.amount = amount;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getCost() {
|
||||
return shape.q(amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -951,6 +951,11 @@ public class CraftingManager {
|
||||
addRecipeAuto(new ItemStack(ModItems.gear_large, 1, 0), new Object[] { "III", "ICI", "III", 'I', IRON.plate(), 'C', CU.ingot()});
|
||||
addRecipeAuto(new ItemStack(ModItems.gear_large, 1, 1), new Object[] { "III", "ICI", "III", 'I', STEEL.plate(), 'C', TI.ingot()});
|
||||
addRecipeAuto(new ItemStack(ModItems.sawblade), new Object[] { "III", "ICI", "III", 'I', STEEL.plate(), 'C', IRON.ingot()});
|
||||
|
||||
addRecipeAuto(new ItemStack(ModBlocks.foundry_basin), new Object[] { "B B", "B B", "BSB", 'B', ModItems.ingot_firebrick, 'S', Blocks.stone_slab });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.foundry_mold), new Object[] { "B B", "BSB", 'B', ModItems.ingot_firebrick, 'S', Blocks.stone_slab });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.foundry_channel, 4), new Object[] { "B B", " S ", 'B', ModItems.ingot_firebrick, 'S', Blocks.stone_slab });
|
||||
addRecipeAuto(new ItemStack(ModItems.mold_base), new Object[] { " B ", "BIB", " B ", 'B', ModItems.ingot_firebrick, 'I', IRON.ingot() });
|
||||
|
||||
addShapelessAuto(new ItemStack(ModItems.upgrade_5g), new Object[] { ModItems.upgrade_template, ModItems.gem_alexandrite });
|
||||
|
||||
|
||||
@ -177,6 +177,10 @@ public class RenderChannel implements ISimpleBlockRenderingHandler {
|
||||
float mulZ = 0.8F;
|
||||
float mulX = 0.6F;
|
||||
|
||||
int brightness = block.getMixedBrightnessForBlock(world, x, y, z);
|
||||
int fullBright = 240;
|
||||
tessellator.setBrightness(brightness);
|
||||
|
||||
if(EntityRenderer.anaglyphEnable) {
|
||||
float aR = (r * 30.0F + g * 59.0F + b * 11.0F) / 100.0F;
|
||||
float aG = (r * 30.0F + g * 70.0F) / 100.0F;
|
||||
@ -216,7 +220,9 @@ public class RenderChannel implements ISimpleBlockRenderingHandler {
|
||||
if(doRender) {
|
||||
renderer.setRenderBounds(0.375D, 0.125D, 0.375D, 0.625D, 0.125D + level, 0.625D);
|
||||
tessellator.setColorOpaque_F(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F);
|
||||
tessellator.setBrightness(fullBright);
|
||||
renderer.renderFaceYPos(block, x, y, z, channel.iconLava);
|
||||
tessellator.setBrightness(brightness);
|
||||
}
|
||||
|
||||
if(posX) {
|
||||
@ -243,8 +249,10 @@ public class RenderChannel implements ISimpleBlockRenderingHandler {
|
||||
if(doRender) {
|
||||
renderer.setRenderBounds(0.625D, 0.125D, 0.3125D, 1D, 0.125D + level, 0.6875D);
|
||||
tessellator.setColorOpaque_F(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F);
|
||||
tessellator.setBrightness(fullBright);
|
||||
renderer.renderFaceYPos(block, x, y, z, channel.iconLava);
|
||||
renderer.renderFaceXPos(block, x, y, z, channel.iconLava);
|
||||
tessellator.setBrightness(brightness);
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -280,8 +288,10 @@ public class RenderChannel implements ISimpleBlockRenderingHandler {
|
||||
if(doRender) {
|
||||
renderer.setRenderBounds(0D, 0.125D, 0.3125D, 0.375D, 0.125D + level, 0.6875D);
|
||||
tessellator.setColorOpaque_F(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F);
|
||||
tessellator.setBrightness(fullBright);
|
||||
renderer.renderFaceYPos(block, x, y, z, channel.iconLava);
|
||||
renderer.renderFaceXNeg(block, x, y, z, channel.iconLava);
|
||||
tessellator.setBrightness(brightness);
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -317,8 +327,10 @@ public class RenderChannel implements ISimpleBlockRenderingHandler {
|
||||
if(doRender) {
|
||||
renderer.setRenderBounds(0.3125D, 0.125D, 0.625D, 0.6875D, 0.125D + level, 1D);
|
||||
tessellator.setColorOpaque_F(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F);
|
||||
tessellator.setBrightness(fullBright);
|
||||
renderer.renderFaceYPos(block, x, y, z, channel.iconLava);
|
||||
renderer.renderFaceZPos(block, x, y, z, channel.iconLava);
|
||||
tessellator.setBrightness(brightness);
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -354,8 +366,10 @@ public class RenderChannel implements ISimpleBlockRenderingHandler {
|
||||
if(doRender) {
|
||||
renderer.setRenderBounds(0.3125D, 0.125D, 0D, 0.6875D, 0.125D + level, 0.375D);
|
||||
tessellator.setColorOpaque_F(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F);
|
||||
tessellator.setBrightness(fullBright);
|
||||
renderer.renderFaceYPos(block, x, y, z, channel.iconLava);
|
||||
renderer.renderFaceZNeg(block, x, y, z, channel.iconLava);
|
||||
tessellator.setBrightness(brightness);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@ -26,8 +26,8 @@ public class RenderMold implements ISimpleBlockRenderingHandler {
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0F, 1F, 0F);
|
||||
renderer.renderFaceYPos(block, x, y - 0.5D, z, basin.iconTop);
|
||||
renderer.renderFaceYPos(block, x, y - 0.875D, z, basin.iconBottom);
|
||||
renderer.renderFaceYPos(block, x, y, z, basin.iconTop);
|
||||
renderer.renderFaceYPos(block, x, y - 0.375D, z, basin.iconBottom);
|
||||
tessellator.setNormal(0F, -1F, 0F);
|
||||
renderer.renderFaceYNeg(block, x, y, z, basin.iconBottom);
|
||||
tessellator.setNormal(1F, 0F, 0F);
|
||||
@ -71,8 +71,8 @@ public class RenderMold implements ISimpleBlockRenderingHandler {
|
||||
FoundryMold mold = (FoundryMold) block;
|
||||
|
||||
tessellator.setColorOpaque_F(r * mulTop, g * mulTop, b * mulTop);
|
||||
renderer.renderFaceYPos(block, x, y - 0.5D, z, mold.iconTop);
|
||||
renderer.renderFaceYPos(block, x, y - 0.875D, z, mold.iconBottom);
|
||||
renderer.renderFaceYPos(block, x, y, z, mold.iconTop);
|
||||
renderer.renderFaceYPos(block, x, y - 0.375D, z, mold.iconBottom);
|
||||
tessellator.setColorOpaque_F(r * mulBottom, g * mulBottom, b * mulBottom);
|
||||
renderer.renderFaceYNeg(block, x, y, z, mold.iconBottom);
|
||||
tessellator.setColorOpaque_F(r * mulX, g * mulX, b * mulX);
|
||||
|
||||
@ -10,6 +10,7 @@ import com.hbm.tileentity.machine.IRenderFoundry;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
@ -67,6 +68,10 @@ public class RenderFoundry extends TileEntitySpecialRenderer {
|
||||
|
||||
GL11.glDepthMask(true);
|
||||
|
||||
if(foundry instanceof IInventory) {
|
||||
IInventory inv = (IInventory) foundry;
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,9 +4,14 @@ import com.hbm.inventory.material.NTMMaterial;
|
||||
|
||||
public interface IRenderFoundry {
|
||||
|
||||
/** Returns whether a molten metal layer should be rendered in the TESR */
|
||||
public boolean shouldRender();
|
||||
/** Returns the Y-offset of the molten metal layer */
|
||||
public double getLevel();
|
||||
/** Returns the NTM Mat used, mainly for the color */
|
||||
public NTMMaterial getMat();
|
||||
|
||||
/* Return size constraints for the rectangle */
|
||||
public double minX();
|
||||
public double maxX();
|
||||
public double minZ();
|
||||
|
||||
@ -33,6 +33,13 @@ public abstract class TileEntityFoundryBase extends TileEntity implements ICruci
|
||||
this.lastType = this.type;
|
||||
this.lastAmount = this.amount;
|
||||
}
|
||||
} else {
|
||||
|
||||
if(this.lastType != this.type || this.lastAmount != this.amount) {
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
this.lastType = this.type;
|
||||
this.lastAmount = this.amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,74 +1,24 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.inventory.material.MaterialShapes;
|
||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||
import com.hbm.inventory.material.NTMMaterial;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class TileEntityFoundryBasin extends TileEntityFoundryBase implements IRenderFoundry {
|
||||
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
return MaterialShapes.BLOCK.q(1);
|
||||
}
|
||||
public class TileEntityFoundryBasin extends TileEntityFoundryCastingBase implements IRenderFoundry {
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(this.lastType != this.type || this.lastAmount != this.amount) {
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
this.lastType = this.type;
|
||||
this.lastAmount = this.amount;
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: cool off
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptPartialPour(World world, int x, int y, int z, double dX, double dY, double dZ, ForgeDirection side, MaterialStack stack) {
|
||||
|
||||
if(side != ForgeDirection.UP) return false; //reject from any direction other than the top
|
||||
if(this.type != null && this.type != stack.material) return false; //reject if there's already a different material
|
||||
if(this.amount >= this.getCapacity()) return false; //reject if the buffer is already full
|
||||
|
||||
for(String name : stack.material.names) {
|
||||
String od = "block" + name;
|
||||
|
||||
if(!OreDictionary.getOres(od).isEmpty()) {
|
||||
return true; //at least one block for this material? return TRUE
|
||||
}
|
||||
}
|
||||
|
||||
return false; //no OD match -> no pouring
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialStack pour(World world, int x, int y, int z, double dX, double dY, double dZ, ForgeDirection side, MaterialStack stack) {
|
||||
|
||||
if(this.type == null) {
|
||||
this.type = stack.material;
|
||||
}
|
||||
|
||||
if(stack.amount + this.amount <= this.getCapacity()) {
|
||||
this.amount += stack.amount;
|
||||
return null;
|
||||
}
|
||||
|
||||
int required = this.getCapacity() - this.amount;
|
||||
this.amount = this.getCapacity();
|
||||
|
||||
stack.amount -= required;
|
||||
|
||||
return stack;
|
||||
public int getMoldSize() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Basin can't accept sideways flowing */
|
||||
@Override public boolean canAcceptPartialFlow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) { return false; }
|
||||
@Override public MaterialStack flow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) { return stack; }
|
||||
|
||||
|
||||
@ -0,0 +1,232 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemMold;
|
||||
import com.hbm.items.machine.ItemMold.Mold;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
/**
|
||||
* Thank god we have a base class now. Now with documentation and as little redundtand crap in the child classes as possible.
|
||||
* @author hbm
|
||||
*
|
||||
*/
|
||||
public abstract class TileEntityFoundryCastingBase extends TileEntityFoundryBase implements IInventory {
|
||||
|
||||
public ItemStack slots[] = new ItemStack[2];
|
||||
public int cooloff = 100;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
Mold mold = this.getInstalledMold();
|
||||
|
||||
if(mold != null && this.amount == this.getCapacity() && slots[1] == null) {
|
||||
cooloff--;
|
||||
|
||||
if(cooloff <= 0) {
|
||||
this.amount = 0;
|
||||
|
||||
for(String name : this.type.names) {
|
||||
String od = mold.shape.name().toLowerCase() + name;
|
||||
List<ItemStack> ores = OreDictionary.getOres(od);
|
||||
|
||||
if(!ores.isEmpty()) {
|
||||
slots[1] = ores.get(0).copy();
|
||||
slots[1].stackSize = mold.amount;
|
||||
}
|
||||
}
|
||||
|
||||
cooloff = 100;
|
||||
}
|
||||
|
||||
} else {
|
||||
cooloff = 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Checks slot 0 to see what mold type is installed. Returns null if no mold is found or an incorrect size was used. */
|
||||
public Mold getInstalledMold() {
|
||||
if(slots[0] == null) return null;
|
||||
|
||||
if(slots[0].getItem() == ModItems.mold) {
|
||||
Mold mold = ((ItemMold) slots[0].getItem()).getMold(slots[0]);
|
||||
|
||||
if(mold.size == this.getMoldSize())
|
||||
return mold;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Returns the amount of quanta this casting block can hold, depending on the installed mold or 0 if no mold is found. */
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
Mold mold = this.getInstalledMold();
|
||||
return mold == null ? 0 : mold.getCost();
|
||||
}
|
||||
|
||||
/** Standard check with no additional limitations added */
|
||||
@Override
|
||||
public boolean canAcceptPartialFlow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) {
|
||||
return this.standardCheck(world, x, y, z, side, stack);
|
||||
}
|
||||
|
||||
/** Standard flow, no special handling required */
|
||||
@Override
|
||||
public MaterialStack flow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) {
|
||||
return standardAdd(world, x, y, z, side, stack);
|
||||
}
|
||||
|
||||
/** Standard check, but with the additional limitation that the only valid source direction is UP */
|
||||
@Override
|
||||
public boolean canAcceptPartialPour(World world, int x, int y, int z, double dX, double dY, double dZ, ForgeDirection side, MaterialStack stack) {
|
||||
if(side != ForgeDirection.UP) return false;
|
||||
return this.standardCheck(world, x, y, z, side, stack);
|
||||
}
|
||||
|
||||
/** Standard flow, no special handling required */
|
||||
@Override
|
||||
public MaterialStack pour(World world, int x, int y, int z, double dX, double dY, double dZ, ForgeDirection side, MaterialStack stack) {
|
||||
return standardAdd(world, x, y, z, side, stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard check for testing if this material stack can be added to the casting block. Checks:<br>
|
||||
* - type matching<br>
|
||||
* - amount being at max<br>
|
||||
* - whether a mold is installed<br>
|
||||
* - whether the mold can accept this type
|
||||
*/
|
||||
public boolean standardCheck(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) {
|
||||
if(this.type != null && this.type != stack.material) return false; //reject if there's already a different material
|
||||
if(this.amount >= this.getCapacity()) return false; //reject if the buffer is already full
|
||||
if(this.slots[1] != null) return false; //reject if a freshly casted item is still present
|
||||
Mold mold = this.getInstalledMold();
|
||||
if(mold == null) return false;
|
||||
|
||||
for(String name : stack.material.names) {
|
||||
String od = mold.shape.name().toLowerCase() + name;
|
||||
|
||||
if(!OreDictionary.getOres(od).isEmpty()) {
|
||||
return true; //at least one block for this material? return TRUE
|
||||
}
|
||||
}
|
||||
|
||||
return false; //no OD match -> no pouring
|
||||
}
|
||||
|
||||
/**
|
||||
* Standardized adding of material via pouring or flowing. Does:<br>
|
||||
* - sets material to match the input
|
||||
* - adds the amount, not exceeding the maximum
|
||||
* - returns the amount that cannot be added
|
||||
*/
|
||||
public MaterialStack standardAdd(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) {
|
||||
|
||||
if(this.type == null) {
|
||||
this.type = stack.material;
|
||||
}
|
||||
|
||||
if(stack.amount + this.amount <= this.getCapacity()) {
|
||||
this.amount += stack.amount;
|
||||
return null;
|
||||
}
|
||||
|
||||
int required = this.getCapacity() - this.amount;
|
||||
this.amount = this.getCapacity();
|
||||
|
||||
stack.amount -= required;
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
/** Returns an integer determining the mold size, 0 for small molds and 1 for the basin */
|
||||
public abstract int getMoldSize();
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return slots.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return slots[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
if(slots[i] != null) {
|
||||
ItemStack itemStack = slots[i];
|
||||
slots[i] = null;
|
||||
return itemStack;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemStack) {
|
||||
slots[i] = itemStack;
|
||||
if(itemStack != null && itemStack.stackSize > getInventoryStackLimit()) {
|
||||
itemStack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int amount) {
|
||||
if(slots[slot] != null) {
|
||||
if(slots[slot].stackSize <= amount) {
|
||||
ItemStack itemStack = slots[slot];
|
||||
slots[slot] = null;
|
||||
return itemStack;
|
||||
}
|
||||
ItemStack itemStack1 = slots[slot].splitStack(amount);
|
||||
if(slots[slot].stackSize == 0) {
|
||||
slots[slot] = null;
|
||||
}
|
||||
return itemStack1;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "ntmFoundry";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public void openInventory() { }
|
||||
@Override public void closeInventory() { }
|
||||
}
|
||||
@ -18,7 +18,6 @@ public class TileEntityFoundryChannel extends TileEntityFoundryBase {
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
@ -26,12 +25,6 @@ public class TileEntityFoundryChannel extends TileEntityFoundryBase {
|
||||
this.amount = 0;
|
||||
}
|
||||
|
||||
if(this.lastType != this.type || this.lastAmount != this.amount) {
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
this.lastType = this.type;
|
||||
this.lastAmount = this.amount;
|
||||
}
|
||||
|
||||
if(worldObj.rand.nextInt(10) == 0 && this.amount > 0 && this.type != null) {
|
||||
|
||||
List<Integer> ints = new ArrayList() {{ add(2); add(3); add(4); add(5); }};
|
||||
@ -89,6 +82,8 @@ public class TileEntityFoundryChannel extends TileEntityFoundryBase {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.updateEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -1,109 +1,17 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.inventory.material.MaterialShapes;
|
||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||
import com.hbm.inventory.material.NTMMaterial;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class TileEntityFoundryMold extends TileEntityFoundryBase implements IRenderFoundry {
|
||||
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
return MaterialShapes.INGOT.q(1);
|
||||
}
|
||||
public class TileEntityFoundryMold extends TileEntityFoundryCastingBase implements IRenderFoundry {
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(this.lastType != this.type || this.lastAmount != this.amount) {
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
this.lastType = this.type;
|
||||
this.lastAmount = this.amount;
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: cool off
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptPartialPour(World world, int x, int y, int z, double dX, double dY, double dZ, ForgeDirection side, MaterialStack stack) {
|
||||
|
||||
if(side != ForgeDirection.UP) return false; //reject from any direction other than the top
|
||||
if(this.type != null && this.type != stack.material) return false; //reject if there's already a different material
|
||||
if(this.amount >= this.getCapacity()) return false; //reject if the buffer is already full
|
||||
|
||||
for(String name : stack.material.names) {
|
||||
String od = "ingot" + name;
|
||||
|
||||
if(!OreDictionary.getOres(od).isEmpty()) {
|
||||
return true; //at least one block for this material? return TRUE
|
||||
}
|
||||
}
|
||||
|
||||
return false; //no OD match -> no pouring
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialStack pour(World world, int x, int y, int z, double dX, double dY, double dZ, ForgeDirection side, MaterialStack stack) {
|
||||
|
||||
if(this.type == null) {
|
||||
this.type = stack.material;
|
||||
}
|
||||
|
||||
if(stack.amount + this.amount <= this.getCapacity()) {
|
||||
this.amount += stack.amount;
|
||||
return null;
|
||||
}
|
||||
|
||||
int required = this.getCapacity() - this.amount;
|
||||
this.amount = this.getCapacity();
|
||||
|
||||
stack.amount -= required;
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptPartialFlow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) {
|
||||
|
||||
if(this.type != null && this.type != stack.material) return false; //reject if there's already a different material
|
||||
if(this.amount >= this.getCapacity()) return false; //reject if the buffer is already full
|
||||
|
||||
for(String name : stack.material.names) {
|
||||
String od = "ingot" + name;
|
||||
|
||||
if(!OreDictionary.getOres(od).isEmpty()) {
|
||||
return true; //at least one block for this material? return TRUE
|
||||
}
|
||||
}
|
||||
|
||||
return false; //no OD match -> no pouring
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialStack flow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) {
|
||||
|
||||
if(this.type == null) {
|
||||
this.type = stack.material;
|
||||
}
|
||||
|
||||
if(stack.amount + this.amount <= this.getCapacity()) {
|
||||
this.amount += stack.amount;
|
||||
return null;
|
||||
}
|
||||
|
||||
int required = this.getCapacity() - this.amount;
|
||||
this.amount = this.getCapacity();
|
||||
|
||||
stack.amount -= required;
|
||||
|
||||
return stack;
|
||||
public int getMoldSize() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -885,6 +885,7 @@ item.balefire_and_ham.name=Ham and Balefire-Eggs
|
||||
item.balefire_and_steel.name=Balefire-Zeug
|
||||
item.balefire_scrambled.name=Rühr-Balefire-Ei
|
||||
item.ball_dynamite.name=Dynamit
|
||||
item.ball_fireclay.name=Schamott
|
||||
item.ball_tnt.name=TNT
|
||||
item.ballistite.name=Ballistit
|
||||
item.bandaid.name=Samtenes Pflaster
|
||||
@ -1750,6 +1751,7 @@ item.ingot_electronium.name=Elektroniumbarren
|
||||
item.ingot_euphemium.name=Euphemiumbarren
|
||||
item.ingot_ferrouranium.name=Ferrouranbarren
|
||||
item.ingot_fiberglass.name=Fiberglasstafel
|
||||
item.ingot_firebrick.name=Schamottstein
|
||||
item.ingot_gh336.name=Ghiorsium-336-Barren
|
||||
item.ingot_gh336.desc=Seaborgiums Kollege.
|
||||
item.ingot_graphite.name=Graphitbarren
|
||||
@ -1961,6 +1963,8 @@ item.missile_strong.name=Starke HE Rakete
|
||||
item.missile_taint.name=Verdorbene Rakete
|
||||
item.missile_volcano.name=Tectonic Missile
|
||||
item.missile_volcano.desc=Mit der Kraft von Kernwaffen können wir einen Vulkan beschwören!
|
||||
item.mold_base.name=Blanke Gussform
|
||||
item.mold.name=Gussform
|
||||
item.morning_glory.name=Zaunwinde
|
||||
item.motor.name=Motor
|
||||
item.motor_desh.name=Desh-Motor
|
||||
@ -2638,7 +2642,7 @@ item.safety_fuse.name=Zündschnur
|
||||
item.sat_base.name=Satellitenkörper
|
||||
item.sat_chip.name=Satelliten-ID-Chip
|
||||
item.sat_coord.name=Satelliten-Zielmarkierer
|
||||
item.sat_designator.name=atelliten-Laserzielmarkierer
|
||||
item.sat_designator.name=Satelliten-Laserzielmarkierer
|
||||
item.sat_foeq.name=PEAF - Mk.I FOEQ Dunasonde mit experimenter nuklearer Schubdüse
|
||||
item.sat_gerald.name=Gerald der Konstruktionsandroid
|
||||
item.sat_head_laser.name=Todesstrahl
|
||||
@ -2991,6 +2995,17 @@ rbmk.rod.xenon=Xenonvergiftung: %s
|
||||
rbmk.rod.coreTemp=Kerntemperatur: %s
|
||||
rbmk.rod.skinTemp=Außentemperatur: %s / %s
|
||||
|
||||
shape.quantum=Quantum
|
||||
shape.nugget=Nugget
|
||||
shape.dusttiny=Winziger Haufen
|
||||
shape.wire=Draht
|
||||
shape.billet=Billet
|
||||
shape.ingot=Barren
|
||||
shape.dust=Haufen
|
||||
shape.plate=Platte
|
||||
shape.quart=Viertel Block
|
||||
shape.block=Block
|
||||
|
||||
soundCategory.ntmMachines=NTM Maschinen
|
||||
|
||||
tile.absorber.name=Strahlungs-Absorber
|
||||
@ -3323,6 +3338,9 @@ tile.float_bomb.name=Schwebebombe
|
||||
tile.fluid_duct.name=Universelles Flüssigkeitsrohr
|
||||
tile.fluid_duct_solid.name=Geschirmtes universelles Flüssigkeitsrohr
|
||||
tile.foam_layer.name=Schaumdecke
|
||||
tile.foundry_basin.name=Gussbecken
|
||||
tile.foundry_channel.name=Gusskanal
|
||||
tile.foundry_mold.name=Seichtes Gussbecken
|
||||
tile.fraction_spacer.name=Fraktionierungsturm-Teiler
|
||||
tile.frozen_dirt.name=Gefrorene Erde
|
||||
tile.frozen_grass.name=Gefrorenes Gras
|
||||
|
||||
@ -1127,6 +1127,7 @@ item.balefire_and_ham.name=Ham and Balefire Eggs
|
||||
item.balefire_and_steel.name=Balefire and Steel
|
||||
item.balefire_scrambled.name=Scrambled Balefire Egg
|
||||
item.ball_dynamite.name=Dynamite
|
||||
item.ball_fireclay.name=Fireclay
|
||||
item.ball_tnt.name=TNT
|
||||
item.ballistite.name=Ballistite
|
||||
item.bandaid.name=Velvet Band-Aid
|
||||
@ -2036,6 +2037,7 @@ item.ingot_euphemium.desc=A very special and yet strange element.
|
||||
item.ingot_ferrouranium.name=Ferrouranium Ingot
|
||||
item.ingot_fiberglass.name=Fiberglass Bar
|
||||
item.ingot_fiberglass.desc=High in fiber, high in glass. Everything the body needs.
|
||||
item.ingot_firebrick.name=Firebrick
|
||||
item.ingot_gh336.name=Ghiorsium-336 Ingot
|
||||
item.ingot_gh336.desc=Seaborgium's colleague.
|
||||
item.ingot_graphite.name=Graphite Ingot
|
||||
@ -2269,6 +2271,8 @@ item.missile_strong.name=Strong HE Missile
|
||||
item.missile_taint.name=Taint-Tipped Missile
|
||||
item.missile_volcano.name=Tectonic Missile
|
||||
item.missile_volcano.desc=Using the power of nuclear explosives, we can summon a volcano!
|
||||
item.mold_base.name=Blank Foundry Mold
|
||||
item.mold.name=Foundry Mold
|
||||
item.morning_glory.name=Morning Glory
|
||||
item.motor.name=Motor
|
||||
item.motor_desh.name=Desh Motor
|
||||
@ -3436,6 +3440,17 @@ rbmk.screen.rod=Control: %s
|
||||
rbmk.screen.temp=Temp: %s
|
||||
rbmk.screen.xenon=Xenon: %s
|
||||
|
||||
shape.quantum=Quantum
|
||||
shape.nugget=Nugget
|
||||
shape.dusttiny=Tiny Dust
|
||||
shape.wire=Wire
|
||||
shape.billet=Billet
|
||||
shape.ingot=Ingot
|
||||
shape.dust=Dust
|
||||
shape.plate=Plate
|
||||
shape.quart=Quarter Block
|
||||
shape.block=Block
|
||||
|
||||
soundCategory.ntmMachines=NTM Machines
|
||||
|
||||
tile.absorber.name=Radiation Absorber
|
||||
@ -3773,6 +3788,9 @@ tile.float_bomb.name=Levitation Bomb
|
||||
tile.fluid_duct.name=Universal Fluid Duct
|
||||
tile.fluid_duct_solid.name=Coated Universal Fluid Duct
|
||||
tile.foam_layer.name=Foam layer
|
||||
tile.foundry_basin.name=Foundry Basin
|
||||
tile.foundry_channel.name=Foundry Channel
|
||||
tile.foundry_mold.name=Shallow Foundry Basin
|
||||
tile.fraction_spacer.name=Fractioning Tower Separator
|
||||
tile.frozen_dirt.name=Frozen Dirt
|
||||
tile.frozen_grass.name=Frozen Grass
|
||||
|
||||
|
After Width: | Height: | Size: 651 B |
BIN
src/main/resources/assets/hbm/textures/blocks/foundry_mold.png
Normal file
|
After Width: | Height: | Size: 651 B |
BIN
src/main/resources/assets/hbm/textures/items/mold_base.png
Normal file
|
After Width: | Height: | Size: 288 B |
BIN
src/main/resources/assets/hbm/textures/items/mold_billet.png
Normal file
|
After Width: | Height: | Size: 398 B |
BIN
src/main/resources/assets/hbm/textures/items/mold_block.png
Normal file
|
After Width: | Height: | Size: 373 B |
BIN
src/main/resources/assets/hbm/textures/items/mold_ingot.png
Normal file
|
After Width: | Height: | Size: 364 B |
BIN
src/main/resources/assets/hbm/textures/items/mold_ingots.png
Normal file
|
After Width: | Height: | Size: 484 B |
BIN
src/main/resources/assets/hbm/textures/items/mold_nugget.png
Normal file
|
After Width: | Height: | Size: 328 B |
BIN
src/main/resources/assets/hbm/textures/items/mold_plate.png
Normal file
|
After Width: | Height: | Size: 419 B |
BIN
src/main/resources/assets/hbm/textures/items/mold_plates.png
Normal file
|
After Width: | Height: | Size: 414 B |
BIN
src/main/resources/assets/hbm/textures/items/mold_wire.png
Normal file
|
After Width: | Height: | Size: 423 B |