the ferocious sorter

This commit is contained in:
Bob 2022-08-15 15:57:18 +02:00
parent a9d7f9ca20
commit a9ea9a4b1f
56 changed files with 1407 additions and 221 deletions

View File

@ -10,6 +10,7 @@ public interface IToolable {
public static enum ToolType {
SCREWDRIVER,
HAND_DRILL,
DEFUSER
DEFUSER,
WRENCH
}
}

View File

@ -631,6 +631,7 @@ public class ModBlocks {
public static Block furnace_iron;
public static Block furnace_steel;
public static Block machine_stirling;
public static Block machine_stirling_steel;
public static Block machine_difurnace_off;
public static Block machine_difurnace_on;
@ -756,12 +757,14 @@ public class ModBlocks {
public static Block fluid_duct_box;
public static Block conveyor;
//public static Block conveyor_classic;
public static Block conveyor_double;
public static Block conveyor_triple;
public static Block conveyor_chute;
public static Block conveyor_lift;
public static Block crane_extractor;
public static Block crane_inserter;
public static Block crane_router;
public static Block crane_boxer;
public static Block crane_unboxer;
@ -1802,6 +1805,7 @@ public class ModBlocks {
furnace_iron = new FurnaceIron().setBlockName("furnace_iron").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_aluminium");
furnace_steel = new FurnaceSteel().setBlockName("furnace_steel").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_stirling = new MachineStirling().setBlockName("machine_stirling").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_stirling_steel = new MachineStirling().setBlockName("machine_stirling_steel").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_difurnace_off = new MachineDiFurnace(false).setBlockName("machine_difurnace_off").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
machine_difurnace_on = new MachineDiFurnace(true).setBlockName("machine_difurnace_on").setHardness(5.0F).setLightLevel(1.0F).setResistance(10.0F);
@ -1921,12 +1925,14 @@ public class ModBlocks {
fluid_duct_box = new FluidDuctBox(Material.iron).setBlockName("fluid_duct_box").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fluid_duct_box");
conveyor = new BlockConveyor().setBlockName("conveyor").setHardness(2.0F).setResistance(2.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":conveyor");
//conveyor_classic = new BlockConveyorClassic().setBlockName("conveyor_classic").setHardness(2.0F).setResistance(2.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":conveyor");
conveyor_double = new BlockConveyorDouble().setBlockName("conveyor_double").setHardness(2.0F).setResistance(2.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":conveyor_double");
conveyor_triple = new BlockConveyorTriple().setBlockName("conveyor_triple").setHardness(2.0F).setResistance(2.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":conveyor_triple");
conveyor_chute = new BlockConveyorChute().setBlockName("conveyor_chute").setHardness(2.0F).setResistance(2.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":conveyor");
conveyor_lift = new BlockConveyorLift().setBlockName("conveyor_lift").setHardness(2.0F).setResistance(2.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":conveyor");
crane_extractor = new CraneExtractor().setBlockName("crane_extractor").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
crane_inserter = new CraneInserter().setBlockName("crane_inserter").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
crane_router = new CraneRouter().setBlockName("crane_router").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
crane_boxer = new CraneBoxer().setBlockName("crane_boxer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
crane_unboxer = new CraneUnboxer().setBlockName("crane_unboxer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
@ -2858,7 +2864,7 @@ public class ModBlocks {
GameRegistry.registerBlock(turret_fritz, turret_fritz.getUnlocalizedName());
GameRegistry.registerBlock(turret_brandon, turret_brandon.getUnlocalizedName());
GameRegistry.registerBlock(turret_arty, turret_arty.getUnlocalizedName());
GameRegistry.registerBlock(turret_himars, turret_himars.getUnlocalizedName());
//GameRegistry.registerBlock(turret_himars, turret_himars.getUnlocalizedName());
//Wall-mounted Explosives
GameRegistry.registerBlock(charge_dynamite, ItemBlockBase.class, charge_dynamite.getUnlocalizedName());
@ -2984,6 +2990,7 @@ public class ModBlocks {
register(furnace_iron);
register(furnace_steel);
register(machine_stirling);
register(machine_stirling_steel);
GameRegistry.registerBlock(machine_difurnace_off, machine_difurnace_off.getUnlocalizedName());
GameRegistry.registerBlock(machine_difurnace_on, machine_difurnace_on.getUnlocalizedName());
GameRegistry.registerBlock(machine_difurnace_rtg_off, machine_difurnace_rtg_off.getUnlocalizedName());
@ -3098,9 +3105,11 @@ public class ModBlocks {
GameRegistry.registerBlock(crane_extractor, crane_extractor.getUnlocalizedName());
GameRegistry.registerBlock(crane_inserter, crane_inserter.getUnlocalizedName());
GameRegistry.registerBlock(crane_router, crane_router.getUnlocalizedName());
GameRegistry.registerBlock(crane_boxer, crane_boxer.getUnlocalizedName());
GameRegistry.registerBlock(crane_unboxer, crane_unboxer.getUnlocalizedName());
GameRegistry.registerBlock(conveyor, conveyor.getUnlocalizedName());
//GameRegistry.registerBlock(conveyor_classic, conveyor_classic.getUnlocalizedName());
GameRegistry.registerBlock(conveyor_double, conveyor_double.getUnlocalizedName());
GameRegistry.registerBlock(conveyor_triple, conveyor_triple.getUnlocalizedName());
GameRegistry.registerBlock(conveyor_chute, conveyor_chute.getUnlocalizedName());

View File

@ -78,8 +78,9 @@ public class MachineStirling extends BlockDummyable implements ILookOverlay, ITo
return false;
TileEntityStirling stirling = (TileEntityStirling)world.getTileEntity(pos[0], pos[1], pos[2]);
int meta = stirling.getGeatMeta();
if(!stirling.hasCog && player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.gear_large) {
if(!stirling.hasCog && player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.gear_large && player.getHeldItem().getItemDamage() == meta) {
player.getHeldItem().stackSize--;
stirling.hasCog = true;
stirling.markDirty();
@ -155,20 +156,21 @@ public class MachineStirling extends BlockDummyable implements ILookOverlay, ITo
return;
TileEntityStirling stirling = (TileEntityStirling) te;
int maxHeat = stirling.maxHeat();
List<String> text = new ArrayList();
text.add(stirling.heat + "TU/t");
text.add((stirling.hasCog ? stirling.powerBuffer : 0) + "HE/t");
double percent = (double) stirling.heat / 300D;
double percent = (double) stirling.heat / (double) maxHeat;
int color = ((int) (0xFF - 0xFF * percent)) << 16 | ((int)(0xFF * percent) << 8);
if(percent > 1D)
color = 0xff0000;
text.add("&[" + color + "&]" + ((stirling.heat * 1000 / 300) / 10D) + "%");
text.add("&[" + color + "&]" + ((stirling.heat * 1000 / maxHeat) / 10D) + "%");
if(stirling.heat > 300) {
if(stirling.heat > maxHeat) {
text.add("&[" + (BobMathUtil.getBlink() ? 0xff0000 : 0xffff00) + "&]! ! ! OVERSPEED ! ! !");
}

View File

@ -1,157 +1,8 @@
package com.hbm.blocks.network;
import com.hbm.entity.item.EntityMovingItem;
import com.hbm.lib.RefStrings;
import api.hbm.conveyor.IConveyorBelt;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
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.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockConveyor extends Block implements IConveyorBelt {
@SideOnly(Side.CLIENT)
protected IIcon sideIcon;
public class BlockConveyor extends BlockConveyorBendable {
public BlockConveyor() {
super(Material.iron);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
super.registerBlockIcons(iconRegister);
this.sideIcon = iconRegister.registerIcon(RefStrings.MODID + ":conveyor_side");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
if((metadata == 2 || metadata == 3) && (side == 4 || side == 5))
return this.sideIcon;
if((metadata == 4 || metadata == 5) && (side == 2 || side == 3))
return this.sideIcon;
return super.getIcon(side, metadata);
}
@Override
public Vec3 getTravelLocation(World world, int x, int y, int z, Vec3 itemPos, double speed) {
ForgeDirection dir = getTravelDirection(world, x, y, z, itemPos, speed);
//snapping point
Vec3 snap = this.getClosestSnappingPosition(world, x, y, z, itemPos);
//snapping point + speed
Vec3 dest = Vec3.createVectorHelper(snap.xCoord - dir.offsetX * speed, snap.yCoord - dir.offsetY * speed, snap.zCoord - dir.offsetZ * speed);
//delta to get to that point
Vec3 motion = Vec3.createVectorHelper((dest.xCoord - itemPos.xCoord), (dest.yCoord - itemPos.yCoord), (dest.zCoord - itemPos.zCoord));
double len = motion.lengthVector();
//the effective destination towards "dest" after taking speed into consideration
Vec3 ret = Vec3.createVectorHelper(itemPos.xCoord + motion.xCoord / len * speed, itemPos.yCoord + motion.yCoord / len * speed, itemPos.zCoord + motion.zCoord / len * speed);
return ret;
}
public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos, double speed) {
return ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
}
@Override
public Vec3 getClosestSnappingPosition(World world, int x, int y, int z, Vec3 itemPos) {
ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
itemPos.xCoord = MathHelper.clamp_double(itemPos.xCoord, x, x + 1);
itemPos.zCoord = MathHelper.clamp_double(itemPos.zCoord, z, z + 1);
double posX = x + 0.5;
double posZ = z + 0.5;
if(dir.offsetX != 0) {
posX = itemPos.xCoord;
}
if(dir.offsetZ != 0) {
posZ = itemPos.zCoord;
}
return Vec3.createVectorHelper(posX, y + 0.25, posZ);
}
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
if(!world.isRemote) {
if(entity instanceof EntityItem && entity.ticksExisted > 10 && !entity.isDead) {
EntityMovingItem item = new EntityMovingItem(world);
item.setItemStack(((EntityItem) entity).getEntityItem().copy());
Vec3 pos = Vec3.createVectorHelper(entity.posX, entity.posY, entity.posZ);
Vec3 snap = this.getClosestSnappingPosition(world, x, y, z, pos);
item.setPositionAndRotation(snap.xCoord, snap.yCoord, snap.zCoord, 0, 0);
world.spawnEntityInWorld(item);
entity.setDead();
}
}
}
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 void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F);
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 0.25, z + 1);
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
if(i == 0) {
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
}
if(i == 1) {
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
}
if(i == 2) {
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
}
if(i == 3) {
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
}
super();
}
}

View File

@ -0,0 +1,157 @@
package com.hbm.blocks.network;
import com.hbm.entity.item.EntityMovingItem;
import com.hbm.lib.RefStrings;
import api.hbm.conveyor.IConveyorBelt;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
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.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public abstract class BlockConveyorBase extends Block implements IConveyorBelt {
@SideOnly(Side.CLIENT)
protected IIcon sideIcon;
public BlockConveyorBase() {
super(Material.iron);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
super.registerBlockIcons(iconRegister);
this.sideIcon = iconRegister.registerIcon(RefStrings.MODID + ":conveyor_side");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
if((metadata == 2 || metadata == 3) && (side == 4 || side == 5))
return this.sideIcon;
if((metadata == 4 || metadata == 5) && (side == 2 || side == 3))
return this.sideIcon;
return super.getIcon(side, metadata);
}
@Override
public Vec3 getTravelLocation(World world, int x, int y, int z, Vec3 itemPos, double speed) {
ForgeDirection dir = this.getTravelDirection(world, x, y, z, itemPos);
//snapping point
Vec3 snap = this.getClosestSnappingPosition(world, x, y, z, itemPos);
//snapping point + speed
Vec3 dest = Vec3.createVectorHelper(snap.xCoord - dir.offsetX * speed, snap.yCoord - dir.offsetY * speed, snap.zCoord - dir.offsetZ * speed);
//delta to get to that point
Vec3 motion = Vec3.createVectorHelper((dest.xCoord - itemPos.xCoord), (dest.yCoord - itemPos.yCoord), (dest.zCoord - itemPos.zCoord));
double len = motion.lengthVector();
//the effective destination towards "dest" after taking speed into consideration
Vec3 ret = Vec3.createVectorHelper(itemPos.xCoord + motion.xCoord / len * speed, itemPos.yCoord + motion.yCoord / len * speed, itemPos.zCoord + motion.zCoord / len * speed);
return ret;
}
public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos) {
return ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
}
@Override
public Vec3 getClosestSnappingPosition(World world, int x, int y, int z, Vec3 itemPos) {
ForgeDirection dir = this.getTravelDirection(world, x, y, z, itemPos);
itemPos.xCoord = MathHelper.clamp_double(itemPos.xCoord, x, x + 1);
itemPos.zCoord = MathHelper.clamp_double(itemPos.zCoord, z, z + 1);
double posX = x + 0.5;
double posZ = z + 0.5;
if(dir.offsetX != 0) {
posX = itemPos.xCoord;
}
if(dir.offsetZ != 0) {
posZ = itemPos.zCoord;
}
return Vec3.createVectorHelper(posX, y + 0.25, posZ);
}
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
if(!world.isRemote) {
if(entity instanceof EntityItem && entity.ticksExisted > 10 && !entity.isDead) {
EntityMovingItem item = new EntityMovingItem(world);
item.setItemStack(((EntityItem) entity).getEntityItem().copy());
Vec3 pos = Vec3.createVectorHelper(entity.posX, entity.posY, entity.posZ);
Vec3 snap = this.getClosestSnappingPosition(world, x, y, z, pos);
item.setPositionAndRotation(snap.xCoord, snap.yCoord, snap.zCoord, 0, 0);
world.spawnEntityInWorld(item);
entity.setDead();
}
}
}
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 void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F);
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 0.25, z + 1);
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
if(i == 0) {
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
}
if(i == 1) {
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
}
if(i == 2) {
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
}
if(i == 3) {
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
}
}
}

View File

@ -0,0 +1,112 @@
package com.hbm.blocks.network;
import api.hbm.block.IToolable;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.IIcon;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public abstract class BlockConveyorBendable extends BlockConveyorBase implements IToolable {
@SideOnly(Side.CLIENT) protected IIcon curveLeft;
@SideOnly(Side.CLIENT) protected IIcon curveRight;
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
super.registerBlockIcons(iconRegister);
this.curveLeft = iconRegister.registerIcon(this.getTextureName() + "_curve_left");
this.curveRight = iconRegister.registerIcon(this.getTextureName() + "_curve_right");
}
protected int getPathDirection(int meta) {
if(meta >= 6 && meta <= 9) return 1;
if(meta >= 10 && meta <= 13) return 2;
return 0;
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
int dir = getPathDirection(metadata);
if(dir > 0 && side > 1)
return this.sideIcon;
if((metadata == 2 || metadata == 3) && (side == 4 || side == 5))
return this.sideIcon;
if((metadata == 4 || metadata == 5) && (side == 2 || side == 3))
return this.sideIcon;
if(dir == 1) return this.curveLeft;
if(dir == 2) return this.curveRight;
return super.getIcon(side, metadata);
}
@Override
public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos) {
int meta = world.getBlockMetadata(x, y, z);
int dir = getPathDirection(meta);
meta -= dir * 4;
ForgeDirection primary = ForgeDirection.getOrientation(meta);
if(dir > 0) {
dir--;
double ix = x + 0.5;
double iz = z + 0.5;
ForgeDirection secondary = primary.getRotation(ForgeDirection.UP);
ix -= -primary.offsetX * 0.5 + secondary.offsetX * (0.5 - dir);
iz -= -primary.offsetZ * 0.5 + secondary.offsetZ * (0.5 - dir);
double dX = Math.abs(itemPos.xCoord - ix);
double dZ = Math.abs(itemPos.zCoord - iz);
if(dX + dZ >= 1) {
if(dir == 0)
return secondary.getOpposite();
else
return secondary;
}
}
return primary;
}
@Override
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
if(tool != ToolType.SCREWDRIVER)
return false;
int meta = world.getBlockMetadata(x, y, z);
int newMeta = meta;
int dir = getPathDirection(meta);
if(!player.isSneaking()) {
if(meta > 9) meta -= 8;
if(meta > 5) meta -= 4;
newMeta = ForgeDirection.getOrientation(meta).getRotation(ForgeDirection.UP).ordinal() + dir * 4;
} else {
if(dir < 2)
newMeta += 4;
else
newMeta -= 8;
}
world.setBlockMetadataWithNotify(x, y, z, newMeta, 3);
return true;
}
}

