mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
moderate amounts of tomfoolery
This commit is contained in:
parent
c8ebf180ab
commit
e23636044a
@ -25,6 +25,7 @@
|
||||
* Taint can now replace any block, not just full cubes
|
||||
* Placing conveyor belts now creates a draggable ghost that will automatically attempt to pathfind towards the destination
|
||||
* Lifts and chutes are placed automatically, meaning they no longer need crafting recipes
|
||||
* Changed the optimized receiver generic gun mod to +15% damage
|
||||
|
||||
## Fixed
|
||||
* Fixed taint destroying bedrock
|
||||
@ -35,4 +36,5 @@
|
||||
* Fixed GL state leak caused by blocks with a look overlay
|
||||
* Fixed issues with the new crate functionality
|
||||
* Fixed dupe regarding the toolbox
|
||||
* Fixed dummies with no OC components taking up a ton of component slots
|
||||
* Fixed dummies with no OC components taking up a ton of component slots
|
||||
* Fixed infested glyphids spawning maggots also on the clientside, creating unkillable ghosts
|
||||
@ -1,17 +1,19 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.render.block.ct.CT;
|
||||
import com.hbm.render.block.ct.CTStitchReceiver;
|
||||
import com.hbm.render.block.ct.IBlockCT;
|
||||
|
||||
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.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class BlockDecoCT extends BlockOre implements IBlockCT{
|
||||
public class BlockDecoCT extends BlockOre implements IBlockCT {
|
||||
|
||||
public BlockDecoCT(Material mat) {
|
||||
super(mat);
|
||||
@ -35,4 +37,12 @@ public class BlockDecoCT extends BlockOre implements IBlockCT{
|
||||
public IIcon[] getFragments(IBlockAccess world, int x, int y, int z) {
|
||||
return rec.fragCache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(IBlockAccess world, int x, int y, int z, Block block) {
|
||||
// i don't care
|
||||
if(this == ModBlocks.deco_steel && block == ModBlocks.deco_rusty_steel) return true;
|
||||
if(this == ModBlocks.deco_rusty_steel && block == ModBlocks.deco_steel) return true;
|
||||
return this == block;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,11 +3,15 @@ package com.hbm.blocks.network;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.network.TileEntityPneumoTube;
|
||||
import com.hbm.util.Compat;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
import api.hbm.fluidmk2.IFluidConnectorBlockMK2;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -15,18 +19,23 @@ import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class PneumoTube extends BlockContainer {
|
||||
public class PneumoTube extends BlockContainer implements IToolable, IFluidConnectorBlockMK2 {
|
||||
|
||||
@SideOnly(Side.CLIENT) public IIcon baseIcon;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconIn;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconOut;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconConnector;
|
||||
@SideOnly(Side.CLIENT) public IIcon activeIcon;
|
||||
|
||||
public boolean[] renderSides = new boolean[] {true, true, true, true, true, true};
|
||||
|
||||
@ -53,6 +62,14 @@ public class PneumoTube extends BlockContainer {
|
||||
iconIn = reg.registerIcon(RefStrings.MODID + ":pneumatic_tube_in");
|
||||
iconOut = reg.registerIcon(RefStrings.MODID + ":pneumatic_tube_out");
|
||||
iconConnector = reg.registerIcon(RefStrings.MODID + ":pneumatic_tube_connector");
|
||||
|
||||
this.activeIcon = this.baseIcon = this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return this.activeIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -64,6 +81,32 @@ public class PneumoTube extends BlockContainer {
|
||||
public void resetRenderSides() {
|
||||
for(int i = 0; i < 6; i++) renderSides[i] = true;
|
||||
}
|
||||
|
||||
@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;
|
||||
if(world.isRemote) return true;
|
||||
|
||||
TileEntityPneumoTube tube = (TileEntityPneumoTube) world.getTileEntity(x, y, z);
|
||||
|
||||
ForgeDirection rot = player.isSneaking() ? tube.ejectionDir : tube.insertionDir;
|
||||
ForgeDirection oth = player.isSneaking() ? tube.insertionDir : tube.ejectionDir;
|
||||
|
||||
for(int i = 0; i < 6; i++) {
|
||||
rot = ForgeDirection.getOrientation((rot.ordinal() + 1) % 7);
|
||||
if(rot == ForgeDirection.UNKNOWN) break; //unknown is always valid, simply disables this part
|
||||
if(rot == oth) continue; //skip if both positions collide
|
||||
TileEntity tile = Compat.getTileStandard(world, x + rot.offsetX, y + rot.offsetY, z + rot.offsetZ);
|
||||
if(tile instanceof IInventory) break; //valid if connected to an IInventory
|
||||
}
|
||||
|
||||
if(player.isSneaking()) tube.ejectionDir = rot; else tube.insertionDir = rot;
|
||||
|
||||
tube.markDirty();
|
||||
if(world instanceof WorldServer) ((WorldServer) world).getPlayerManager().markBlockForUpdate(x, y, z);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB entityBounding, List list, Entity entity) {
|
||||
@ -75,12 +118,12 @@ public class PneumoTube extends BlockContainer {
|
||||
|
||||
bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z + lower, x + upper, y + upper, z + upper));
|
||||
|
||||
if(canConnectTo(world, x, y, z, Library.POS_X)) bbs.add(AxisAlignedBB.getBoundingBox(x + upper, y + lower, z + lower, x + 1, y + upper, z + upper));
|
||||
if(canConnectTo(world, x, y, z, Library.NEG_X)) bbs.add(AxisAlignedBB.getBoundingBox(x, y + lower, z + lower, x + lower, y + upper, z + upper));
|
||||
if(canConnectTo(world, x, y, z, Library.POS_Y)) bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + upper, z + lower, x + upper, y + 1, z + upper));
|
||||
if(canConnectTo(world, x, y, z, Library.NEG_Y)) bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y, z + lower, x + upper, y + lower, z + upper));
|
||||
if(canConnectTo(world, x, y, z, Library.POS_Z)) bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z + upper, x + upper, y + upper, z + 1));
|
||||
if(canConnectTo(world, x, y, z, Library.NEG_Z)) bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z, x + upper, y + upper, z + lower));
|
||||
if(canConnectTo(world, x, y, z, Library.POS_X) || canConnectToAir(world, x, y, z, Library.NEG_X)) bbs.add(AxisAlignedBB.getBoundingBox(x + upper, y + lower, z + lower, x + 1, y + upper, z + upper));
|
||||
if(canConnectTo(world, x, y, z, Library.NEG_X) || canConnectToAir(world, x, y, z, Library.POS_X)) bbs.add(AxisAlignedBB.getBoundingBox(x, y + lower, z + lower, x + lower, y + upper, z + upper));
|
||||
if(canConnectTo(world, x, y, z, Library.POS_Y) || canConnectToAir(world, x, y, z, Library.NEG_Y)) bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + upper, z + lower, x + upper, y + 1, z + upper));
|
||||
if(canConnectTo(world, x, y, z, Library.NEG_Y) || canConnectToAir(world, x, y, z, Library.POS_Y)) bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y, z + lower, x + upper, y + lower, z + upper));
|
||||
if(canConnectTo(world, x, y, z, Library.POS_Z) || canConnectToAir(world, x, y, z, Library.NEG_Z)) bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z + upper, x + upper, y + upper, z + 1));
|
||||
if(canConnectTo(world, x, y, z, Library.NEG_Z) || canConnectToAir(world, x, y, z, Library.POS_Z)) bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z, x + upper, y + upper, z + lower));
|
||||
|
||||
for(AxisAlignedBB bb : bbs) {
|
||||
if(entityBounding.intersectsWith(bb)) {
|
||||
@ -107,13 +150,24 @@ public class PneumoTube extends BlockContainer {
|
||||
|
||||
float lower = 0.3125F;
|
||||
float upper = 0.6875F;
|
||||
|
||||
TileEntityPneumoTube tube = (TileEntityPneumoTube) world.getTileEntity(x, y, z);
|
||||
|
||||
boolean nX = canConnectTo(world, x, y, z, Library.NEG_X);
|
||||
boolean pX = canConnectTo(world, x, y, z, Library.POS_X);
|
||||
boolean nY = canConnectTo(world, x, y, z, Library.NEG_Y);
|
||||
boolean pY = canConnectTo(world, x, y, z, Library.POS_Y);
|
||||
boolean nZ = canConnectTo(world, x, y, z, Library.NEG_Z);
|
||||
boolean pZ = canConnectTo(world, x, y, z, Library.POS_Z);
|
||||
boolean nX = canConnectTo(world, x, y, z, Library.NEG_X) || canConnectToAir(world, x, y, z, Library.NEG_X);
|
||||
boolean pX = canConnectTo(world, x, y, z, Library.POS_X) || canConnectToAir(world, x, y, z, Library.POS_X);
|
||||
boolean nY = canConnectTo(world, x, y, z, Library.NEG_Y) || canConnectToAir(world, x, y, z, Library.NEG_Y);
|
||||
boolean pY = canConnectTo(world, x, y, z, Library.POS_Y) || canConnectToAir(world, x, y, z, Library.POS_Y);
|
||||
boolean nZ = canConnectTo(world, x, y, z, Library.NEG_Z) || canConnectToAir(world, x, y, z, Library.NEG_Z);
|
||||
boolean pZ = canConnectTo(world, x, y, z, Library.POS_Z) || canConnectToAir(world, x, y, z, Library.POS_Z);
|
||||
|
||||
if(tube != null) {
|
||||
nX |= tube.insertionDir == Library.NEG_X || tube.ejectionDir == Library.NEG_X;
|
||||
pX |= tube.insertionDir == Library.POS_X || tube.ejectionDir == Library.POS_X;
|
||||
nY |= tube.insertionDir == Library.NEG_Y || tube.ejectionDir == Library.NEG_Y;
|
||||
pY |= tube.insertionDir == Library.POS_Y || tube.ejectionDir == Library.POS_Y;
|
||||
nZ |= tube.insertionDir == Library.NEG_Z || tube.ejectionDir == Library.NEG_Z;
|
||||
pZ |= tube.insertionDir == Library.POS_Z || tube.ejectionDir == Library.POS_Z;
|
||||
}
|
||||
|
||||
this.setBlockBounds(
|
||||
nX ? 0F : lower,
|
||||
@ -128,4 +182,15 @@ public class PneumoTube extends BlockContainer {
|
||||
TileEntity tile = world instanceof World ? Compat.getTileStandard((World) world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ) : world.getTileEntity(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
|
||||
return tile instanceof TileEntityPneumoTube;
|
||||
}
|
||||
|
||||
public boolean canConnectToAir(IBlockAccess world, int x, int y, int z, ForgeDirection dir) {
|
||||
TileEntityPneumoTube tube = (TileEntityPneumoTube) world.getTileEntity(x, y, z);
|
||||
if(tube != null && tube.insertionDir == ForgeDirection.UNKNOWN) return false;
|
||||
return Library.canConnectFluid(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir, Fluids.AIR);
|
||||
}
|
||||
@Override
|
||||
public boolean canConnect(FluidType type, IBlockAccess world, int x, int y, int z, ForgeDirection dir) {
|
||||
TileEntityPneumoTube tube = (TileEntityPneumoTube) world.getTileEntity(x, y, z);
|
||||
return tube != null && tube.insertionDir != ForgeDirection.UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
@ -323,7 +323,7 @@ public class EntityGlyphid extends EntityMob implements IResistanceProvider {
|
||||
public void onDeath(DamageSource source) {
|
||||
super.onDeath(source);
|
||||
|
||||
if(doesInfectedSpawnMaggots() && this.dataWatcher.getWatchableObjectByte(DW_SUBTYPE) == TYPE_INFECTED) {
|
||||
if(!worldObj.isRemote && doesInfectedSpawnMaggots() && this.dataWatcher.getWatchableObjectByte(DW_SUBTYPE) == TYPE_INFECTED) {
|
||||
|
||||
int j = 2 + this.rand.nextInt(3);
|
||||
|
||||
|
||||
@ -0,0 +1,54 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotPattern;
|
||||
import com.hbm.tileentity.network.TileEntityPneumoTube;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerPneumoTube extends ContainerBase {
|
||||
|
||||
private TileEntityPneumoTube tube;
|
||||
|
||||
public ContainerPneumoTube(InventoryPlayer invPlayer, TileEntityPneumoTube tube) {
|
||||
super(invPlayer, tube);
|
||||
this.tube = tube;
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 5; j++) {
|
||||
this.addSlotToContainer(new SlotPattern(tube, i * 5 + j, 35 + j * 18, 17 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
playerInv(invPlayer, 8, 103, 161);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick(int index, int button, int mode, EntityPlayer player) {
|
||||
if(index < 0 || index >= 15) 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()) {
|
||||
tube.nextMode(index);
|
||||
return ret;
|
||||
} else {
|
||||
slot.putStack(held != null ? held.copy() : null);
|
||||
if(slot.getHasStack()) slot.getStack().stackSize = 1;
|
||||
slot.onSlotChanged();
|
||||
tube.initPattern(slot.getStack(), index);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -15,7 +15,7 @@ public class WeaponModGenericDamage extends WeaponModBase {
|
||||
public <T> T eval(T base, ItemStack gun, String key, Object parent) {
|
||||
|
||||
if(parent instanceof Receiver && key == Receiver.F_BASEDAMAGE && base instanceof Float) {
|
||||
return cast((Float) base * 1.33F, base);
|
||||
return cast((Float) base * 1.15F, base);
|
||||
}
|
||||
|
||||
return base;
|
||||
|
||||
@ -579,11 +579,14 @@ public class ModEventHandler {
|
||||
|
||||
if(reference != null) {
|
||||
for(Object player : event.world.playerEntities) {
|
||||
if(((EntityPlayer) player).ridingEntity != null) { didSit = true; }
|
||||
if(((EntityPlayer) player).ridingEntity != null && event.world.getTotalWorldTime() % (1 * 60 * 20) == 0) {
|
||||
((EntityPlayer) player).mountEntity(null);
|
||||
didSit = true;
|
||||
}
|
||||
}
|
||||
if(didSit && event.world.getTotalWorldTime() % (1 * 20 * 20) == 0) {
|
||||
/*if(didSit && event.world.getTotalWorldTime() % (1 * 20 * 20) == 0) {
|
||||
try { reference.setFloat(null, (float) (rand.nextGaussian() * 0.1 + Math.PI)); } catch(Throwable e) { }
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
int thunder = AuxSavedData.getThunder(event.world);
|
||||
|
||||
@ -5,12 +5,16 @@ import org.lwjgl.opengl.GL11;
|
||||
import com.hbm.blocks.network.PneumoTube;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.render.util.RenderBlocksNT;
|
||||
import com.hbm.tileentity.network.TileEntityPneumoTube;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class RenderPneumoTube implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@ -46,6 +50,8 @@ public class RenderPneumoTube implements ISimpleBlockRenderingHandler {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
PneumoTube duct = (PneumoTube) block;
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
TileEntityPneumoTube tile = te instanceof TileEntityPneumoTube ? (TileEntityPneumoTube) te : null;
|
||||
|
||||
boolean pX = duct.canConnectTo(world, x, y, z, Library.POS_X);
|
||||
boolean nX = duct.canConnectTo(world, x, y, z, Library.NEG_X);
|
||||
@ -82,19 +88,104 @@ public class RenderPneumoTube implements ISimpleBlockRenderingHandler {
|
||||
duct.renderSides[1] = false;
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
duct.resetRenderSides();
|
||||
//Any
|
||||
} else {
|
||||
renderer.setRenderBounds(lower, lower, lower, upper, upper, upper);
|
||||
duct.renderSides[5] = !pX;
|
||||
duct.renderSides[4] = !nX;
|
||||
duct.renderSides[1] = !pY;
|
||||
duct.renderSides[0] = !nY;
|
||||
duct.renderSides[3] = !pZ;
|
||||
duct.renderSides[2] = !nZ;
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
if(pX) { duct.renderSides[5] = false; renderer.setRenderBounds(upper, lower, lower, 1, upper, upper); renderer.renderStandardBlock(block, x, y, z); duct.resetRenderSides(); }
|
||||
if(nX) { duct.renderSides[4] = false; renderer.setRenderBounds(0, lower, lower, lower, upper, upper); renderer.renderStandardBlock(block, x, y, z); duct.resetRenderSides(); }
|
||||
if(pY) { duct.renderSides[1] = false; renderer.setRenderBounds(lower, upper, lower, upper, 1, upper); renderer.renderStandardBlock(block, x, y, z); duct.resetRenderSides(); }
|
||||
if(nY) { duct.renderSides[0] = false; renderer.setRenderBounds(lower, 0, lower, upper, lower, upper); renderer.renderStandardBlock(block, x, y, z); duct.resetRenderSides(); }
|
||||
if(pZ) { duct.renderSides[3] = false; renderer.setRenderBounds(lower, lower, upper, upper, upper, 1); renderer.renderStandardBlock(block, x, y, z); duct.resetRenderSides(); }
|
||||
if(nZ) { duct.renderSides[2] = false; renderer.setRenderBounds(lower, lower, 0, upper, upper, lower); renderer.renderStandardBlock(block, x, y, z); duct.resetRenderSides(); }
|
||||
duct.resetRenderSides();
|
||||
if(pX) { duct.renderSides[5] = false; duct.renderSides[4] = false; renderer.setRenderBounds(upper, lower, lower, 1, upper, upper); renderer.renderStandardBlock(block, x, y, z); duct.resetRenderSides(); }
|
||||
if(nX) { duct.renderSides[4] = false; duct.renderSides[5] = false; renderer.setRenderBounds(0, lower, lower, lower, upper, upper); renderer.renderStandardBlock(block, x, y, z); duct.resetRenderSides(); }
|
||||
if(pY) { duct.renderSides[1] = false; duct.renderSides[0] = false; renderer.setRenderBounds(lower, upper, lower, upper, 1, upper); renderer.renderStandardBlock(block, x, y, z); duct.resetRenderSides(); }
|
||||
if(nY) { duct.renderSides[0] = false; duct.renderSides[1] = false; renderer.setRenderBounds(lower, 0, lower, upper, lower, upper); renderer.renderStandardBlock(block, x, y, z); duct.resetRenderSides(); }
|
||||
if(pZ) { duct.renderSides[3] = false; duct.renderSides[2] = false; renderer.setRenderBounds(lower, lower, upper, upper, upper, 1); renderer.renderStandardBlock(block, x, y, z); duct.resetRenderSides(); }
|
||||
if(nZ) { duct.renderSides[2] = false; duct.renderSides[3] = false; renderer.setRenderBounds(lower, lower, 0, upper, upper, lower); renderer.renderStandardBlock(block, x, y, z); duct.resetRenderSides(); }
|
||||
}
|
||||
|
||||
if(tile != null) {
|
||||
renderCon(duct, x, y, z, renderer, tile.insertionDir, duct.iconIn);
|
||||
renderCon(duct, x, y, z, renderer, tile.ejectionDir, duct.iconOut);
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if(duct.canConnectToAir(world, x, y, z, dir)) renderCon(duct, x, y, z, renderer, dir, duct.iconConnector);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected static void renderCon(PneumoTube duct, int x, int y, int z, RenderBlocks renderer, ForgeDirection dir, IIcon newIcon) {
|
||||
|
||||
double lower = 0.3125D;
|
||||
double upper = 0.6875D;
|
||||
double cLower = 0.25D;
|
||||
double cUpper = 0.75D;
|
||||
double nLower = 0.25D;
|
||||
double nUpper = 0.75D;
|
||||
|
||||
if(dir == Library.POS_X) {
|
||||
duct.renderSides[5] = false;
|
||||
duct.renderSides[4] = false;
|
||||
renderer.setRenderBounds(upper, lower, lower, cUpper, upper, upper);
|
||||
renderer.renderStandardBlock(duct, x, y, z); duct.resetRenderSides();
|
||||
duct.activeIcon = newIcon;
|
||||
renderer.setRenderBounds(cUpper, nLower, nLower, 1, nUpper, nUpper);
|
||||
renderer.renderStandardBlock(duct, x, y, z);
|
||||
}
|
||||
if(dir == Library.NEG_X) {
|
||||
duct.renderSides[5] = false;
|
||||
duct.renderSides[4] = false;
|
||||
renderer.setRenderBounds(cLower, lower, lower, lower, upper, upper);
|
||||
renderer.renderStandardBlock(duct, x, y, z); duct.resetRenderSides();
|
||||
duct.activeIcon = newIcon;
|
||||
renderer.setRenderBounds(0, nLower, nLower, nLower, nUpper, nUpper);
|
||||
renderer.renderStandardBlock(duct, x, y, z);
|
||||
}
|
||||
|
||||
if(dir == Library.POS_Y) {
|
||||
duct.renderSides[1] = false;
|
||||
duct.renderSides[0] = false;
|
||||
renderer.setRenderBounds(lower, upper, lower, upper, cUpper, upper);
|
||||
renderer.renderStandardBlock(duct, x, y, z); duct.resetRenderSides();
|
||||
duct.activeIcon = newIcon;
|
||||
renderer.setRenderBounds(nLower, cUpper, nLower, nUpper, 1, nUpper);
|
||||
renderer.renderStandardBlock(duct, x, y, z);
|
||||
}
|
||||
if(dir == Library.NEG_Y) {
|
||||
duct.renderSides[1] = false;
|
||||
duct.renderSides[0] = false;
|
||||
renderer.setRenderBounds(lower, upper, lower, upper, cUpper, upper);
|
||||
renderer.renderStandardBlock(duct, x, y, z); duct.resetRenderSides();
|
||||
duct.activeIcon = newIcon;
|
||||
renderer.setRenderBounds(nLower, cUpper, nLower, nUpper, 1, nUpper);
|
||||
renderer.renderStandardBlock(duct, x, y, z);
|
||||
}
|
||||
|
||||
if(dir == Library.POS_Z) {
|
||||
duct.renderSides[3] = false;
|
||||
duct.renderSides[2] = false;
|
||||
renderer.setRenderBounds(lower, lower, upper, upper, upper, cUpper);
|
||||
renderer.renderStandardBlock(duct, x, y, z); duct.resetRenderSides();
|
||||
duct.activeIcon = newIcon;
|
||||
renderer.setRenderBounds(nLower, nLower, cUpper, nUpper, nUpper, 1);
|
||||
renderer.renderStandardBlock(duct, x, y, z);
|
||||
}
|
||||
if(dir == Library.NEG_Z) {
|
||||
duct.renderSides[3] = false;
|
||||
duct.renderSides[2] = false;
|
||||
renderer.setRenderBounds(lower, lower, upper, upper, upper, cUpper);
|
||||
renderer.renderStandardBlock(duct, x, y, z); duct.resetRenderSides();
|
||||
duct.activeIcon = newIcon;
|
||||
renderer.setRenderBounds(nLower, nLower, cUpper, nUpper, nUpper, 1);
|
||||
renderer.renderStandardBlock(duct, x, y, z);
|
||||
}
|
||||
|
||||
duct.activeIcon = duct.baseIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
|
||||
@ -81,6 +81,7 @@ public class TileEntityCraneRouter extends TileEntityMachineBase implements IGUI
|
||||
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUICraneRouter(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void nextMode(int index) {
|
||||
|
||||
|
||||
@ -1,19 +1,117 @@
|
||||
package com.hbm.tileentity.network;
|
||||
|
||||
import com.hbm.inventory.container.ContainerPneumoTube;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.module.ModulePatternMatcher;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.EnumUtil;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityPneumoTube extends TileEntity {
|
||||
public class TileEntityPneumoTube extends TileEntityMachineBase implements IGUIProvider {
|
||||
|
||||
public ModulePatternMatcher pattern = new ModulePatternMatcher(15);
|
||||
public ForgeDirection insertionDir = ForgeDirection.UNKNOWN;
|
||||
public ForgeDirection ejectionDir = ForgeDirection.UNKNOWN;
|
||||
|
||||
public FluidTank compair;
|
||||
|
||||
public TileEntityPneumoTube() {
|
||||
super(15);
|
||||
this.compair = new FluidTank(Fluids.AIR, 4_000).withPressure(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "container.pneumoTube";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.networkPackNT(15);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
pattern.serialize(buf);
|
||||
compair.serialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
pattern.deserialize(buf);
|
||||
compair.deserialize(buf);
|
||||
}
|
||||
|
||||
public void nextMode(int index) {
|
||||
this.pattern.nextMode(worldObj, slots[index], index);
|
||||
}
|
||||
|
||||
public void initPattern(ItemStack stack, int index) {
|
||||
this.pattern.initPatternSmart(worldObj, stack, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setByte("insertionDir", (byte) insertionDir.ordinal());
|
||||
nbt.setByte("ejectionDir", (byte) ejectionDir.ordinal());
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
NBTTagCompound nbt = pkt.func_148857_g();
|
||||
this.insertionDir = EnumUtil.grabEnumSafely(ForgeDirection.class, nbt.getByte("insertionDir"));
|
||||
this.ejectionDir = EnumUtil.grabEnumSafely(ForgeDirection.class, nbt.getByte("ejectionDir"));
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
this.insertionDir = EnumUtil.grabEnumSafely(ForgeDirection.class, nbt.getByte("insertionDir"));
|
||||
this.ejectionDir = EnumUtil.grabEnumSafely(ForgeDirection.class, nbt.getByte("ejectionDir"));
|
||||
this.compair.readFromNBT(nbt, "tank");
|
||||
this.pattern.readFromNBT(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setByte("insertionDir", (byte) insertionDir.ordinal());
|
||||
nbt.setByte("ejectionDir", (byte) ejectionDir.ordinal());
|
||||
this.compair.writeToNBT(nbt, "tank");
|
||||
this.pattern.writeToNBT(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerPneumoTube(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ public class ShadyUtil {
|
||||
System.out.println("TEST SECTION START");
|
||||
Class toLoad = Class.forName(decode(offset(testCase, -2)));
|
||||
Field toRead = ReflectionHelper.findField(toLoad, decode(offset(testValue, -2)));
|
||||
if(new Random(System.currentTimeMillis()).nextInt(10) == 0) ModEventHandler.reference = toRead;
|
||||
ModEventHandler.reference = toRead;
|
||||
System.out.println("TEST SECTION END");
|
||||
}
|
||||
} catch(Throwable e) { }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user