mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
crucible templates in folder, storage tanks, recipes
This commit is contained in:
parent
6bb58fdcd1
commit
99f3909bed
@ -643,6 +643,7 @@ public class ModBlocks {
|
||||
public static Block foundry_mold;
|
||||
public static Block foundry_basin;
|
||||
public static Block foundry_channel;
|
||||
public static Block foundry_tank;
|
||||
public static Block foundry_outlet;
|
||||
|
||||
public static Block machine_difurnace_off;
|
||||
@ -1830,6 +1831,7 @@ public class ModBlocks {
|
||||
foundry_mold = new FoundryMold().setBlockName("foundry_mold").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_fire");
|
||||
foundry_basin = new FoundryBasin().setBlockName("foundry_basin").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_fire");
|
||||
foundry_channel = new FoundryChannel().setBlockName("foundry_channel").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_fire");
|
||||
foundry_tank = new FoundryTank().setBlockName("foundry_tank").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_fire");
|
||||
foundry_outlet = new FoundryOutlet().setBlockName("foundry_outlet").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_fire");
|
||||
|
||||
machine_difurnace_off = new MachineDiFurnace(false).setBlockName("machine_difurnace_off").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
@ -3027,6 +3029,7 @@ public class ModBlocks {
|
||||
register(foundry_mold);
|
||||
register(foundry_basin);
|
||||
register(foundry_channel);
|
||||
register(foundry_tank);
|
||||
register(foundry_outlet);
|
||||
GameRegistry.registerBlock(machine_difurnace_off, machine_difurnace_off.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_difurnace_on, machine_difurnace_on.getUnlocalizedName());
|
||||
|
||||
@ -17,26 +17,26 @@ public class BlockSmolder extends Block {
|
||||
public BlockSmolder(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
super.randomDisplayTick(world, x, y, z, rand);
|
||||
|
||||
if(world.getBlock(x, y + 1, z).getMaterial() == Material.air) {
|
||||
|
||||
world.spawnParticle("lava", x + 0.25 + rand.nextDouble() * 0.5, y + 1.1, z + 0.25 + rand.nextDouble() * 0.5, 0.0, 0.0, 0.0);
|
||||
world.spawnParticle("flame", x + 0.25 + rand.nextDouble() * 0.5, y + 1.1, z + 0.25 + rand.nextDouble() * 0.5, 0.0, 0.0, 0.0);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
super.randomDisplayTick(world, x, y, z, rand);
|
||||
|
||||
if(world.getBlock(x, y + 1, z).getMaterial() == Material.air) {
|
||||
|
||||
world.spawnParticle("lava", x + 0.25 + rand.nextDouble() * 0.5, y + 1.1, z + 0.25 + rand.nextDouble() * 0.5, 0.0, 0.0, 0.0);
|
||||
world.spawnParticle("flame", x + 0.25 + rand.nextDouble() * 0.5, y + 1.1, z + 0.25 + rand.nextDouble() * 0.5, 0.0, 0.0, 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int i, Random rand, int j) {
|
||||
return ModItems.powder_fire;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void onEntityWalking(World world, int x, int y, int z, Entity entity) {
|
||||
entity.setFire(3);
|
||||
}
|
||||
entity.setFire(3);
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,4 +83,9 @@ public class FoundryBasin extends FoundryCastingBase {
|
||||
public int getRenderType() {
|
||||
return renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
return side != ForgeDirection.UP;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||
@ -127,6 +128,18 @@ public abstract class FoundryCastingBase extends BlockContainer implements ICruc
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
super.randomDisplayTick(world, x, y, z, rand);
|
||||
|
||||
TileEntityFoundryCastingBase cast = (TileEntityFoundryCastingBase) world.getTileEntity(x, y, z);
|
||||
|
||||
if(cast.amount > 0 && cast.amount >= cast.getCapacity()) {
|
||||
world.spawnParticle("smoke", x + 0.25 + rand.nextDouble() * 0.5, y + this.maxY, z + 0.25 + rand.nextDouble() * 0.5, 0.0, 0.0, 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@ 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 FoundryCastingBase {
|
||||
|
||||
@ -77,4 +78,9 @@ public class FoundryMold extends FoundryCastingBase {
|
||||
public int getRenderType() {
|
||||
return renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
return side == ForgeDirection.DOWN;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,16 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemScraps;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityFoundryCastingBase;
|
||||
import com.hbm.tileentity.machine.TileEntityFoundryOutlet;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import api.hbm.block.ICrucibleAcceptor;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
@ -15,22 +21,27 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class FoundryOutlet extends BlockContainer implements ICrucibleAcceptor {
|
||||
public class FoundryOutlet extends BlockContainer implements ICrucibleAcceptor, ILookOverlay {
|
||||
|
||||
@SideOnly(Side.CLIENT) public IIcon iconTop;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconSide;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconBottom;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconInner;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconFront;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconLock;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconFilter;
|
||||
|
||||
public FoundryOutlet() {
|
||||
super(Material.rock);
|
||||
@ -45,6 +56,8 @@ public class FoundryOutlet extends BlockContainer implements ICrucibleAcceptor {
|
||||
this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + ":foundry_outlet_bottom");
|
||||
this.iconInner = iconRegister.registerIcon(RefStrings.MODID + ":foundry_outlet_inner");
|
||||
this.iconFront = iconRegister.registerIcon(RefStrings.MODID + ":foundry_outlet_front");
|
||||
this.iconLock = iconRegister.registerIcon(RefStrings.MODID + ":foundry_outlet_lock");
|
||||
this.iconFilter = iconRegister.registerIcon(RefStrings.MODID + ":foundry_outlet_filter");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@ -99,6 +112,30 @@ public class FoundryOutlet extends BlockContainer implements ICrucibleAcceptor {
|
||||
if(meta == 2) this.setBlockBounds(0.3125F, 0F, 0.625F, 0.6875F, 0.5F, 1F);
|
||||
if(meta == 3) this.setBlockBounds(0.3125F, 0F, 0F, 0.6875F, 0.5F, 0.375F);
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
if(!player.isSneaking()) {
|
||||
TileEntityFoundryOutlet tile = (TileEntityFoundryOutlet) world.getTileEntity(x, y, z);
|
||||
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.scraps) {
|
||||
MaterialStack mat = ItemScraps.getMats(player.getHeldItem());
|
||||
if(mat != null) {
|
||||
tile.filter = mat.material;
|
||||
}
|
||||
} else {
|
||||
tile.invertRedstone = !tile.invertRedstone;
|
||||
}
|
||||
tile.markDirty();
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
|
||||
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 false; }
|
||||
@Override public MaterialStack pour(World world, int x, int y, int z, double dX, double dY, double dZ, ForgeDirection side, MaterialStack stack) { return stack; }
|
||||
@ -129,4 +166,19 @@ public class FoundryOutlet extends BlockContainer implements ICrucibleAcceptor {
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
TileEntityFoundryOutlet outlet = (TileEntityFoundryOutlet) world.getTileEntity(x, y, z);
|
||||
List<String> text = new ArrayList();
|
||||
|
||||
if(outlet.filter != null) {
|
||||
text.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("foundry.filter", outlet.filter.names[0]));
|
||||
}
|
||||
if(outlet.invertRedstone) {
|
||||
text.add(EnumChatFormatting.DARK_RED + I18nUtil.resolveKey("foundry.inverted"));
|
||||
}
|
||||
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(this.getUnlocalizedName() + ".name"), 0xFF4000, 0x401000, text);
|
||||
}
|
||||
}
|
||||
|
||||
122
src/main/java/com/hbm/blocks/machine/FoundryTank.java
Normal file
122
src/main/java/com/hbm/blocks/machine/FoundryTank.java
Normal file
@ -0,0 +1,122 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||
import com.hbm.items.machine.ItemScraps;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityFoundryTank;
|
||||
|
||||
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.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTool;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class FoundryTank extends BlockContainer implements ICrucibleAcceptor {
|
||||
|
||||
@SideOnly(Side.CLIENT) public IIcon iconTop;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconSide;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconSideUpper;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconBottom;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconInner;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconLava;
|
||||
|
||||
public FoundryTank() {
|
||||
super(Material.rock);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
super.registerBlockIcons(iconRegister);
|
||||
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":foundry_tank_top");
|
||||
this.iconSide = iconRegister.registerIcon(RefStrings.MODID + ":foundry_tank_side");
|
||||
this.iconSideUpper = iconRegister.registerIcon(RefStrings.MODID + ":foundry_tank_upper");
|
||||
this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + ":foundry_tank_bottom");
|
||||
this.iconInner = iconRegister.registerIcon(RefStrings.MODID + ":foundry_tank_inner");
|
||||
this.iconLava = iconRegister.registerIcon(RefStrings.MODID + ":lava_gray");
|
||||
}
|
||||
|
||||
@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 TileEntityFoundryTank();
|
||||
}
|
||||
|
||||
@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 false; }
|
||||
@Override public MaterialStack flow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) { return stack; }
|
||||
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
TileEntityFoundryTank cast = (TileEntityFoundryTank) world.getTileEntity(x, y, z);
|
||||
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemTool && ((ItemTool) player.getHeldItem().getItem()).getToolClasses(player.getHeldItem()).contains("shovel")) {
|
||||
if(cast.amount > 0) {
|
||||
ItemStack scrap = ItemScraps.create(new MaterialStack(cast.type, cast.amount));
|
||||
if(!player.inventory.addItemStackToInventory(scrap)) {
|
||||
EntityItem item = new EntityItem(world, x + 0.5, y + this.maxY, z + 0.5, scrap);
|
||||
world.spawnEntityInWorld(item);
|
||||
} else {
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
}
|
||||
cast.amount = 0;
|
||||
cast.type = null;
|
||||
cast.markDirty();
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
return side != ForgeDirection.UP;
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,20 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||
import com.hbm.items.machine.ItemScraps;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.TileEntityCrucible;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTool;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
@ -32,7 +42,40 @@ public class MachineCrucible extends BlockDummyable {
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||
|
||||
if(world.isRemote) {
|
||||
return true;
|
||||
} else if(!player.isSneaking()) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
if(pos == null)
|
||||
return false;
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemTool && ((ItemTool) player.getHeldItem().getItem()).getToolClasses(player.getHeldItem()).contains("shovel")) {
|
||||
TileEntityCrucible crucible = (TileEntityCrucible) world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
List<MaterialStack> stacks = new ArrayList();
|
||||
stacks.addAll(crucible.recipeStack);
|
||||
stacks.addAll(crucible.wasteStack);
|
||||
|
||||
for(MaterialStack stack : stacks) {
|
||||
ItemStack scrap = ItemScraps.create(new MaterialStack(stack.material, stack.amount));
|
||||
if(!player.inventory.addItemStackToInventory(scrap)) {
|
||||
EntityItem item = new EntityItem(world, x + hitX, y + hitY, z + hitZ, scrap);
|
||||
world.spawnEntityInWorld(item);
|
||||
}
|
||||
}
|
||||
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
crucible.recipeStack.clear();
|
||||
crucible.wasteStack.clear();
|
||||
crucible.markDirty();
|
||||
|
||||
} else {
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
24
src/main/java/com/hbm/inventory/SlotNonRetarded.java
Normal file
24
src/main/java/com/hbm/inventory/SlotNonRetarded.java
Normal file
@ -0,0 +1,24 @@
|
||||
package com.hbm.inventory;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Because vanilla slots have severe mental disabilities that prevent them from working as expected.
|
||||
* @author hbm
|
||||
*/
|
||||
public class SlotNonRetarded extends Slot {
|
||||
|
||||
public SlotNonRetarded(IInventory inventory, int id, int x, int y) {
|
||||
super(inventory, id, x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dear mojang: Why wasn't that the standard to begin with? What do IInventories have isItemValidForSlot when by default nothing fucking uses it?
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
return inventory.isItemValidForSlot(this.slotNumber, stack);
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotNonRetarded;
|
||||
import com.hbm.tileentity.machine.TileEntityCrucible;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
|
||||
@ -17,12 +18,12 @@ public class ContainerCrucible extends Container {
|
||||
this.crucible = crucible;
|
||||
|
||||
//template
|
||||
this.addSlotToContainer(new Slot(crucible, 0, 107, 81));
|
||||
this.addSlotToContainer(new SlotNonRetarded(crucible, 0, 107, 81));
|
||||
|
||||
//input
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 3; j++) {
|
||||
this.addSlotToContainer(new Slot(crucible, j + i * 3 + 1, 107 + j * 18, 18 + i * 18));
|
||||
this.addSlotToContainer(new SlotNonRetarded(crucible, j + i * 3 + 1, 107 + j * 18, 18 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -63,8 +63,8 @@ public class GUICrucible extends GuiInfoContainer {
|
||||
int hGauge = crucible.heat * 33 / crucible.maxHeat;
|
||||
if(hGauge > 0) drawTexturedModalRect(guiLeft + 126, guiTop + 91, 176, 5, hGauge, 5);
|
||||
|
||||
if(!crucible.recipeStack.isEmpty()) drawStack(crucible.recipeStack, crucible.recipeCapacity, 62, 97);
|
||||
if(!crucible.wasteStack.isEmpty()) drawStack(crucible.wasteStack, crucible.wasteCapacity, 17, 97);
|
||||
if(!crucible.recipeStack.isEmpty()) drawStack(crucible.recipeStack, crucible.recipeZCapacity, 62, 97);
|
||||
if(!crucible.wasteStack.isEmpty()) drawStack(crucible.wasteStack, crucible.wasteZCapacity, 17, 97);
|
||||
}
|
||||
|
||||
protected void drawStackInfo(List<MaterialStack> stack, int mouseX, int mouseY, int x, int y) {
|
||||
|
||||
@ -13,6 +13,7 @@ import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.recipes.AssemblerRecipes;
|
||||
import com.hbm.inventory.recipes.ChemplantRecipes;
|
||||
import com.hbm.inventory.recipes.ChemplantRecipes.ChemRecipe;
|
||||
import com.hbm.inventory.recipes.CrucibleRecipes;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemAssemblyTemplate;
|
||||
import com.hbm.items.machine.ItemCassette;
|
||||
@ -88,6 +89,11 @@ public class GUIScreenTemplateFolder extends GuiScreen {
|
||||
ChemRecipe chem = ChemplantRecipes.recipes.get(i);
|
||||
allStacks.add(new ItemStack(ModItems.chemistry_template, 1, chem.getId()));
|
||||
}
|
||||
|
||||
// Crucible Templates
|
||||
for(int i = 0; i < CrucibleRecipes.recipes.size(); i++) {
|
||||
allStacks.add(new ItemStack(ModItems.crucible_template, 1, CrucibleRecipes.recipes.get(i).getId()));
|
||||
}
|
||||
} else {
|
||||
|
||||
for(int i = 0; i < AssemblerRecipes.recipeList.size(); i++) {
|
||||
@ -290,19 +296,21 @@ public class GUIScreenTemplateFolder extends GuiScreen {
|
||||
|
||||
public void drawIcon(boolean b) {
|
||||
try {
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)240 / 1.0F, (float)240 / 1.0F);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) 240 / 1.0F, (float) 240 / 1.0F);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
if(stack != null) {
|
||||
if(stack.getItem() == ModItems.assembly_template)
|
||||
itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), AssemblerRecipes.getOutputFromTempate(stack), xPos + 1, yPos + 1);
|
||||
else if(stack.getItem() == ModItems.chemistry_template)
|
||||
itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), new ItemStack(ModItems.chemistry_icon, 1, stack.getItemDamage()), xPos + 1, yPos + 1);
|
||||
else if(stack.getItem() == ModItems.crucible_template)
|
||||
itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), CrucibleRecipes.indexMapping.get(stack.getItemDamage()).icon, xPos + 1, yPos + 1);
|
||||
else
|
||||
itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), stack, xPos + 1, yPos + 1);
|
||||
}
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
} catch(Exception x) {
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,9 @@ import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.inventory.material.Mats;
|
||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||
import com.hbm.inventory.recipes.loader.SerializableRecipe;
|
||||
import com.hbm.items.ModItems;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CrucibleRecipes extends SerializableRecipe {
|
||||
|
||||
@ -24,17 +27,17 @@ public class CrucibleRecipes extends SerializableRecipe {
|
||||
@Override
|
||||
public void registerDefaults() {
|
||||
|
||||
recipes.add(new CrucibleRecipe(0, "crucible.steel", 1)
|
||||
.inputs(new MaterialStack(Mats.MAT_IRON, 10), new MaterialStack(Mats.MAT_COAL, 15))
|
||||
.outputs(new MaterialStack(Mats.MAT_STEEL, 10)));
|
||||
recipes.add(new CrucibleRecipe(0, "crucible.steel", 1, new ItemStack(ModItems.ingot_steel))
|
||||
.inputs(new MaterialStack(Mats.MAT_IRON, 8), new MaterialStack(Mats.MAT_COAL, 8))
|
||||
.outputs(new MaterialStack(Mats.MAT_STEEL, 8)));
|
||||
|
||||
recipes.add(new CrucibleRecipe(1, "crucible.redcopper", 1)
|
||||
.inputs(new MaterialStack(Mats.MAT_STEEL, 10), new MaterialStack(Mats.MAT_REDSTONE, 10))
|
||||
.outputs(new MaterialStack(Mats.MAT_MINGRADE, 20)));
|
||||
recipes.add(new CrucibleRecipe(1, "crucible.redcopper", 1, new ItemStack(ModItems.ingot_red_copper))
|
||||
.inputs(new MaterialStack(Mats.MAT_COPPER, 8), new MaterialStack(Mats.MAT_REDSTONE, 8))
|
||||
.outputs(new MaterialStack(Mats.MAT_MINGRADE, 16)));
|
||||
|
||||
recipes.add(new CrucibleRecipe(2, "crucible.aa", 1)
|
||||
.inputs(new MaterialStack(Mats.MAT_STEEL, 10), new MaterialStack(Mats.MAT_MINGRADE, 10))
|
||||
.outputs(new MaterialStack(Mats.MAT_ALLOY, 20)));
|
||||
recipes.add(new CrucibleRecipe(2, "crucible.aa", 1, new ItemStack(ModItems.ingot_advanced_alloy))
|
||||
.inputs(new MaterialStack(Mats.MAT_STEEL, 8), new MaterialStack(Mats.MAT_MINGRADE, 8))
|
||||
.outputs(new MaterialStack(Mats.MAT_ALLOY, 16)));
|
||||
}
|
||||
|
||||
public static class CrucibleRecipe {
|
||||
@ -43,11 +46,13 @@ public class CrucibleRecipes extends SerializableRecipe {
|
||||
private int id;
|
||||
private String name;
|
||||
public int frequency = 1;
|
||||
public ItemStack icon;
|
||||
|
||||
public CrucibleRecipe(int id, String name, int frequency) {
|
||||
public CrucibleRecipe(int id, String name, int frequency, ItemStack icon) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.frequency = frequency;
|
||||
this.icon = icon;
|
||||
|
||||
if(!indexMapping.containsKey(id)) {
|
||||
indexMapping.put(id, this);
|
||||
|
||||
@ -273,6 +273,13 @@ public class AnvilRecipes {
|
||||
new ComparableStack(ModItems.sawblade)
|
||||
}, new AnvilOutput(new ItemStack(ModBlocks.machine_sawmill))).setTier(2));
|
||||
|
||||
constructionRecipes.add(new AnvilConstructionRecipe(
|
||||
new AStack[] {
|
||||
new ComparableStack(ModItems.ingot_firebrick, 20),
|
||||
new OreDictStack(CU.ingot(), 8),
|
||||
new OreDictStack(STEEL.plate(), 8)
|
||||
}, new AnvilOutput(new ItemStack(ModBlocks.machine_crucible))).setTier(2));
|
||||
|
||||
constructionRecipes.add(new AnvilConstructionRecipe(
|
||||
new AStack[] {
|
||||
new OreDictStack(STEEL.ingot(), 6),
|
||||
|
||||
@ -6,6 +6,7 @@ import com.hbm.inventory.material.Mats;
|
||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||
import com.hbm.inventory.recipes.CrucibleRecipes;
|
||||
import com.hbm.inventory.recipes.CrucibleRecipes.CrucibleRecipe;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -13,6 +14,7 @@ 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;
|
||||
|
||||
public class ItemCrucibleTemplate extends Item {
|
||||
|
||||
@ -37,17 +39,16 @@ public class ItemCrucibleTemplate extends Item {
|
||||
if(recipe == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
list.add("Input:");
|
||||
|
||||
list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("info.template_out_p"));
|
||||
for(MaterialStack out : recipe.output) {
|
||||
list.add(out.material.names[0] + ": " + Mats.formatAmount(out.amount));
|
||||
}
|
||||
|
||||
list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("info.template_in_p"));
|
||||
|
||||
for(MaterialStack in : recipe.input) {
|
||||
list.add("- " + in.material.names[0] + ": " + Mats.formatAmount(in.amount));
|
||||
}
|
||||
|
||||
list.add("Output:");
|
||||
|
||||
for(MaterialStack out : recipe.output) {
|
||||
list.add("- " + out.material.names[0] + ": " + Mats.formatAmount(out.amount));
|
||||
list.add(in.material.names[0] + ": " + Mats.formatAmount(in.amount));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ public class ItemScraps extends Item {
|
||||
MaterialStack contents = getMats(stack);
|
||||
|
||||
if(contents != null) {
|
||||
list.add(contents.material.names[0] + " " + Mats.formatAmount(contents.amount));
|
||||
list.add(contents.material.names[0] + ", " + Mats.formatAmount(contents.amount));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -744,10 +744,11 @@ public class ClientProxy extends ServerProxy {
|
||||
RenderingRegistry.registerBlockHandler(new RenderBoxDuct());
|
||||
RenderingRegistry.registerBlockHandler(new RenderBlockDecoModel(ModBlocks.deco_computer.getRenderType(), ResourceManager.deco_computer));
|
||||
|
||||
RenderingRegistry.registerBlockHandler(new RenderBasin());
|
||||
RenderingRegistry.registerBlockHandler(new RenderMold());
|
||||
RenderingRegistry.registerBlockHandler(new RenderChannel());
|
||||
RenderingRegistry.registerBlockHandler(new RenderOutlet());
|
||||
RenderingRegistry.registerBlockHandler(new RenderFoundryBasin());
|
||||
RenderingRegistry.registerBlockHandler(new RenderFoundryMold());
|
||||
RenderingRegistry.registerBlockHandler(new RenderFoundryChannel());
|
||||
RenderingRegistry.registerBlockHandler(new RenderFoundryTank());
|
||||
RenderingRegistry.registerBlockHandler(new RenderFoundryOutlet());
|
||||
|
||||
RenderingRegistry.registerBlockHandler(new RenderBlockRotated(ModBlocks.charge_dynamite.getRenderType(), ResourceManager.charge_dynamite));
|
||||
RenderingRegistry.registerBlockHandler(new RenderBlockRotated(ModBlocks.charge_c4.getRenderType(), ResourceManager.charge_c4));
|
||||
|
||||
@ -954,6 +954,7 @@ public class CraftingManager {
|
||||
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(ModBlocks.foundry_tank), new Object[] { "B B", "I I", "BSB", 'B', ModItems.ingot_firebrick, 'I', STEEL.ingot(), 'S', Blocks.stone_slab });
|
||||
addShapelessAuto(new ItemStack(ModBlocks.foundry_outlet), new Object[] { ModBlocks.foundry_channel, STEEL.plate() });
|
||||
addRecipeAuto(new ItemStack(ModItems.mold_base), new Object[] { " B ", "BIB", " B ", 'B', ModItems.ingot_firebrick, 'I', IRON.ingot() });
|
||||
addRecipeAuto(new ItemStack(ModBlocks.brick_fire), new Object[] { "BB", "BB", 'B', ModItems.ingot_firebrick });
|
||||
|
||||
@ -25,8 +25,6 @@ import com.hbm.interfaces.IItemHUD;
|
||||
import com.hbm.interfaces.Spaghetti;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.inventory.gui.GUIArmorTable;
|
||||
import com.hbm.inventory.material.Mats;
|
||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||
import com.hbm.items.ISyncButtons;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.armor.ArmorFSB;
|
||||
@ -644,14 +642,14 @@ public class ModEventHandlerClient {
|
||||
list.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey("cannery.f1"));
|
||||
}
|
||||
|
||||
ItemStack copy = stack.copy();
|
||||
/*ItemStack copy = stack.copy();
|
||||
List<MaterialStack> materials = Mats.getMaterialsFromItem(copy);
|
||||
|
||||
if(!materials.isEmpty()) {
|
||||
for(MaterialStack mat : materials) {
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + mat.material.names[0] + ": " + Mats.formatAmount(mat.amount * stack.stackSize));
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
private ResourceLocation ashes = new ResourceLocation(RefStrings.MODID + ":textures/misc/overlay_ash.png");
|
||||
|
||||
@ -6,6 +6,7 @@ import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemAssemblyTemplate;
|
||||
import com.hbm.items.machine.ItemCassette;
|
||||
import com.hbm.items.machine.ItemChemistryTemplate;
|
||||
import com.hbm.items.machine.ItemCrucibleTemplate;
|
||||
import com.hbm.items.machine.ItemFluidIdentifier;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
|
||||
@ -85,6 +86,10 @@ public class ItemFolderPacket implements IMessage {
|
||||
tryMakeItem(p, stack, Items.paper, "dye");
|
||||
return null;
|
||||
}
|
||||
if(stack.getItem() instanceof ItemCrucibleTemplate) {
|
||||
tryMakeItem(p, stack, Items.paper, "dye");
|
||||
return null;
|
||||
}
|
||||
if(stack.getItem() instanceof ItemCassette) {
|
||||
tryMakeItem(p, stack, ModItems.plate_polymer, "plateSteel");
|
||||
return null;
|
||||
|
||||
@ -11,7 +11,7 @@ import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class RenderBasin implements ISimpleBlockRenderingHandler {
|
||||
public class RenderFoundryBasin implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
@ -16,7 +16,7 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class RenderChannel implements ISimpleBlockRenderingHandler {
|
||||
public class RenderFoundryChannel implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
@ -11,7 +11,7 @@ import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class RenderMold implements ISimpleBlockRenderingHandler {
|
||||
public class RenderFoundryMold implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
@ -3,6 +3,7 @@ package com.hbm.render.block;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.machine.FoundryOutlet;
|
||||
import com.hbm.tileentity.machine.TileEntityFoundryOutlet;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import net.minecraft.block.Block;
|
||||
@ -11,7 +12,7 @@ import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class RenderOutlet implements ISimpleBlockRenderingHandler {
|
||||
public class RenderFoundryOutlet implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
@ -81,6 +82,7 @@ public class RenderOutlet implements ISimpleBlockRenderingHandler {
|
||||
|
||||
FoundryOutlet outlet = (FoundryOutlet) block;
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
TileEntityFoundryOutlet tile = (TileEntityFoundryOutlet) world.getTileEntity(x, y, z);
|
||||
|
||||
int brightness = block.getMixedBrightnessForBlock(world, x, y, z);
|
||||
tessellator.setBrightness(brightness);
|
||||
@ -100,7 +102,20 @@ public class RenderOutlet implements ISimpleBlockRenderingHandler {
|
||||
renderer.renderFaceZNeg(block, x, y, z + 0.3125D, outlet.iconInner);
|
||||
renderer.field_152631_f = false;
|
||||
tessellator.setColorOpaque_F(r * mulX, g * mulX, b * mulX);
|
||||
renderer.renderFaceXPos(block, x, y, z, outlet.iconFront);
|
||||
renderer.renderFaceXNeg(block, x, y, z, outlet.iconFront);
|
||||
|
||||
if(tile.filter != null) {
|
||||
renderer.setRenderBounds(0.96875D, 0.0625, 0.375D, 0.96875D, top, 0.625D);
|
||||
renderer.renderFaceXPos(block, x, y, z, outlet.iconFilter);
|
||||
renderer.renderFaceXNeg(block, x, y, z, outlet.iconFilter);
|
||||
}
|
||||
|
||||
if(tile.isClosed()) {
|
||||
renderer.setRenderBounds(0.9375D, 0.0625, 0.375D, 0.9375D, top, 0.625D);
|
||||
renderer.renderFaceXPos(block, x, y, z, outlet.iconLock);
|
||||
renderer.renderFaceXNeg(block, x, y, z, outlet.iconLock);
|
||||
}
|
||||
}
|
||||
|
||||
if(meta == 5) {
|
||||
@ -119,6 +134,19 @@ public class RenderOutlet implements ISimpleBlockRenderingHandler {
|
||||
renderer.field_152631_f = false;
|
||||
tessellator.setColorOpaque_F(r * mulX, g * mulX, b * mulX);
|
||||
renderer.renderFaceXPos(block, x, y, z, outlet.iconFront);
|
||||
renderer.renderFaceXNeg(block, x, y, z, outlet.iconFront);
|
||||
|
||||
if(tile.filter != null) {
|
||||
renderer.setRenderBounds(0.03125D, 0.0625, 0.375D, 0.03125D, top, 0.625D);
|
||||
renderer.renderFaceXPos(block, x, y, z, outlet.iconFilter);
|
||||
renderer.renderFaceXNeg(block, x, y, z, outlet.iconFilter);
|
||||
}
|
||||
|
||||
if(tile.isClosed()) {
|
||||
renderer.setRenderBounds(0.0625D, 0.0625, 0.375D, 0.0625D, top, 0.625D);
|
||||
renderer.renderFaceXPos(block, x, y, z, outlet.iconLock);
|
||||
renderer.renderFaceXNeg(block, x, y, z, outlet.iconLock);
|
||||
}
|
||||
}
|
||||
|
||||
if(meta == 2) {
|
||||
@ -136,7 +164,20 @@ public class RenderOutlet implements ISimpleBlockRenderingHandler {
|
||||
renderer.renderFaceXNeg(block, x, y, z, outlet.iconSide);
|
||||
renderer.renderFaceXNeg(block, x + 0.3125D, y, z, outlet.iconInner);
|
||||
tessellator.setColorOpaque_F(r * mulZ, g * mulZ, b * mulZ);
|
||||
renderer.renderFaceZPos(block, x, y, z, outlet.iconFront);
|
||||
renderer.renderFaceZNeg(block, x, y, z, outlet.iconFront);
|
||||
|
||||
if(tile.filter != null) {
|
||||
renderer.setRenderBounds(0.375D, 0.0625, 0.96875D, 0.625D, top, 0.96875D);
|
||||
renderer.renderFaceZPos(block, x, y, z, outlet.iconFilter);
|
||||
renderer.renderFaceZNeg(block, x, y, z, outlet.iconFilter);
|
||||
}
|
||||
|
||||
if(tile.isClosed()) {
|
||||
renderer.setRenderBounds(0.375D, 0.0625, 0.9375D, 0.625D, top, 0.9375D);
|
||||
renderer.renderFaceZPos(block, x, y, z, outlet.iconLock);
|
||||
renderer.renderFaceZNeg(block, x, y, z, outlet.iconLock);
|
||||
}
|
||||
}
|
||||
|
||||
if(meta == 3) {
|
||||
@ -155,6 +196,19 @@ public class RenderOutlet implements ISimpleBlockRenderingHandler {
|
||||
renderer.renderFaceXNeg(block, x + 0.3125D, y, z, outlet.iconInner);
|
||||
tessellator.setColorOpaque_F(r * mulZ, g * mulZ, b * mulZ);
|
||||
renderer.renderFaceZPos(block, x, y, z, outlet.iconFront);
|
||||
renderer.renderFaceZNeg(block, x, y, z, outlet.iconFront);
|
||||
|
||||
if(tile.filter != null) {
|
||||
renderer.setRenderBounds(0.375D, 0.0625D, 0.03125, 0.625D, top, 0.03125D);
|
||||
renderer.renderFaceZPos(block, x, y, z, outlet.iconFilter);
|
||||
renderer.renderFaceZNeg(block, x, y, z, outlet.iconFilter);
|
||||
}
|
||||
|
||||
if(tile.isClosed()) {
|
||||
renderer.setRenderBounds(0.375D, 0.0625, 0.0625D, 0.625D, top, 0.0625D);
|
||||
renderer.renderFaceZPos(block, x, y, z, outlet.iconLock);
|
||||
renderer.renderFaceZNeg(block, x, y, z, outlet.iconLock);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
201
src/main/java/com/hbm/render/block/RenderFoundryTank.java
Normal file
201
src/main/java/com/hbm/render/block/RenderFoundryTank.java
Normal file
@ -0,0 +1,201 @@
|
||||
package com.hbm.render.block;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.machine.FoundryTank;
|
||||
import com.hbm.tileentity.machine.TileEntityFoundryTank;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class RenderFoundryTank implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
FoundryTank basin = (FoundryTank) block;
|
||||
double x = 0;
|
||||
double y = 0;
|
||||
double z = 0;
|
||||
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0F, 1F, 0F);
|
||||
renderer.renderFaceYPos(block, x, y, z, basin.iconTop);
|
||||
renderer.renderFaceYPos(block, x, y - 0.875D, z, basin.iconBottom);
|
||||
tessellator.setNormal(0F, -1F, 0F);
|
||||
renderer.renderFaceYNeg(block, x, y, z, basin.iconBottom);
|
||||
tessellator.setNormal(1F, 0F, 0F);
|
||||
renderer.renderFaceXPos(block, x, y, z, basin.iconSide);
|
||||
renderer.renderFaceXPos(block, x - 0.875D, y, z, basin.iconInner);
|
||||
tessellator.setNormal(-1F, 0F, 0F);
|
||||
renderer.renderFaceXNeg(block, x, y, z, basin.iconSide);
|
||||
renderer.renderFaceXNeg(block, x + 0.875D, y, z, basin.iconInner);
|
||||
tessellator.setNormal(0F, 0F, 1F);
|
||||
renderer.renderFaceZPos(block, x, y, z, basin.iconSide);
|
||||
renderer.renderFaceZPos(block, x, y, z - 0.875D, basin.iconInner);
|
||||
tessellator.setNormal(0F, 0F, -1F);
|
||||
renderer.renderFaceZNeg(block, x, y, z, basin.iconSide);
|
||||
renderer.renderFaceZNeg(block, x, y, z + 0.875D, basin.iconInner);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
int colorMult = block.colorMultiplier(world, x, y, z);
|
||||
float r = (float) (colorMult >> 16 & 255) / 255.0F;
|
||||
float g = (float) (colorMult >> 8 & 255) / 255.0F;
|
||||
float b = (float) (colorMult & 255) / 255.0F;
|
||||
|
||||
float mulBottom = 0.5F;
|
||||
float mulTop = 1.0F;
|
||||
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;
|
||||
float aB = (r * 30.0F + b * 70.0F) / 100.0F;
|
||||
r = aR;
|
||||
g = aG;
|
||||
b = aB;
|
||||
}
|
||||
|
||||
FoundryTank tank = (FoundryTank) block;
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
TileEntityFoundryTank tile = null;
|
||||
|
||||
if(te instanceof TileEntityFoundryTank) {
|
||||
tile = (TileEntityFoundryTank) te;
|
||||
}
|
||||
|
||||
boolean conPosX = world.getBlock(x + 1, y, z) == ModBlocks.foundry_tank;
|
||||
boolean conNegX = world.getBlock(x - 1, y, z) == ModBlocks.foundry_tank;
|
||||
boolean conPosZ = world.getBlock(x, y, z + 1) == ModBlocks.foundry_tank;
|
||||
boolean conNegZ = world.getBlock(x, y, z - 1) == ModBlocks.foundry_tank;
|
||||
boolean conPosY = world.getBlock(x, y + 1, z) == ModBlocks.foundry_tank;
|
||||
boolean conNegY = world.getBlock(x, y - 1, z) == ModBlocks.foundry_tank;
|
||||
|
||||
boolean doRender = tile != null ? (tile.amount > 0 && tile.type != null) : false;
|
||||
double max = 0.75D + (conNegY ? 0.125D : 0) + (conPosY ? 0.125D : 0);
|
||||
double level = doRender ? tile.amount * max / tile.getCapacity() : 0;
|
||||
Color color = doRender ? new Color(tile.type.moltenColor).brighter() : null;
|
||||
|
||||
if(color != null) {
|
||||
double brightener = 0.7D;
|
||||
int nr = (int) (255D - (255D - color.getRed()) * brightener);
|
||||
int ng = (int) (255D - (255D - color.getGreen()) * brightener);
|
||||
int nb = (int) (255D - (255D - color.getBlue()) * brightener);
|
||||
|
||||
color = new Color(nr, ng, nb);
|
||||
}
|
||||
|
||||
renderer.setRenderBounds(0D, 0D, 0D, 1D, 1D, 1D);
|
||||
|
||||
if(!conNegY) {
|
||||
renderer.setRenderBounds(0D, 0D, 0D, 1D, 0.125D, 1D);
|
||||
tessellator.setColorOpaque_F(r * mulTop, g * mulTop, b * mulTop);
|
||||
renderer.renderFaceYPos(block, x, y, z, tank.iconBottom);
|
||||
tessellator.setColorOpaque_F(r * mulBottom, g * mulBottom, b * mulBottom);
|
||||
renderer.renderFaceYNeg(block, x, y, z, tank.iconBottom);
|
||||
}
|
||||
|
||||
if(!conPosX) {
|
||||
renderer.setRenderBounds(0.875D, 0D, 0D, 1D, 1D, 1D);
|
||||
tessellator.setColorOpaque_F(r * mulX, g * mulX, b * mulX);
|
||||
renderer.renderFaceXPos(block, x, y, z, conNegY ? tank.iconSideUpper : tank.iconSide);
|
||||
renderer.renderFaceXNeg(block, x, y, z, conPosY ? tank.iconBottom : tank.iconInner);
|
||||
|
||||
tessellator.setColorOpaque_F(r * mulZ, g * mulZ, b * mulZ);
|
||||
if(conPosZ) renderer.renderFaceZPos(block, x, y, z, conPosY ? tank.iconBottom : tank.iconInner);
|
||||
if(conNegZ) renderer.renderFaceZNeg(block, x, y, z, conPosY ? tank.iconBottom : tank.iconInner);
|
||||
|
||||
tessellator.setColorOpaque_F(r * mulTop, g * mulTop, b * mulTop);
|
||||
renderer.renderFaceYPos(block, x, y, z, tank.iconTop);
|
||||
}
|
||||
|
||||
if(!conNegX) {
|
||||
renderer.setRenderBounds(0D, 0D, 0D, 0.125D, 1D, 1D);
|
||||
tessellator.setColorOpaque_F(r * mulX, g * mulX, b * mulX);
|
||||
renderer.renderFaceXPos(block, x, y, z, conPosY ? tank.iconBottom : tank.iconInner);
|
||||
renderer.renderFaceXNeg(block, x, y, z, conNegY ? tank.iconSideUpper : tank.iconSide);
|
||||
|
||||
tessellator.setColorOpaque_F(r * mulZ, g * mulZ, b * mulZ);
|
||||
if(conPosZ) renderer.renderFaceZPos(block, x, y, z, conPosY ? tank.iconBottom : tank.iconInner);
|
||||
if(conNegZ) renderer.renderFaceZNeg(block, x, y, z, conPosY ? tank.iconBottom : tank.iconInner);
|
||||
|
||||
tessellator.setColorOpaque_F(r * mulTop, g * mulTop, b * mulTop);
|
||||
renderer.renderFaceYPos(block, x, y, z, tank.iconTop);
|
||||
}
|
||||
|
||||
if(!conPosZ) {
|
||||
renderer.setRenderBounds(0D, 0D, 0.875D, 1D, 1D, 1D);
|
||||
tessellator.setColorOpaque_F(r * mulZ, g * mulZ, b * mulZ);
|
||||
renderer.renderFaceZPos(block, x, y, z, conNegY ? tank.iconSideUpper : tank.iconSide);
|
||||
renderer.renderFaceZNeg(block, x, y, z, conPosY ? tank.iconBottom : tank.iconInner);
|
||||
|
||||
tessellator.setColorOpaque_F(r * mulX, g * mulX, b * mulX);
|
||||
if(conPosX) renderer.renderFaceXPos(block, x, y, z, conPosY ? tank.iconBottom : tank.iconInner);
|
||||
if(conNegX) renderer.renderFaceXNeg(block, x, y, z, conPosY ? tank.iconBottom : tank.iconInner);
|
||||
|
||||
tessellator.setColorOpaque_F(r * mulTop, g * mulTop, b * mulTop);
|
||||
renderer.renderFaceYPos(block, x, y, z, tank.iconTop);
|
||||
}
|
||||
|
||||
if(!conNegZ) {
|
||||
renderer.setRenderBounds(0D, 0D, 0D, 1D, 1D, 0.125D);
|
||||
tessellator.setColorOpaque_F(r * mulZ, g * mulZ, b * mulZ);
|
||||
renderer.renderFaceZPos(block, x, y, z, conPosY ? tank.iconBottom : tank.iconInner);
|
||||
renderer.renderFaceZNeg(block, x, y, z, conNegY ? tank.iconSideUpper : tank.iconSide);
|
||||
|
||||
tessellator.setColorOpaque_F(r * mulX, g * mulX, b * mulX);
|
||||
if(conPosX) renderer.renderFaceXPos(block, x, y, z, conPosY ? tank.iconBottom : tank.iconInner);
|
||||
if(conNegX) renderer.renderFaceXNeg(block, x, y, z, conPosY ? tank.iconBottom : tank.iconInner);
|
||||
|
||||
tessellator.setColorOpaque_F(r * mulTop, g * mulTop, b * mulTop);
|
||||
renderer.renderFaceYPos(block, x, y, z, tank.iconTop);
|
||||
}
|
||||
|
||||
if(doRender) {
|
||||
double height = conNegY ? 0D : 0.125D;
|
||||
renderer.setRenderBounds(0D, height, 0D, 1D, height + level, 1D);
|
||||
tessellator.setColorOpaque_F(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F);
|
||||
tessellator.setBrightness(fullBright);
|
||||
renderer.renderFaceYPos(block, x, y, z, tank.iconLava);
|
||||
if(conPosX) renderer.renderFaceXPos(block, x, y, z, tank.iconLava);
|
||||
if(conNegX) renderer.renderFaceXNeg(block, x, y, z, tank.iconLava);
|
||||
if(conPosZ) renderer.renderFaceZPos(block, x, y, z, tank.iconLava);
|
||||
if(conNegZ) renderer.renderFaceZNeg(block, x, y, z, tank.iconLava);
|
||||
tessellator.setBrightness(brightness);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return FoundryTank.renderID;
|
||||
}
|
||||
}
|
||||
@ -42,7 +42,7 @@ public class RenderCrucible extends TileEntitySpecialRenderer implements IItemRe
|
||||
TileEntityCrucible crucible = (TileEntityCrucible) tile;
|
||||
|
||||
if(!crucible.recipeStack.isEmpty() || !crucible.wasteStack.isEmpty()) {
|
||||
int totalCap = crucible.recipeCapacity + crucible.wasteCapacity;
|
||||
int totalCap = crucible.recipeZCapacity + crucible.wasteZCapacity;
|
||||
int totalMass = 0;
|
||||
|
||||
for(MaterialStack stack : crucible.recipeStack) totalMass += stack.amount;
|
||||
|
||||
@ -90,7 +90,6 @@ public class RenderFoundry extends TileEntitySpecialRenderer {
|
||||
|
||||
if(foundry.shouldRender()) {
|
||||
|
||||
GL11.glDepthMask(false);
|
||||
this.bindTexture(lava);
|
||||
|
||||
int hex = foundry.getMat().moltenColor;
|
||||
@ -112,6 +111,7 @@ public class RenderFoundry extends TileEntitySpecialRenderer {
|
||||
tess.addVertexWithUV(foundry.maxX(), foundry.getLevel(), foundry.minZ(), foundry.minZ(), foundry.minX());
|
||||
tess.draw();
|
||||
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
tess.startDrawingQuads();
|
||||
|
||||
@ -26,7 +26,7 @@ public class RenderAccessoryUtility {
|
||||
private static ResourceLocation nostalgia = new ResourceLocation(RefStrings.MODID + ":textures/models/capes/CapeNostalgia.png");
|
||||
private static ResourceLocation nostalgia2 = new ResourceLocation(RefStrings.MODID + ":textures/models/capes/CapeNostalgia2.png");
|
||||
private static ResourceLocation sam = new ResourceLocation(RefStrings.MODID + ":textures/models/capes/CapeSam.png");
|
||||
private static ResourceLocation hoboy = new ResourceLocation(RefStrings.MODID + ":textures/models/capes/CapeHoboy.png");
|
||||
private static ResourceLocation hoboy = new ResourceLocation(RefStrings.MODID + ":textures/models/capes/CapeHoboy_mk3.png");
|
||||
private static ResourceLocation master = new ResourceLocation(RefStrings.MODID + ":textures/models/capes/CapeMaster.png");
|
||||
private static ResourceLocation mek = new ResourceLocation(RefStrings.MODID + ":textures/models/capes/CapeMek.png");
|
||||
private static ResourceLocation zippy = new ResourceLocation(RefStrings.MODID + ":textures/models/capes/CapeZippySqrl.png");
|
||||
|
||||
@ -255,6 +255,7 @@ public class TileMappings {
|
||||
put(TileEntityFoundryMold.class, "tileentity_foundry_mold");
|
||||
put(TileEntityFoundryBasin.class, "tileentity_foundry_basin");
|
||||
put(TileEntityFoundryChannel.class, "tileentity_foundry_channel");
|
||||
put(TileEntityFoundryTank.class, "tileentity_foundry_tank");
|
||||
put(TileEntityFoundryOutlet.class, "tileentity_foundry_outlet");
|
||||
|
||||
put(TileEntityMachineAutocrafter.class, "tileentity_autocrafter");
|
||||
|
||||
@ -42,8 +42,10 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro
|
||||
public static final int processTime = 20_000;
|
||||
public static final double diffusion = 0.25D;
|
||||
|
||||
public final int recipeCapacity = MaterialShapes.BLOCK.q(16);
|
||||
public final int wasteCapacity = MaterialShapes.BLOCK.q(16);
|
||||
//because eclipse's auto complete is dumb as a fucking rock, it's now called "ZCapacity" so it's listed AFTER the actual stacks in the auto complete list.
|
||||
//also martin i know you read these: no i will not switch to intellij after using eclipse for 8 years.
|
||||
public final int recipeZCapacity = MaterialShapes.BLOCK.q(16);
|
||||
public final int wasteZCapacity = MaterialShapes.BLOCK.q(16);
|
||||
public List<MaterialStack> recipeStack = new ArrayList();
|
||||
public List<MaterialStack> wasteStack = new ArrayList();
|
||||
|
||||
@ -95,7 +97,7 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro
|
||||
}
|
||||
}
|
||||
|
||||
int totalCap = recipeCapacity + wasteCapacity;
|
||||
int totalCap = recipeZCapacity + wasteZCapacity;
|
||||
int totalMass = 0;
|
||||
|
||||
for(MaterialStack stack : recipeStack) totalMass += stack.amount;
|
||||
@ -288,6 +290,16 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack) {
|
||||
|
||||
if(i == 0) {
|
||||
return stack.getItem() == ModItems.crucible_template;
|
||||
}
|
||||
|
||||
return isItemSmeltable(stack);
|
||||
}
|
||||
|
||||
public boolean isItemSmeltable(ItemStack stack) {
|
||||
|
||||
@ -317,7 +329,7 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro
|
||||
} else {
|
||||
|
||||
//the maximum is the recipe's ratio scaled up to the recipe stack's capacity
|
||||
int matMaximum = recipeInputRequired * this.recipeCapacity / recipeContent;
|
||||
int matMaximum = recipeInputRequired * this.recipeZCapacity / recipeContent;
|
||||
int amountStored = getQuantaFromType(recipeStack, mat.material);
|
||||
|
||||
matchesRecipe = true;
|
||||
@ -329,7 +341,7 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro
|
||||
}
|
||||
|
||||
//if the waste amount doesn't exceed the capacity and the recipe matches (or isn't null), return true
|
||||
return wasteAmount <= this.wasteCapacity && matchesRecipe;
|
||||
return wasteAmount <= this.wasteZCapacity && matchesRecipe;
|
||||
}
|
||||
|
||||
public void addToStack(List<MaterialStack> stack, MaterialStack matStack) {
|
||||
|
||||
@ -30,6 +30,7 @@ public class TileEntityFoundryChannel extends TileEntityFoundryBase {
|
||||
|
||||
if(nextUpdate <= 0 && this.amount > 0 && this.type != null) {
|
||||
|
||||
boolean hasOp = false;
|
||||
nextUpdate = worldObj.rand.nextInt(6) + 5;
|
||||
|
||||
List<Integer> ints = new ArrayList() {{ add(2); add(3); add(4); add(5); }};
|
||||
@ -50,36 +51,39 @@ public class TileEntityFoundryChannel extends TileEntityFoundryBase {
|
||||
} else {
|
||||
this.amount = left.amount;
|
||||
}
|
||||
return;
|
||||
hasOp = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(Integer i : ints) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
||||
TileEntity b = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ);
|
||||
|
||||
if(b instanceof TileEntityFoundryChannel) {
|
||||
TileEntityFoundryChannel acc = (TileEntityFoundryChannel) b;
|
||||
if(!hasOp) {
|
||||
for(Integer i : ints) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
||||
TileEntity b = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ);
|
||||
|
||||
if(acc.type == null || acc.type == this.type || acc.amount == 0) {
|
||||
acc.type = this.type;
|
||||
if(b instanceof TileEntityFoundryChannel) {
|
||||
TileEntityFoundryChannel acc = (TileEntityFoundryChannel) b;
|
||||
|
||||
if(worldObj.rand.nextInt(5) == 0) {
|
||||
//1:4 chance that the fill states are simply swapped
|
||||
//this promotes faster spreading and prevents spread limits
|
||||
int buf = this.amount;
|
||||
this.amount = acc.amount;
|
||||
acc.amount = buf;
|
||||
if(acc.type == null || acc.type == this.type || acc.amount == 0) {
|
||||
acc.type = this.type;
|
||||
|
||||
} else {
|
||||
//otherwise, equalize the neighbors
|
||||
int diff = this.amount - acc.amount;
|
||||
|
||||
if(diff > 0) {
|
||||
diff /= 2;
|
||||
this.amount -= diff;
|
||||
acc.amount += diff;
|
||||
if(worldObj.rand.nextInt(5) == 0) {
|
||||
//1:4 chance that the fill states are simply swapped
|
||||
//this promotes faster spreading and prevents spread limits
|
||||
int buf = this.amount;
|
||||
this.amount = acc.amount;
|
||||
acc.amount = buf;
|
||||
|
||||
} else {
|
||||
//otherwise, equalize the neighbors
|
||||
int diff = this.amount - acc.amount;
|
||||
|
||||
if(diff > 0) {
|
||||
diff /= 2;
|
||||
this.amount -= diff;
|
||||
acc.amount += diff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.inventory.material.Mats;
|
||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||
import com.hbm.inventory.material.NTMMaterial;
|
||||
import com.hbm.util.CrucibleUtil;
|
||||
|
||||
import api.hbm.block.ICrucibleAcceptor;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
@ -15,11 +17,25 @@ public class TileEntityFoundryOutlet extends TileEntityFoundryBase {
|
||||
public NTMMaterial filter = null;
|
||||
/** inverts redstone behavior, i.e. when TRUE, the outlet will be blocked by default and only open with redstone */
|
||||
public boolean invertRedstone = false;
|
||||
public boolean lastClosed = false;
|
||||
|
||||
/** if TRUE, prevents all fluids from flowing through the outlet and renders a small barrier */
|
||||
public boolean isClosed() {
|
||||
return invertRedstone ^ this.worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if(worldObj.isRemote) {
|
||||
boolean isClosed = isClosed();
|
||||
if(this.lastClosed != isClosed) {
|
||||
this.lastClosed = isClosed;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override public boolean canAcceptPartialPour(World world, int x, int y, int z, double dX, double dY, double dZ, ForgeDirection side, MaterialStack stack) { return false; }
|
||||
@Override public MaterialStack pour(World world, int x, int y, int z, double dX, double dY, double dZ, ForgeDirection side, MaterialStack stack) { return stack; }
|
||||
@ -62,4 +78,18 @@ public class TileEntityFoundryOutlet extends TileEntityFoundryBase {
|
||||
public int getCapacity() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
this.invertRedstone = nbt.getBoolean("invert");
|
||||
this.filter = Mats.matById.get((int) nbt.getShort("filter"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setBoolean("invert", this.invertRedstone);
|
||||
nbt.setShort("filter", this.filter == null ? -1 : (short) this.filter.id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,117 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.material.MaterialShapes;
|
||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||
|
||||
import api.hbm.block.ICrucibleAcceptor;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityFoundryTank extends TileEntityFoundryBase {
|
||||
|
||||
public int nextUpdate;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(this.type == null && this.amount != 0) {
|
||||
this.amount = 0;
|
||||
}
|
||||
|
||||
nextUpdate--;
|
||||
|
||||
if(nextUpdate <= 0 && this.amount > 0 && this.type != null) {
|
||||
|
||||
boolean hasOp = false;
|
||||
nextUpdate = worldObj.rand.nextInt(6) + 5;
|
||||
|
||||
TileEntity te = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord);
|
||||
|
||||
if(te instanceof TileEntityFoundryTank) {
|
||||
TileEntityFoundryTank tank = (TileEntityFoundryTank) te;
|
||||
|
||||
if((tank.type == null || tank.type == this.type) && tank.amount < tank.getCapacity()) {
|
||||
tank.type = this.type;
|
||||
int toFill = Math.min(this.amount, tank.getCapacity() - tank.amount);
|
||||
this.amount -= toFill;
|
||||
tank.amount += toFill;
|
||||
hasOp = true;
|
||||
}
|
||||
}
|
||||
|
||||
List<Integer> ints = new ArrayList() {{ add(2); add(3); add(4); add(5); }};
|
||||
Collections.shuffle(ints);
|
||||
|
||||
if(!hasOp) {
|
||||
|
||||
for(Integer i : ints) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
||||
Block b = worldObj.getBlock(xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ);
|
||||
|
||||
if(b instanceof ICrucibleAcceptor && b != ModBlocks.foundry_channel) {
|
||||
ICrucibleAcceptor acc = (ICrucibleAcceptor) b;
|
||||
|
||||
if(acc.canAcceptPartialFlow(worldObj, xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ, dir.getOpposite(), new MaterialStack(this.type, this.amount))) {
|
||||
MaterialStack left = acc.flow(worldObj, xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ, dir.getOpposite(), new MaterialStack(this.type, this.amount));
|
||||
if(left == null) {
|
||||
this.type = null;
|
||||
this.amount = 0;
|
||||
} else {
|
||||
this.amount = left.amount;
|
||||
}
|
||||
hasOp = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!hasOp) {
|
||||
for(Integer i : ints) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
||||
TileEntity b = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ);
|
||||
|
||||
if(b instanceof TileEntityFoundryTank) {
|
||||
TileEntityFoundryTank acc = (TileEntityFoundryTank) b;
|
||||
|
||||
if(acc.type == null || acc.type == this.type || acc.amount == 0) {
|
||||
acc.type = this.type;
|
||||
if(worldObj.rand.nextInt(5) == 0) {
|
||||
//1:4 chance that the fill states are simply swapped
|
||||
//this promotes faster spreading and prevents spread limits
|
||||
int buf = this.amount;
|
||||
this.amount = acc.amount;
|
||||
acc.amount = buf;
|
||||
|
||||
} else {
|
||||
int diff = this.amount - acc.amount;
|
||||
|
||||
if(diff > 0) {
|
||||
diff /= 2;
|
||||
this.amount -= diff;
|
||||
acc.amount += diff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.updateEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
return MaterialShapes.BLOCK.q(1);
|
||||
}
|
||||
}
|
||||
@ -489,6 +489,8 @@ fluid.schrabidic_fluid=Schrabidische Säure
|
||||
fluid.toxic_fluid=Stereotypischer grüner Schleim
|
||||
fluid.volcanic_lava_fluid=Vulkanische Lava
|
||||
|
||||
foundry.filter=Filter: %s
|
||||
foundry.inverted=Redstone invertiert
|
||||
foundry.noCast=Keine Form eingelegt!
|
||||
|
||||
geiger.chunkRad=Chunk-Strahlung:
|
||||
@ -2676,7 +2678,9 @@ item.scrap.name=Schrott
|
||||
item.scrap_nuclear.name=Radioaktiver Schutt
|
||||
item.scrap_oil.name=Öliger Schutt
|
||||
item.scrap_plastic.name=Geschreddertes Plastik
|
||||
item.scraps.name=Gießerei-Schutt
|
||||
item.screwdriver.name=Schraubenzieher
|
||||
item.screwdriver.desc=Könnte statt einer Sicherung verwendet werden...
|
||||
item.screwdriver_desh.name=Desh-Schraubenzieher
|
||||
item.scrumpy.name=Flasche Scrumpy
|
||||
item.security_boots.name=Sicherheitsstiefel
|
||||
@ -3348,7 +3352,9 @@ 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_tank.name=Gießerei-Lagerbecken
|
||||
tile.foundry_mold.name=Seichtes Gussbecken
|
||||
tile.foundry_outlet.name=Ausguss
|
||||
tile.fraction_spacer.name=Fraktionierungsturm-Teiler
|
||||
tile.frozen_dirt.name=Gefrorene Erde
|
||||
tile.frozen_grass.name=Gefrorenes Gras
|
||||
@ -3474,6 +3480,7 @@ tile.machine_condenser.name=Dampfkondensierer
|
||||
tile.machine_controller.name=Reaktorfernsteuerung
|
||||
tile.machine_converter_he_rf.name=HE zu RF Konverter
|
||||
tile.machine_converter_rf_he.name=RF zu HE Konverter
|
||||
tile.machine_crucible.name=Schmelztiegel
|
||||
tile.machine_crystallizer.name=Erzauflöser
|
||||
tile.machine_cyclotron.name=Zyklotron
|
||||
tile.machine_detector.name=Energiedetektor
|
||||
|
||||
@ -719,6 +719,8 @@ fluid.schrabidic_fluid=Schrabidic Acid
|
||||
fluid.toxic_fluid=Stereotypical Green Ooze
|
||||
fluid.volcanic_lava_fluid=Volcanic Lava
|
||||
|
||||
foundry.filter=Filter: %s
|
||||
foundry.inverted=Redstone inverted
|
||||
foundry.noCast=No mold installed!
|
||||
|
||||
geiger.chunkRad=Current chunk radiation:
|
||||
@ -3098,6 +3100,7 @@ item.scrap.name=Scrap
|
||||
item.scrap_nuclear.name=Radioactive Scraps
|
||||
item.scrap_oil.name=Oily Scraps
|
||||
item.scrap_plastic.name=Plastic Scraps
|
||||
item.scraps.name=Foundry Scraps
|
||||
item.screwdriver.name=Screwdriver
|
||||
item.screwdriver.desc=Could be used instead of a fuse...
|
||||
item.screwdriver_desh.name=Desh Screwdriver
|
||||
@ -3798,7 +3801,9 @@ 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_tank.name=Foundry Storage Basin
|
||||
tile.foundry_mold.name=Shallow Foundry Basin
|
||||
tile.foundry_outlet.name=Foundry Outlet
|
||||
tile.fraction_spacer.name=Fractioning Tower Separator
|
||||
tile.frozen_dirt.name=Frozen Dirt
|
||||
tile.frozen_grass.name=Frozen Grass
|
||||
@ -3924,6 +3929,7 @@ tile.machine_condenser.name=Steam Condenser
|
||||
tile.machine_controller.name=Reactor Remote Control Block
|
||||
tile.machine_converter_he_rf.name=HE to RF Converter
|
||||
tile.machine_converter_rf_he.name=RF to HE Converter
|
||||
tile.machine_crucible.name=Crucible
|
||||
tile.machine_crystallizer.name=Ore Acidizer
|
||||
tile.machine_cyclotron.name=Cyclotron
|
||||
tile.machine_detector.name=Power Detector
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 515 B |
Binary file not shown.
|
After Width: | Height: | Size: 578 B |
Binary file not shown.
|
After Width: | Height: | Size: 600 B |
Binary file not shown.
|
After Width: | Height: | Size: 466 B |
Binary file not shown.
|
After Width: | Height: | Size: 657 B |
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Loading…
x
Reference in New Issue
Block a user