View File

@ -12,7 +12,7 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockConveyorChute extends BlockConveyor {
public class BlockConveyorChute extends BlockConveyorBase {
@Override
public Vec3 getTravelLocation(World world, int x, int y, int z, Vec3 itemPos, double speed) {
@ -28,7 +28,7 @@ public class BlockConveyorChute extends BlockConveyor {
}
@Override
public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos, double speed) {
public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos) {
Block below = world.getBlock(x, y - 1, z);
if(below instanceof IConveyorBelt || below instanceof IEnterableBlock || itemPos.yCoord > y + 0.25) {

View File

@ -0,0 +1,154 @@
package com.hbm.blocks.network;
import com.hbm.entity.item.EntityMovingItem;
import com.hbm.lib.RefStrings;
import api.hbm.conveyor.IConveyorBelt;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
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.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockConveyorClassic extends Block implements IConveyorBelt {
@SideOnly(Side.CLIENT)
protected IIcon sideIcon;
public BlockConveyorClassic() {
super(Material.iron);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
super.registerBlockIcons(iconRegister);
this.sideIcon = iconRegister.registerIcon(RefStrings.MODID + ":conveyor_side");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
if((metadata == 2 || metadata == 3) && (side == 4 || side == 5))
return this.sideIcon;
if((metadata == 4 || metadata == 5) && (side == 2 || side == 3))
return this.sideIcon;
return super.getIcon(side, metadata);
}
@Override
public Vec3 getTravelLocation(World world, int x, int y, int z, Vec3 itemPos, double speed) {
ForgeDirection dir = getTravelDirection(world, x, y, z, itemPos, speed);
//snapping point
Vec3 snap = this.getClosestSnappingPosition(world, x, y, z, itemPos);
//snapping point + speed
Vec3 dest = Vec3.createVectorHelper(snap.xCoord - dir.offsetX * speed, snap.yCoord - dir.offsetY * speed, snap.zCoord - dir.offsetZ * speed);
//delta to get to that point
Vec3 motion = Vec3.createVectorHelper((dest.xCoord - itemPos.xCoord), (dest.yCoord - itemPos.yCoord), (dest.zCoord - itemPos.zCoord));
double len = motion.lengthVector();
//the effective destination towards "dest" after taking speed into consideration
Vec3 ret = Vec3.createVectorHelper(itemPos.xCoord + motion.xCoord / len * speed, itemPos.yCoord + motion.yCoord / len * speed, itemPos.zCoord + motion.zCoord / len * speed);
return ret;
}
public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos, double speed) {
return ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
}
@Override
public Vec3 getClosestSnappingPosition(World world, int x, int y, int z, Vec3 itemPos) {
ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
itemPos.xCoord = MathHelper.clamp_double(itemPos.xCoord, x, x + 1);
itemPos.zCoord = MathHelper.clamp_double(itemPos.zCoord, z, z + 1);
double posX = x + 0.5;
double posZ = z + 0.5;
if(dir.offsetX != 0) {
posX = itemPos.xCoord;
}
if(dir.offsetZ != 0) {
posZ = itemPos.zCoord;
}
return Vec3.createVectorHelper(posX, y + 0.25, posZ);
}
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
if(!world.isRemote) {
if(entity instanceof EntityItem && entity.ticksExisted > 10 && !entity.isDead) {
EntityMovingItem item = new EntityMovingItem(world);
item.setItemStack(((EntityItem) entity).getEntityItem().copy());
Vec3 pos = Vec3.createVectorHelper(entity.posX, entity.posY, entity.posZ);
Vec3 snap = this.getClosestSnappingPosition(world, x, y, z, pos);
item.setPositionAndRotation(snap.xCoord, snap.yCoord, snap.zCoord, 0, 0);
world.spawnEntityInWorld(item);
entity.setDead();
}
}
}
@Override
public int getRenderType() {
return BlockConveyorBase.renderID;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F);
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 0.25, z + 1);
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
if(i == 0) {
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
}
if(i == 1) {
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
}
if(i == 2) {
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
}
if(i == 3) {
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
}
}
}

View File

@ -5,12 +5,12 @@ import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockConveyorDouble extends BlockConveyor {
public class BlockConveyorDouble extends BlockConveyorBendable {
@Override
public Vec3 getClosestSnappingPosition(World world, int x, int y, int z, Vec3 itemPos) {
ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
ForgeDirection dir = this.getTravelDirection(world, x, y, z, itemPos);
itemPos.xCoord = MathHelper.clamp_double(itemPos.xCoord, x, x + 1);
itemPos.zCoord = MathHelper.clamp_double(itemPos.zCoord, z, z + 1);

View File

@ -10,10 +10,10 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockConveyorLift extends BlockConveyor {
public class BlockConveyorLift extends BlockConveyorBase {
@Override
public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos, double speed) {
public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos) {
boolean bottom = !(world.getBlock(x, y - 1, z) instanceof IConveyorBelt);
boolean top = !(world.getBlock(x, y + 1, z) instanceof IConveyorBelt) && !bottom;

View File

@ -5,12 +5,12 @@ import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockConveyorTriple extends BlockConveyor {
public class BlockConveyorTriple extends BlockConveyorBendable {
@Override
public Vec3 getClosestSnappingPosition(World world, int x, int y, int z, Vec3 itemPos) {
ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
ForgeDirection dir = this.getTravelDirection(world, x, y, z, itemPos);
itemPos.xCoord = MathHelper.clamp_double(itemPos.xCoord, x, x + 1);
itemPos.zCoord = MathHelper.clamp_double(itemPos.zCoord, z, z + 1);

View File

@ -0,0 +1,204 @@
package com.hbm.blocks.network;
import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.IBlockMultiPass;
import com.hbm.entity.item.EntityMovingItem;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import com.hbm.module.ModulePatternMatcher;
import com.hbm.render.block.RenderBlockMultipass;
import com.hbm.tileentity.network.TileEntityCraneRouter;
import api.hbm.conveyor.IConveyorBelt;
import api.hbm.conveyor.IConveyorItem;
import api.hbm.conveyor.IConveyorPackage;
import api.hbm.conveyor.IEnterableBlock;
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.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class CraneRouter extends BlockContainer implements IBlockMultiPass, IEnterableBlock {
@SideOnly(Side.CLIENT) protected IIcon iconOverlay;
public CraneRouter() {
super(Material.iron);
this.setBlockTextureName(RefStrings.MODID + ":crane_in");
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityCraneRouter();
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
super.registerBlockIcons(iconRegister);
this.iconOverlay = iconRegister.registerIcon(RefStrings.MODID + ":crane_router_overlay");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
return RenderBlockMultipass.currentPass == 0 ? this.blockIcon : this.iconOverlay;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if(world.isRemote) {
return true;
} else if(!player.isSneaking()) {
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
return true;
} else {
return false;
}
}
@Override
@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
if(RenderBlockMultipass.currentPass == 0)
return 0xffffff;
switch(RenderBlockMultipass.currentPass - 1) {
case 0: return 0xff0000;
case 1: return 0xff8000;
case 2: return 0xffff00;
case 3: return 0x00ff00;
case 4: return 0x0080ff;
case 5: return 0x8000ff;
default: return 0xffffff;
}
}
@Override
public int getRenderType(){
return IBlockMultiPass.getRenderType();
}
/*
* arg arg arg spongeboy me bob i have fooled the system that only allows one tint per pass by disabling all rendered sides except one and rendering multiple passes arg arg arg
*/
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
if(RenderBlockMultipass.currentPass == 0)
return true;
return side == RenderBlockMultipass.currentPass - 1;
}
@Override
public int getPasses() {
return 7;
}
@Override
public boolean canItemEnter(World world, int x, int y, int z, ForgeDirection dir, IConveyorItem entity) {
return true;
}
@Override
public void onItemEnter(World world, int x, int y, int z, ForgeDirection dir, IConveyorItem entity) {
TileEntityCraneRouter router = (TileEntityCraneRouter) world.getTileEntity(x, y, z);
ItemStack stack = entity.getItemStack();
List<ForgeDirection> validDirs = new ArrayList();
//check filters for all sides
for(int side = 0; side < 6; side++) {
ModulePatternMatcher matcher = router.patterns[side];
int mode = router.modes[side];
//if the side is disabled or wildcard, skip
if(mode == router.MODE_NONE || mode == router.MODE_WILDCARD)
continue;
boolean matchesFilter = false;
for(int slot = 0; slot < 5; slot++) {
ItemStack filter = router.slots[side * 5 + slot];
if(filter == null)
continue;
//the filter kicks in so long as one entry matches
if(matcher.isValidForFilter(filter, slot, stack)) {
matchesFilter = true;
break;
}
}
//add dir if matches with whitelist on or doesn't match with blacklist on
if((mode == router.MODE_WHITELIST && matchesFilter) || (mode == router.MODE_BLACKLIST && !matchesFilter)) {
validDirs.add(ForgeDirection.getOrientation(side));
}
}
//if no valid dirs have yet been found, use wildcard
if(validDirs.isEmpty()) {
for(int side = 0; side < 6; side++) {
if(router.modes[side] == router.MODE_WILDCARD) {
validDirs.add(ForgeDirection.getOrientation(side));
}
}
}
if(validDirs.isEmpty()) {
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, stack.copy()));
return;
}
int i = world.rand.nextInt(validDirs.size());
sendOnRoute(world, x, y, z, entity, validDirs.get(i));
}
protected void sendOnRoute(World world, int x, int y, int z, IConveyorItem item, ForgeDirection dir) {
IConveyorBelt belt = null;
Block block = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
if(block instanceof IConveyorBelt) {
belt = (IConveyorBelt) block;
}
if(belt != null) {
EntityMovingItem moving = new EntityMovingItem(world);
Vec3 pos = Vec3.createVectorHelper(x + 0.5 + dir.offsetX * 0.55, y + 0.5 + dir.offsetY * 0.55, z + 0.5 + dir.offsetZ * 0.55);
Vec3 snap = belt.getClosestSnappingPosition(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, pos);
moving.setPosition(snap.xCoord, snap.yCoord, snap.zCoord);
moving.setItemStack(item.getItemStack());
world.spawnEntityInWorld(moving);
} else {
world.spawnEntityInWorld(new EntityItem(world, x + 0.5 + dir.offsetX * 0.55, y + 0.5 + dir.offsetY * 0.55, z + 0.5 + dir.offsetZ * 0.55, item.getItemStack()));
}
}
@Override
public boolean canPackageEnter(World world, int x, int y, int z, ForgeDirection dir, IConveyorPackage entity) {
return false;
}
@Override
public void onPackageEnter(World world, int x, int y, int z, ForgeDirection dir, IConveyorPackage entity) { }
}

View File

@ -6,9 +6,11 @@ import com.hbm.util.fauxpointtwelve.BlockPos;
import api.hbm.conveyor.IConveyorPackage;
import api.hbm.conveyor.IEnterableBlock;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@ -33,6 +35,36 @@ public class EntityMovingPackage extends EntityMovingConveyorObject implements I
return contents;
}
@Override
public boolean interactFirst(EntityPlayer player) {
if(!worldObj.isRemote) {
for(ItemStack stack : contents) {
if(!player.inventory.addItemStackToInventory(stack.copy())) {
worldObj.spawnEntityInWorld(new EntityItem(worldObj, posX, posY + 0.125, posZ, stack));
}
}
this.setDead();
}
return false;
}
@Override
public boolean attackEntityFrom(DamageSource source, float amount) {
if(!worldObj.isRemote) {
this.setDead();
for(ItemStack stack : contents) {
worldObj.spawnEntityInWorld(new EntityItem(worldObj, posX, posY + 0.125, posZ, stack));
}
}
return true;
}
@Override
public void enterBlock(IEnterableBlock enterable, BlockPos pos, ForgeDirection dir) {

View File

@ -49,6 +49,7 @@ public class EntityCog extends EntityThrowableNT {
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(10, new Integer(0));
this.dataWatcher.addObject(11, new Integer(0));
}
public EntityCog setOrientation(int rot) {
@ -56,16 +57,25 @@ public class EntityCog extends EntityThrowableNT {
return this;
}
public EntityCog setMeta(int meta) {
this.dataWatcher.updateObject(11, meta);
return this;
}
public int getOrientation() {
return this.dataWatcher.getWatchableObjectInt(10);
}
public int getMeta() {
return this.dataWatcher.getWatchableObjectInt(11);
}
@Override
public boolean interactFirst(EntityPlayer player) {
if(!worldObj.isRemote) {
if(player.inventory.addItemStackToInventory(new ItemStack(ModItems.gear_large)))
if(player.inventory.addItemStackToInventory(new ItemStack(ModItems.gear_large, 1, this.getMeta())))
this.setDead();
player.inventoryContainer.detectAndSendChanges();
@ -187,4 +197,18 @@ public class EntityCog extends EntityThrowableNT {
protected int groundDespawn() {
return 0;
}
@Override
public void writeEntityToNBT(NBTTagCompound nbt) {
super.writeEntityToNBT(nbt);
nbt.setInteger("rot", this.getOrientation());
nbt.setInteger("meta", this.getMeta());
}
@Override
public void readEntityFromNBT(NBTTagCompound nbt) {
super.readEntityFromNBT(nbt);
this.setOrientation(nbt.getInteger("rot"));
this.setMeta(nbt.getInteger("meta"));
}
}

View File

@ -202,7 +202,7 @@ public abstract class ToolAbility {
@Override
public void onDig(World world, int x, int y, int z, EntityPlayer player, Block block, int meta, IItemAbility tool) {
//if the tool is already enchanted, do nothing
/*//if the tool is already enchanted, do nothing
if(EnchantmentHelper.getSilkTouchModifier(player) || player.getHeldItem() == null)
return;
@ -214,7 +214,9 @@ public abstract class ToolAbility {
EnchantmentUtil.removeEnchantment(stack, Enchantment.silkTouch);
world.setBlockToAir(x, y, z);
player.getHeldItem().damageItem(1, player);
player.getHeldItem().damageItem(1, player);*/
tool.breakBlockSpecial(world, x, y, z, block, meta, player, 0, true);
}
@Override
@ -249,7 +251,7 @@ public abstract class ToolAbility {
@Override
public void onDig(World world, int x, int y, int z, EntityPlayer player, Block block, int meta, IItemAbility tool) {
//if the tool is already enchanted, do nothing
/*//if the tool is already enchanted, do nothing
if(EnchantmentHelper.getFortuneModifier(player) > 0 || player.getHeldItem() == null)
return;
@ -261,7 +263,11 @@ public abstract class ToolAbility {
EnchantmentUtil.removeEnchantment(stack, Enchantment.fortune);
world.setBlockToAir(x, y, z);
player.getHeldItem().damageItem(1, player);
player.getHeldItem().damageItem(1, player);*/
tool.breakBlockSpecial(world, x, y, z, block, meta, player, luck, false);
}
@Override

View File

@ -180,6 +180,10 @@ public class HazardRegistry {
HazardSystem.register(egg_balefire_shard, makeData(RADIATION, bf * nugget));
HazardSystem.register(egg_balefire, makeData(RADIATION, bf * ingot));
HazardSystem.register(solid_fuel_bf, makeData(RADIATION, 1000)); //roughly the amount of the balefire shard diluted in 250mB of rocket fuel
HazardSystem.register(solid_fuel_presto_bf, makeData(RADIATION, 2000));
HazardSystem.register(solid_fuel_presto_triplet_bf, makeData(RADIATION, 6000));
HazardSystem.register(nuclear_waste_long, makeData(RADIATION, 5F));
HazardSystem.register(nuclear_waste_long_tiny, makeData(RADIATION, 0.5F));
HazardSystem.register(nuclear_waste_short, makeData().addEntry(RADIATION, 30F).addEntry(HOT, 5F));

View File

@ -0,0 +1,86 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotPattern;
import com.hbm.tileentity.network.TileEntityCraneRouter;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerCraneRouter extends Container {
private TileEntityCraneRouter router;
public ContainerCraneRouter(InventoryPlayer invPlayer, TileEntityCraneRouter router) {
this.router = router;
for(int j = 0; j < 2; j++) {
for(int i = 0; i < 3; i++) {
for(int k = 0; k < 5; k++) {
this.addSlotToContainer(new SlotPattern(router, k + j * 15 + i * 5, 34 + k * 18 + j * 98, 17 + i * 26));
}
}
}
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 47 + j * 18, 119 + i * 18));
}
}
for(int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(invPlayer, i, 47 + i * 18, 177));
}
}
@Override
public ItemStack slotClick(int index, int button, int mode, EntityPlayer player) {
//L/R: 0
//M3: 3
//SHIFT: 1
//DRAG: 5
if(index < 0 || index >= 30) {
return super.slotClick(index, button, mode, player);
}
Slot slot = this.getSlot(index);
ItemStack ret = null;
ItemStack held = player.inventory.getItemStack();
if(slot.getHasStack())
ret = slot.getStack().copy();
if(button == 1 && mode == 0 && slot.getHasStack()) {
router.nextMode(index);
return ret;
} else {
slot.putStack(held != null ? held.copy() : null);
if(slot.getHasStack()) {
slot.getStack().stackSize = 1;
}
slot.onSlotChanged();
router.initPattern(slot.getStack(), index);
return ret;
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
return null;
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return router.isUseableByPlayer(player);
}
}

View File

@ -53,16 +53,22 @@ public class ContainerMachineOilWell extends Container {
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if(par2 <= 5) {
if(!this.mergeItemStack(var5, 6, this.inventorySlots.size(), true)) {
if(par2 <= 7) {
if(!this.mergeItemStack(var5, 8, this.inventorySlots.size(), true)) {
return null;
}
} else if(!this.mergeItemStack(var5, 0, 2, false)) {
} else {
if(var5.getItem() instanceof ItemMachineUpgrade) {
if(!this.mergeItemStack(var5, 5, 8, true)) {
return null;
}
} else {
if(!this.mergeItemStack(var5, 0, 2, false)) {
if(!this.mergeItemStack(var5, 3, 4, false)) {
return null;
}
}
}
}

View File

@ -27,11 +27,6 @@ public class GUICraneBoxer extends GuiInfoContainer {
this.xSize = 176;
this.ySize = 185;
}
@Override
public void drawScreen(int x, int y, float interp) {
super.drawScreen(x, y, interp);
}
@Override
protected void mouseClicked(int x, int y, int i) {

View File

@ -0,0 +1,132 @@
package com.hbm.inventory.gui;
import java.util.Arrays;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerCraneRouter;
import com.hbm.lib.RefStrings;
import com.hbm.module.ModulePatternMatcher;
import com.hbm.packet.NBTControlPacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.tileentity.network.TileEntityCraneRouter;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
public class GUICraneRouter extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/storage/gui_crane_router.png");
private TileEntityCraneRouter router;
public GUICraneRouter(InventoryPlayer invPlayer, TileEntityCraneRouter tedf) {
super(new ContainerCraneRouter(invPlayer, tedf));
router = tedf;
this.xSize = 256;
this.ySize = 201;
}
@Override
protected void mouseClicked(int x, int y, int i) {
super.mouseClicked(x, y, i);
for(int j = 0; j < 2; j++) {
for(int k = 0; k < 3; k++) {
if(guiLeft + 7 + j * 222 <= x && guiLeft + 7 + j * 222 + 18 > x && guiTop + 16 + k * 26 < y && guiTop + 16 + k * 26 + 18 >= y) {
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
NBTTagCompound data = new NBTTagCompound();
data.setInteger("toggle", j * 3 + k);
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, router.xCoord, router.yCoord, router.zCoord));
}
}
}
}
@Override
public void drawScreen(int x, int y, float interp) {
super.drawScreen(x, y, interp);
for(int j = 0; j < 2; j++) {
for(int k = 0; k < 3; k++) {
if(guiLeft + 7 + j * 222 <= x && guiLeft + 7 + j * 222 + 18 > x && guiTop + 16 + k * 26 < y && guiTop + 16 + k * 26 + 18 >= y) {
String[] text = new String[2];
int index = j * 3 + k;
switch(router.modes[index]) {
case 0: text = new String[] { "OFF" }; break;
case 1: text[0] = "WHITELIST"; text[1] = "Route if filter matches"; break;
case 2: text[0] = "BLACKLIST"; text[1] = "Route if filter doesn't match"; break;
case 3: text[0] = "WILDCARD"; text[1] = "Route if no other route is valid"; break;
}
this.func_146283_a(Arrays.asList(text), x, y);
}
}
}
if(this.mc.thePlayer.inventory.getItemStack() == null) {
for(int i = 0; i < 30; ++i) {
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(i);
ModulePatternMatcher matcher = router.patterns[i / 5];
int index = i % 5;
if(this.isMouseOverSlot(slot, x, y) && matcher.modes[index] != null) {
String label = EnumChatFormatting.YELLOW + "";
switch(matcher.modes[index]) {
case "exact": label += "Item and meta match"; break;
case "wildcard": label += "Item matches"; break;
default: label += "Ore dict key matches: " + matcher.modes[index]; break;
}
this.func_146283_a(Arrays.asList(new String[] { EnumChatFormatting.RED + "Right click to change", label}), x, y - 30);
}
}
}
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.router.hasCustomInventoryName() ? this.router.getInventoryName() : I18n.format(this.router.getInventoryName());
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 5, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8 + 39, this.ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 256, 93);
drawTexturedModalRect(guiLeft + 39, guiTop + 93, 39, 93, 176, 108);
for(int j = 0; j < 2; j++) {
for(int k = 0; k < 3; k++) {
int index = j * 3 + k;
int mode = router.modes[index];
drawTexturedModalRect(guiLeft + 7 + j * 222, guiTop + 16 + k * 26, 238, 93 + mode * 18, 18, 18);
}
}
if(Keyboard.isKeyDown(Keyboard.KEY_LMENU))
for(int i = 0; i < this.inventorySlots.inventorySlots.size(); i++) {
Slot s = this.inventorySlots.getSlot(i);
this.fontRendererObj.drawStringWithShadow(i + "", guiLeft + s.xDisplayPosition + 2, guiTop + s.yDisplayPosition, 0xffffff);
this.fontRendererObj.drawStringWithShadow(s.getSlotIndex() + "", guiLeft + s.xDisplayPosition + 2, guiTop + s.yDisplayPosition + 8, 0xff8080);
}
}
}

View File

@ -202,9 +202,18 @@ public class AnvilRecipes {
new OreDictStack(STEEL.plate(), 6),
new OreDictStack(CU.ingot(), 8),
new ComparableStack(ModItems.coil_copper, 4),
new ComparableStack(ModItems.gear_large, 1)
new ComparableStack(ModItems.gear_large, 1, 0)
}, new AnvilOutput(new ItemStack(ModBlocks.machine_stirling))).setTier(2));
constructionRecipes.add(new AnvilConstructionRecipe(
new AStack[] {
new OreDictStack(STEEL.plate(), 16),
new OreDictStack(BE.ingot(), 6),
new OreDictStack(CU.ingot(), 8),
new ComparableStack(ModItems.coil_gold, 16),
new ComparableStack(ModItems.gear_large, 1, 1)
}, new AnvilOutput(new ItemStack(ModBlocks.machine_stirling_steel))).setTier(2));
constructionRecipes.add(new AnvilConstructionRecipe(
new AStack[] {
new OreDictStack(STEEL.ingot(), 6),

View File

@ -1917,6 +1917,7 @@ public class ModItems {
public static Item screwdriver_desh;
public static Item hand_drill;
public static Item hand_drill_desh;
public static Item wrench_archineer;
public static Item chemistry_set;
public static Item chemistry_set_boron;
public static Item overfuse;
@ -3064,7 +3065,7 @@ public class ModItems {
deuterium_filter = new Item().setUnlocalizedName("deuterium_filter").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":deuterium_filter");
parts_legendary = new ItemEnumMulti(EnumLegendaryType.class, false, true).setUnlocalizedName("parts_legendary").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":parts_legendary");
gear_large = new Item().setUnlocalizedName("gear_large").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":gear_large");
gear_large = new ItemGear().setUnlocalizedName("gear_large").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":gear_large");
cap_aluminium = new Item().setUnlocalizedName("cap_aluminium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":cap_aluminium");
hull_small_steel = new Item().setUnlocalizedName("hull_small_steel").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":hull_small_steel");
@ -4665,6 +4666,7 @@ public class ModItems {
screwdriver_desh = new ItemTooling(ToolType.SCREWDRIVER, 0).setUnlocalizedName("screwdriver_desh");
hand_drill = new ItemTooling(ToolType.HAND_DRILL, 100).setUnlocalizedName("hand_drill");
hand_drill_desh = new ItemTooling(ToolType.HAND_DRILL, 0).setUnlocalizedName("hand_drill_desh");
wrench_archineer = new ItemToolingWeapon(ToolType.WRENCH, 1000, 12F).setUnlocalizedName("wrench_archineer").setTextureName(RefStrings.MODID + ":wrench_archineer_hd");
chemistry_set = new ItemCraftingDegradation(100).setUnlocalizedName("chemistry_set");
chemistry_set_boron = new ItemCraftingDegradation(0).setUnlocalizedName("chemistry_set_boron");
overfuse = new ItemCustomLore().setUnlocalizedName("overfuse").setMaxStackSize(1).setFull3D().setTextureName(RefStrings.MODID + ":overfuse");
@ -7625,6 +7627,7 @@ public class ModItems {
GameRegistry.registerItem(balefire_and_steel, balefire_and_steel.getUnlocalizedName());
GameRegistry.registerItem(crowbar, crowbar.getUnlocalizedName());
GameRegistry.registerItem(wrench, wrench.getUnlocalizedName());
GameRegistry.registerItem(wrench_archineer, wrench_archineer.getUnlocalizedName());
GameRegistry.registerItem(wrench_flipped, wrench_flipped.getUnlocalizedName());
GameRegistry.registerItem(memespoon, memespoon.getUnlocalizedName());
GameRegistry.registerItem(saw, saw.getUnlocalizedName());

View File

@ -0,0 +1,31 @@
package com.hbm.items.machine;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class ItemGear extends Item {
public ItemGear() {
this.setHasSubtypes(true);
this.setMaxDamage(0);
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tabs, List list) {
for(int i = 0; i < 2; i++) {
list.add(new ItemStack(item, 1, i));
}
}
@Override
public String getUnlocalizedName(ItemStack stack) {
return this.getUnlocalizedName() + (stack.getItemDamage() == 1 ? "_steel" : "");
}
}

View File

@ -1,15 +1,22 @@
package com.hbm.items.tool;
import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.client.C07PacketPlayerDigging;
import net.minecraft.network.play.server.S23PacketBlockChange;
import net.minecraft.stats.StatList;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.event.world.BlockEvent;
public interface IItemAbility {
@ -86,4 +93,113 @@ public interface IItemAbility {
Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C07PacketPlayerDigging(2, x, y, z, Minecraft.getMinecraft().objectMouseOver.sideHit));
}
}
public default void breakBlockSpecial(World world, int x, int y, int z, Block block, int meta, EntityPlayer playerEntity, int fortune, boolean silkTouch) {
if(world.isAirBlock(x, y, z))
return;
if(!(playerEntity instanceof EntityPlayerMP))
return;
EntityPlayerMP player = (EntityPlayerMP) playerEntity;
if(!ForgeHooks.canHarvestBlock(block, player, meta))
return;
BlockEvent.BreakEvent event = ForgeHooks.onBlockBreakEvent(world, player.theItemInWorldManager.getGameType(), player, x, y, z);
if(event.isCanceled())
return;
if(player.capabilities.isCreativeMode) {
block.onBlockHarvested(world, x, y, z, meta, player);
if(block.removedByPlayer(world, player, x, y, z, false))
block.onBlockDestroyedByPlayer(world, x, y, z, meta);
if(!world.isRemote) {
player.playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world));
}
return;
}
player.getCurrentEquippedItem().func_150999_a(world, block, x, y, z, player);
if(!world.isRemote) {
block.onBlockHarvested(world, x, y, z, meta, player);
if(block.removedByPlayer(world, player, x, y, z, true)) {
block.onBlockDestroyedByPlayer(world, x, y, z, meta);
harvestBlock(world, player, x, y, z, block, meta, fortune, silkTouch);
if(!silkTouch) block.dropXpOnBlockBreak(world, x, y, z, event.getExpToDrop());
}
player.playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world));
} else {
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));
if(block.removedByPlayer(world, player, x, y, z, true)) {
block.onBlockDestroyedByPlayer(world, x, y, z, meta);
}
ItemStack itemstack = player.getCurrentEquippedItem();
if(itemstack != null) {
itemstack.func_150999_a(world, block, x, y, z, player);
if(itemstack.stackSize == 0) {
player.destroyCurrentEquippedItem();
}
}
Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C07PacketPlayerDigging(2, x, y, z, Minecraft.getMinecraft().objectMouseOver.sideHit));
}
}
public default void harvestBlock(World world, EntityPlayer player, int x, int y, int z, Block block, int meta, int fortune, boolean silkTouch) {
player.addStat(StatList.mineBlockStatArray[block.getIdFromBlock(block)], 1);
player.addExhaustion(0.025F);
if(block.canSilkHarvest(world, player, x, y, z, meta) && silkTouch) {
ArrayList<ItemStack> items = new ArrayList<ItemStack>();
//block.createStackedBlock(meta);
/// createStackedBlock ///
int j = 0;
Item item = Item.getItemFromBlock(block);
if(item != null && item.getHasSubtypes()) {
j = meta;
}
ItemStack itemstack = new ItemStack(item, 1, j);
/// createStackedBlock ///
if(itemstack != null) {
items.add(itemstack);
}
ForgeEventFactory.fireBlockHarvesting(items, world, block, x, y, z, meta, 0, 1.0f, true, player);
for(ItemStack is : items) {
dropBlockAsItem(world, x, y, z, is);
}
} else {
//block.harvesters.set(player);
block.dropBlockAsItem(world, x, y, z, meta, fortune);
//block.harvesters.set(null);
}
}
public default void dropBlockAsItem(World world, int x, int y, int z, ItemStack stack) {
if(!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops") && !world.restoringBlockSnapshots) {
/*if(captureDrops.get()) {
capturedDrops.get().add(stack);
return;
}*/
float f = 0.7F;
double d0 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
double d1 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
double d2 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
EntityItem entityitem = new EntityItem(world, (double) x + d0, (double) y + d1, (double) z + d2, stack);
entityitem.delayBeforeCanPickup = 10;
world.spawnEntityInWorld(entityitem);
}
}
}

View File

@ -6,13 +6,12 @@ import api.hbm.block.IToolable;
import api.hbm.block.IToolable.ToolType;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class ItemTooling extends ItemCraftingDegradation {
ToolType type;
protected ToolType type;
public ItemTooling(ToolType type, int durability) {
super(durability);

View File

@ -0,0 +1,57 @@
package com.hbm.items.tool;
import com.google.common.collect.Multimap;
import com.hbm.items.ModItems;
import api.hbm.block.IToolable.ToolType;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public class ItemToolingWeapon extends ItemTooling {
protected float damage = 0;
public ItemToolingWeapon(ToolType type, int durability, float damage) {
super(type, durability);
this.damage = damage;
}
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase entity, EntityLivingBase player) {
World world = player.worldObj;
if(this == ModItems.wrench) {
Vec3 vec = player.getLookVec();
double dX = vec.xCoord * 0.5;
double dY = vec.yCoord * 0.5;
double dZ = vec.zCoord * 0.5;
entity.motionX += dX;
entity.motionY += dY;
entity.motionZ += dZ;
world.playSoundAtEntity(entity, "random.anvil_land", 3.0F, 0.75F);
}
return false;
}
@Override
public Multimap getAttributeModifiers(ItemStack stack) {
Multimap multimap = super.getAttributeModifiers(stack);
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", damage, 0));
if(this == ModItems.wrench) {
multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Wrench modifier", -0.1, 1));
}
return multimap;
}
}

View File

@ -3,7 +3,7 @@ package com.hbm.lib;
public class RefStrings {
public static final String MODID = "hbm";
public static final String NAME = "Hbm's Nuclear Tech Mod";
public static final String VERSION = "1.0.27 BETA (4312)";
public static final String VERSION = "1.0.27 BETA (4327)";
//HBM's Beta Naming Convention:
//V T (X)
//V -> next release version

View File

@ -340,7 +340,9 @@ public class ClientProxy extends ServerProxy {
Object renderer = iterator.next();
if(renderer instanceof IItemRendererProvider) {
IItemRendererProvider prov = (IItemRendererProvider) renderer;
MinecraftForgeClient.registerItemRenderer(prov.getItemForRenderer(), prov.getRenderer());
for(Item item : prov.getItemsForRenderer()) {
MinecraftForgeClient.registerItemRenderer(item, prov.getRenderer());
}
}
}

View File

@ -940,6 +940,7 @@ public class CraftingManager {
addRecipeAuto(new ItemStack(ModBlocks.crane_boxer), new Object[] { "WWW", "WPW", "CCC", 'W', KEY_PLANKS, 'P', DictFrame.fromOne(ModItems.part_generic, EnumPartType.PISTON_PNEUMATIC), 'C', ModBlocks.conveyor });
addRecipeAuto(new ItemStack(ModBlocks.crane_unboxer), new Object[] { "WWW", "WPW", "CCC", 'W', KEY_STICK, 'P', Items.shears, 'C', ModBlocks.conveyor });
addRecipeAuto(new ItemStack(ModBlocks.crane_router), new Object[] { "PIP", "ICI", "PIP", 'P', DictFrame.fromOne(ModItems.part_generic, EnumPartType.PISTON_PNEUMATIC), 'I', ModItems.plate_polymer, 'C', ModItems.circuit_copper });
addShapelessAuto(DictFrame.fromOne(ModItems.parts_legendary, EnumLegendaryType.TIER1), new Object[] { ModItems.ingot_chainsteel, ASBESTOS.ingot(), ModItems.gem_alexandrite });
addShapelessAuto(DictFrame.fromOne(ModItems.parts_legendary, EnumLegendaryType.TIER1, 3), new Object[] { DictFrame.fromOne(ModItems.parts_legendary, EnumLegendaryType.TIER2) });
@ -947,7 +948,8 @@ public class CraftingManager {
addShapelessAuto(DictFrame.fromOne(ModItems.parts_legendary, EnumLegendaryType.TIER2, 3), new Object[] { DictFrame.fromOne(ModItems.parts_legendary, EnumLegendaryType.TIER3) });
addShapelessAuto(DictFrame.fromOne(ModItems.parts_legendary, EnumLegendaryType.TIER3), new Object[] { ModItems.ingot_chainsteel, ModItems.ingot_smore, ModItems.gem_alexandrite, ModItems.gem_alexandrite, ModItems.gem_alexandrite });
addRecipeAuto(new ItemStack(ModItems.gear_large, 1), new Object[] { "III", "ICI", "III", 'I', IRON.plate(), 'C', CU.ingot()});
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()});
addShapelessAuto(new ItemStack(ModItems.upgrade_5g), new Object[] { ModItems.upgrade_template, ModItems.gem_alexandrite });

View File

@ -382,6 +382,7 @@ public class ResourceManager {
//Heat Engines
public static final ResourceLocation stirling_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/stirling.png");
public static final ResourceLocation stirling_steel_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/stirling_steel.png");
//Furnaces
public static final ResourceLocation furnace_iron_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/furnace_iron.png");

View File

@ -133,6 +133,8 @@ public class ModulePatternMatcher {
for(int i = 0; i < modes.length; i++) {
if(nbt.hasKey("mode" + i)) {
modes[i] = nbt.getString("mode" + i);
} else {
modes[i] = null;
}
}
}

View File

@ -23,27 +23,10 @@ public class RenderConveyor implements ISimpleBlockRenderingHandler {
renderer.setRenderBounds( 0D, 0D, 0D, 1D, 0.25D, 1D);
meta = 2;
if(meta == 2) {
renderer.uvRotateTop = 3;
renderer.uvRotateBottom = 0;
renderer.uvRotateWest = 3;
}
if(meta == 3) {
renderer.uvRotateTop = 0;
renderer.uvRotateBottom = 3;
renderer.uvRotateEast = 3;
}
if(meta == 4) {
renderer.uvRotateTop = 1;
renderer.uvRotateBottom = 1;
renderer.uvRotateSouth = 3;
}
if(meta == 5) {
renderer.uvRotateTop = 2;
renderer.uvRotateBottom = 2;
renderer.uvRotateNorth = 3;
}
renderer.uvRotateTop = 3;
renderer.uvRotateBottom = 0;
renderer.uvRotateWest = 3;
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1.0F, 0.0F);
@ -88,26 +71,31 @@ public class RenderConveyor implements ISimpleBlockRenderingHandler {
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
tessellator.setColorOpaque_F(1, 1, 1);
boolean bent = meta > 5;
if(meta > 9) meta -= 8;
if(meta > 5) meta -= 4;
if(meta == 2) {
renderer.uvRotateTop = 3;
renderer.uvRotateBottom = 0;
renderer.uvRotateWest = 3;
if(!bent) renderer.uvRotateWest = 3;
}
if(meta == 3) {
renderer.uvRotateTop = 0;
renderer.uvRotateBottom = 3;
renderer.uvRotateEast = 3;
if(!bent) renderer.uvRotateEast = 3;
}
if(meta == 4) {
renderer.uvRotateTop = 1;
renderer.uvRotateBottom = 1;
renderer.uvRotateSouth = 3;
if(!bent) renderer.uvRotateSouth = 3;
}
if(meta == 5) {
renderer.uvRotateTop = 2;
renderer.uvRotateBottom = 2;
renderer.uvRotateNorth = 3;
if(!bent) renderer.uvRotateNorth = 3;
}
renderer.setRenderBounds((double) 0, 0.0D, (double) 0, (double) 1, 0.25D, (double) 1);

View File

@ -15,7 +15,7 @@ public class RenderCog extends Render {
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
int orientation = cog.getDataWatcher().getWatchableObjectInt(10);
switch(orientation % 6) {
case 3: GL11.glRotatef(0, 0F, 1F, 0F); break;
@ -42,6 +42,11 @@ public class RenderCog extends Render {
@Override
protected ResourceLocation getEntityTexture(Entity entity) {
return ResourceManager.stirling_tex;
int meta = entity.getDataWatcher().getWatchableObjectInt(11);
if(meta == 0)
return ResourceManager.stirling_tex;
else
return ResourceManager.stirling_steel_tex;
}
}

View File

@ -1352,7 +1352,11 @@ public class ItemRenderLibrary {
}
public void renderCommonWithStack(ItemStack item) {
GL11.glTranslated(0, 0, -0.875);
bindTexture(ResourceManager.stirling_tex);
if(item.getItemDamage() == 0)
bindTexture(ResourceManager.stirling_tex);
else
bindTexture(ResourceManager.stirling_steel_tex);
ResourceManager.stirling.renderPart("Cog");
}});

View File

@ -6,5 +6,10 @@ import net.minecraftforge.client.IItemRenderer;
public interface IItemRendererProvider {
public Item getItemForRenderer();
public default Item[] getItemsForRenderer() {
return new Item[] { this.getItemForRenderer() };
}
public IItemRenderer getRenderer();
}

View File

@ -33,14 +33,18 @@ public class RenderStirling extends TileEntitySpecialRenderer implements IItemRe
TileEntityStirling stirling = (TileEntityStirling) tile;
float rot = stirling.lastSpin + (stirling.spin - stirling.lastSpin) * interp;
renderCommon(rot, stirling.hasCog);
renderCommon(rot, stirling.hasCog, stirling.getGeatMeta());
GL11.glPopMatrix();
}
private void renderCommon(float rot, boolean hasCog) {
private void renderCommon(float rot, boolean hasCog, int type) {
bindTexture(ResourceManager.stirling_tex);
if(type == 0)
bindTexture(ResourceManager.stirling_tex);
else
bindTexture(ResourceManager.stirling_steel_tex);
ResourceManager.stirling.renderPart("Base");
if(hasCog) {
@ -68,6 +72,14 @@ public class RenderStirling extends TileEntitySpecialRenderer implements IItemRe
return Item.getItemFromBlock(ModBlocks.machine_stirling);
}
@Override
public Item[] getItemsForRenderer() {
return new Item[] {
Item.getItemFromBlock(ModBlocks.machine_stirling),
Item.getItemFromBlock(ModBlocks.machine_stirling_steel)
};
}
@Override
public IItemRenderer getRenderer() {
return new ItemRenderBase( ) {
@ -78,7 +90,7 @@ public class RenderStirling extends TileEntitySpecialRenderer implements IItemRe
public void renderCommonWithStack(ItemStack item) {
GL11.glRotatef(90, 0F, 1F, 0F);
boolean cog = item.getItemDamage() != 1;
RenderStirling.this.renderCommon(cog ? System.currentTimeMillis() % 3600 * 0.1F : 0, cog);
RenderStirling.this.renderCommon(cog ? System.currentTimeMillis() % 3600 * 0.1F : 0, cog, item.getItem() == Item.getItemFromBlock(ModBlocks.machine_stirling) ? 0 : 1);
}};
}
}

View File

@ -325,6 +325,7 @@ public class TileMappings {
put(TileEntityCraneExtractor.class, "tileentity_extractor");
put(TileEntityCraneBoxer.class, "tileentity_boxer");
put(TileEntityCraneUnboxer.class, "tileentity_unboxer");
put(TileEntityCraneRouter.class, "tileentity_router");
}
private static void put(Class<? extends TileEntity> clazz, String... names) {

View File

@ -1,6 +1,7 @@
package com.hbm.tileentity.machine;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ModBlocks;
import com.hbm.entity.projectile.EntityCog;
import com.hbm.lib.Library;
import com.hbm.tileentity.INBTPacketReceiver;
@ -42,7 +43,7 @@ public class TileEntityStirling extends TileEntityLoadedBase implements INBTPack
if(warnCooldown > 0)
warnCooldown--;
if(heat > 300) {
if(heat > maxHeat()) {
this.overspeed++;
@ -57,7 +58,7 @@ public class TileEntityStirling extends TileEntityLoadedBase implements INBTPack
int orientation = this.getBlockMetadata() - BlockDummyable.offset;
ForgeDirection dir = ForgeDirection.getOrientation(orientation);
EntityCog cog = new EntityCog(worldObj, xCoord + 0.5 + dir.offsetX, yCoord + 1, zCoord + 0.5 + dir.offsetZ).setOrientation(orientation);
EntityCog cog = new EntityCog(worldObj, xCoord + 0.5 + dir.offsetX, yCoord + 1, zCoord + 0.5 + dir.offsetZ).setOrientation(orientation).setMeta(this.getGeatMeta());
ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN);
cog.motionX = rot.offsetX;
@ -96,7 +97,7 @@ public class TileEntityStirling extends TileEntityLoadedBase implements INBTPack
this.heat = 0;
} else {
float momentum = powerBuffer * 50F / 300F;
float momentum = powerBuffer * 50F / ((float) maxHeat());
this.lastSpin = this.spin;
this.spin += momentum;
@ -108,6 +109,14 @@ public class TileEntityStirling extends TileEntityLoadedBase implements INBTPack
}
}
public int getGeatMeta() {
return this.getBlockType() == ModBlocks.machine_stirling ? 0 : 1;
}
public int maxHeat() {
return this.getBlockType() == ModBlocks.machine_stirling ? 300 : 1500;
}
protected DirPos[] getConPos() {
return new DirPos[] {
new DirPos(xCoord + 2, yCoord, zCoord, Library.POS_X),

View File

@ -0,0 +1,129 @@
package com.hbm.tileentity.network;
import com.hbm.interfaces.IControlReceiver;
import com.hbm.inventory.container.ContainerCraneRouter;
import com.hbm.inventory.gui.GUICraneRouter;
import com.hbm.module.ModulePatternMatcher;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public class TileEntityCraneRouter extends TileEntityMachineBase implements IGUIProvider, IControlReceiver {
public ModulePatternMatcher[] patterns = new ModulePatternMatcher[6]; //why did i make six matchers???
public int[] modes = new int[6];
public static final int MODE_NONE = 0;
public static final int MODE_WHITELIST = 1;
public static final int MODE_BLACKLIST = 2;
public static final int MODE_WILDCARD = 3;
public TileEntityCraneRouter() {
super(5 * 6);
for(int i = 0; i < patterns.length; i++) {
patterns[i] = new ModulePatternMatcher(5);
}
}
@Override
public String getName() {
return "container.craneRouter";
}
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
NBTTagCompound data = new NBTTagCompound();
for(int i = 0; i < patterns.length; i++) {
NBTTagCompound compound = new NBTTagCompound();
patterns[i].writeToNBT(compound);
data.setTag("pattern" + i, compound);
}
data.setIntArray("modes", this.modes);
this.networkPack(data, 15);
}
}
@Override
public void networkUnpack(NBTTagCompound data) {
for(int i = 0; i < patterns.length; i++) {
NBTTagCompound compound = data.getCompoundTag("pattern" + i);
patterns[i].readFromNBT(compound);
}
this.modes = data.getIntArray("modes");
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerCraneRouter(player.inventory, this);
}
@Override
@SideOnly(Side.CLIENT)
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new GUICraneRouter(player.inventory, this);
}
public void nextMode(int index) {
int matcher = index / 5;
int mIndex = index % 5;
this.patterns[matcher].nextMode(worldObj, slots[index], mIndex);
}
public void initPattern(ItemStack stack, int index) {
int matcher = index / 5;
int mIndex = index % 5;
this.patterns[matcher].initPatternSmart(worldObj, stack, mIndex);
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
for(int i = 0; i < patterns.length; i++) {
NBTTagCompound compound = nbt.getCompoundTag("pattern" + i);
patterns[i].readFromNBT(compound);
}
this.modes = nbt.getIntArray("modes");
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
for(int i = 0; i < patterns.length; i++) {
NBTTagCompound compound = new NBTTagCompound();
patterns[i].writeToNBT(compound);
nbt.setTag("pattern" + i, compound);
}
nbt.setIntArray("modes", this.modes);
}
@Override
public boolean hasPermission(EntityPlayer player) {
return Vec3.createVectorHelper(xCoord - player.posX, yCoord - player.posY, zCoord - player.posZ).lengthVector() < 20;
}
@Override
public void receiveControl(NBTTagCompound data) {
int i = data.getInteger("toggle");
modes[i]++;
if(modes[i] > 3)
modes [i] = 0;
}
}

View File

@ -233,8 +233,11 @@ container.bombMulti=Mehrzweckbombe
container.centrifuge=Zentrifuge
container.chemplant=Chemiewerk
container.compactLauncher=Kompakt-Startrampe
container.craneBoxer=Förderband-Verpacker
container.craneExtractor=Förderband-Auswerfer
container.craneInserter=Förderband-Einsetzer
container.craneRouter=Förderband-Sortierer
container.craneUnboxer=Förderband-Entpacker
container.crateDesh=Deshkiste
container.crateIron=Eisenkiste
container.crateSteel=Stahlkiste
@ -1454,6 +1457,7 @@ item.gas_mask_mono.name=Halbmaske
item.gas_mask_olde.name=Ledergasmaske
item.gas_petroleum.name=Petroleumgastank
item.gear_large.name=Großes Zahnrad
item.gear_large_steel.name=Großes Stahlzahnrad
item.geiger_counter.name=Mobiler Geigerzähler
item.gem_alexandrite.name=Alexandrit
item.gem_tantalium.name=Tantal-Polykristall
@ -3168,8 +3172,11 @@ tile.conveyor_double.name=Zweispuriges Förderband
tile.conveyor_lift.name=Kettenaufzug
tile.conveyor_triple.name=Dreispuriges Förderband
tile.corium_block.name=Corium
tile.crane_boxer.name=Förderband-Verpacker
tile.crane_extractor.name=Förderband-Auswerfer
tile.crane_inserter.name=Förderband-Einsetzer
tile.crane_router.name=Förderband-Sortierer
tile.crane_unboxer.name=Förderband-Entpacker
tile.crashed_bomb.name=Blindgänger
tile.crate.name=Vorratskiste
tile.crate_ammo.name=Sternenmetallkiste
@ -3462,6 +3469,8 @@ tile.machine_spp_bottom.name=NPE-Potentialgenerator (Unterteil)
tile.machine_spp_top.name=NPE-Potentialgenerator (Oberteil)
tile.machine_stirling.name=Stirlingmotor
tile.machine_stirling.desc=Erzeugt Energie aus Wärme. Benötigt externe Hitzequelle.$Wärmestransferrate: T*0.1 TU/t$Maximalaufnahme: 300 TU/t$Effizienz: 50%%
tile.machine_stirling_steel.name=Schwerer Stirlingmotor
tile.machine_stirling_steel.desc=Erzeugt Energie aus Wärme. Benötigt externe Hitzequelle.$Verwendet ein schwereres Zahnrad und verträgt höhere Temparaturen.$Wärmestransferrate: T*0.1 TU/t$Maximalaufnahme: 1500 TU/t$Effizienz: 50%%
tile.machine_storage_drum.name=Atommüll-Lagertrommel
tile.machine_telelinker.name=Geschütz-Telemetrie-Manager
tile.machine_teleporter.name=Teleporter

View File

@ -423,8 +423,11 @@ container.bombMulti=Multi Purpose Bomb
container.centrifuge=Centrifuge
container.chemplant=Chemical Plant
container.compactLauncher=Compact Launch Pad
container.craneBoxer=Conveyor Boxer
container.craneExtractor=Conveyor Ejector
container.craneInserter=Conveyor Inserter
container.craneRouter=Conveyor Router
container.craneUnboxer=Conveyor Unboxer
container.crateDesh=Desh Crate
container.crateIron=Iron Crate
container.crateSteel=Steel Crate
@ -1718,6 +1721,7 @@ item.gas_mask_mono.name=Half Mask
item.gas_mask_olde.name=Leather Gas Mask
item.gas_petroleum.name=Petroleum Gas Tank
item.gear_large.name=Large Gear
item.gear_large_steel.name=Large Steel Gear
item.geiger_counter.name=Handheld Geiger Counter
item.gem_alexandrite.name=Alexandrite
item.gem_tantalium.name=Tantalium Polycrystal
@ -3607,8 +3611,11 @@ tile.conveyor_double.name=Double-Lane Conveyor Belt
tile.conveyor_lift.name=Conveyor Chain Lift
tile.conveyor_triple.name=Triple-Lane Conveyor Belt
tile.corium_block.name=Corium
tile.crane_boxer.name=Conveyor Boxer
tile.crane_extractor.name=Conveyor Ejector
tile.crane_inserter.name=Conveyor Inserter
tile.crane_router.name=Conveyor Sorter
tile.crane_unboxer.name=Conveyor Unboxer
tile.crashed_bomb.name=Dud
tile.crate.name=Supply Crate
tile.crate_ammo.name=Starmetal Crate
@ -3904,6 +3911,8 @@ tile.machine_spp_bottom.name=ZPE Potential Generator (Bottom)
tile.machine_spp_top.name=ZPE Potential Generator (Top)
tile.machine_stirling.name=Stirling Engine
tile.machine_stirling.desc=Turns heat into energy. Requires external heat source.$Heat transfer rate: T*0.1 TU/t$Max intake: 300 TU/t$Efficiency: 50%%
tile.machine_stirling_steel.name=Heavy Stirling Engine
tile.machine_stirling_steel.desc=Turns heat into energy. Requires external heat source.$Uses a much heavier gear to support higher temperatures.$Heat transfer rate: T*0.1 TU/t$Max intake: 1500 TU/t$Efficiency: 50%%
tile.machine_storage_drum.name=Nuclear Waste Disposal Drum
tile.machine_telelinker.name=Turret Telemetry Linker
tile.machine_teleporter.name=Teleporter

View File

@ -0,0 +1,3 @@
{
"animation": { }
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 B

View File

@ -0,0 +1,3 @@
{
"animation": { }
}

View File

@ -0,0 +1,3 @@
{
"animation": { }
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 B

View File

@ -0,0 +1,3 @@
{
"animation": { }
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 286 B

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 810 B

View File

@ -0,0 +1,3 @@
{
"animation": { }
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 763 B

View File

@ -0,0 +1,3 @@
{
"animation": { }
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 B

View File

@ -3,7 +3,7 @@
"modid": "hbm",
"name": "Hbm's Nuclear Tech",
"description": "A mod that adds weapons, nuclear themed stuff and machines",
"version":"1.0.27_X4312",
"version":"1.0.27_X4327",
"mcversion": "1.7.10",
"url": "",
"updateUrl": "",