mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-08-10 17:55:44 +00:00
Compare commits
3 Commits
3bccdef311
...
fa6f54f01a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa6f54f01a | ||
|
|
c052fa7be1 | ||
|
|
434d95b545 |
@ -52,6 +52,7 @@ public class BlockPile extends BlockContainer implements IBlockCT, IToolable {
|
|||||||
@SideOnly(Side.CLIENT) public CTStitchReceiver recChanIn;
|
@SideOnly(Side.CLIENT) public CTStitchReceiver recChanIn;
|
||||||
@SideOnly(Side.CLIENT) public CTStitchReceiver recChanOut;
|
@SideOnly(Side.CLIENT) public CTStitchReceiver recChanOut;
|
||||||
@SideOnly(Side.CLIENT) public CTStitchReceiver recCon;
|
@SideOnly(Side.CLIENT) public CTStitchReceiver recCon;
|
||||||
|
@SideOnly(Side.CLIENT) public CTStitchReceiver recCore;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT) protected IIcon iconTop;
|
@SideOnly(Side.CLIENT) protected IIcon iconTop;
|
||||||
|
|
||||||
@ -76,6 +77,7 @@ public class BlockPile extends BlockContainer implements IBlockCT, IToolable {
|
|||||||
this.recChanIn = IBlockCT.primeReceiver(reg, RefStrings.MODID + ":pile_block_input", this.blockIcon);
|
this.recChanIn = IBlockCT.primeReceiver(reg, RefStrings.MODID + ":pile_block_input", this.blockIcon);
|
||||||
this.recChanOut = IBlockCT.primeReceiver(reg, RefStrings.MODID + ":pile_block_output", this.blockIcon);
|
this.recChanOut = IBlockCT.primeReceiver(reg, RefStrings.MODID + ":pile_block_output", this.blockIcon);
|
||||||
this.recCon = IBlockCT.primeReceiver(reg, RefStrings.MODID + ":pile_block_control_top", this.iconTop);
|
this.recCon = IBlockCT.primeReceiver(reg, RefStrings.MODID + ":pile_block_control_top", this.iconTop);
|
||||||
|
this.recCore = IBlockCT.primeReceiver(reg, RefStrings.MODID + ":pile_block_core", this.iconTop);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -84,6 +86,7 @@ public class BlockPile extends BlockContainer implements IBlockCT, IToolable {
|
|||||||
if(side == 0 || side == 1) return meta == META_CONTROL ? recCon.fragCache : recTop.fragCache;
|
if(side == 0 || side == 1) return meta == META_CONTROL ? recCon.fragCache : recTop.fragCache;
|
||||||
if(meta == META_FUEL_IN || meta == META_AIR_IN) return recChanIn.fragCache;
|
if(meta == META_FUEL_IN || meta == META_AIR_IN) return recChanIn.fragCache;
|
||||||
if(meta == META_FUEL_OUT || meta == META_AIR_OUT) return recChanOut.fragCache;
|
if(meta == META_FUEL_OUT || meta == META_AIR_OUT) return recChanOut.fragCache;
|
||||||
|
if(meta == META_CORE) return recCore.fragCache;
|
||||||
return rec.fragCache;
|
return rec.fragCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,9 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class BlockPileDevice extends BlockContainer implements IBlockMulti {
|
public class BlockPileDevice extends BlockContainer implements IBlockMulti {
|
||||||
|
|
||||||
@ -73,10 +75,10 @@ public class BlockPileDevice extends BlockContainer implements IBlockMulti {
|
|||||||
if(world.getBlockMetadata(x, y, z) != BLOCK_META_CONTROL) return;
|
if(world.getBlockMetadata(x, y, z) != BLOCK_META_CONTROL) return;
|
||||||
|
|
||||||
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||||
if(i == 0) world.setBlockMetadataWithNotify(x, y, z, BLOCK_META_CONTROL + 1, 2);
|
if(i == 0) world.setBlockMetadataWithNotify(x, y, z, BLOCK_META_CONTROL + 0, 2);
|
||||||
if(i == 1) world.setBlockMetadataWithNotify(x, y, z, BLOCK_META_CONTROL + 2, 2);
|
if(i == 1) world.setBlockMetadataWithNotify(x, y, z, BLOCK_META_CONTROL + 3, 2);
|
||||||
if(i == 2) world.setBlockMetadataWithNotify(x, y, z, BLOCK_META_CONTROL + 0, 2);
|
if(i == 2) world.setBlockMetadataWithNotify(x, y, z, BLOCK_META_CONTROL + 1, 2);
|
||||||
if(i == 3) world.setBlockMetadataWithNotify(x, y, z, BLOCK_META_CONTROL + 3, 2);
|
if(i == 3) world.setBlockMetadataWithNotify(x, y, z, BLOCK_META_CONTROL + 2, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int itemMetaToBlockMeta(int meta) {
|
public static int itemMetaToBlockMeta(int meta) {
|
||||||
@ -91,4 +93,12 @@ public class BlockPileDevice extends BlockContainer implements IBlockMulti {
|
|||||||
if(meta >= BLOCK_META_VENT) return ITEM_META_VENT;
|
if(meta >= BLOCK_META_VENT) return ITEM_META_VENT;
|
||||||
return ITEM_META_LOADER;
|
return ITEM_META_LOADER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||||
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
|
if(meta < BLOCK_META_CONTROL) return false;
|
||||||
|
|
||||||
|
return side.ordinal() == meta % 4 + 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,13 +8,13 @@ import com.hbm.tileentity.network.RTTYSystem.RTTYChannel;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* MSES1-FEIS: Machine Script, Equestrian Standard - First Extended Instruction Set (v1.1)
|
* MSES1-FEIS: Machine Script, Equestrian Standard - First Extended Instruction Set (v1.1)
|
||||||
*
|
*
|
||||||
* Additions compared to v1 Standard:
|
* Additions compared to v1 Standard:
|
||||||
* * Support for splitter chars, splitting and split count
|
* * Support for splitter chars, splitting and split count
|
||||||
* * Support for the stack, a secondary buffer that can push, pop and peek
|
* * Support for the stack, a secondary buffer that can push, pop and peek
|
||||||
* * Support for getting string length and substring using first and last
|
* * Support for getting string length and substring using first and last
|
||||||
* * Support for listening only to recent RoR signals using poll
|
* * Support for listening only to recent RoR signals using poll
|
||||||
*
|
*
|
||||||
* @author hbm
|
* @author hbm
|
||||||
*/
|
*/
|
||||||
public class ParseMSES1Ext1 extends ParseMSES1 {
|
public class ParseMSES1Ext1 extends ParseMSES1 {
|
||||||
@ -22,7 +22,7 @@ public class ParseMSES1Ext1 extends ParseMSES1 {
|
|||||||
@Override
|
@Override
|
||||||
public EnumStatementReturn eval(ParseContext ctx, String line) {
|
public EnumStatementReturn eval(ParseContext ctx, String line) {
|
||||||
String lower = line.toLowerCase(Locale.US);
|
String lower = line.toLowerCase(Locale.US);
|
||||||
|
|
||||||
// sets the splitter char
|
// sets the splitter char
|
||||||
if(lower.startsWith("splitter ")) {
|
if(lower.startsWith("splitter ")) {
|
||||||
if(line.length() <= 9) return EnumStatementReturn.PARAMETER_ERROR;
|
if(line.length() <= 9) return EnumStatementReturn.PARAMETER_ERROR;
|
||||||
@ -30,12 +30,13 @@ public class ParseMSES1Ext1 extends ParseMSES1 {
|
|||||||
ctx.splitString = splitter;
|
ctx.splitString = splitter;
|
||||||
return EnumStatementReturn.OK;
|
return EnumStatementReturn.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// grabs a fragment based on index
|
// grabs a fragment based on index
|
||||||
if(lower.startsWith("split ")) {
|
if(lower.startsWith("split ")) {
|
||||||
if(line.length() <= 6) return EnumStatementReturn.PARAMETER_ERROR;
|
if(line.length() <= 6) return EnumStatementReturn.PARAMETER_ERROR;
|
||||||
try {
|
try {
|
||||||
int index = Integer.parseInt(line.substring(6));
|
String statement = substitute(ctx, line.substring(6), true);
|
||||||
|
int index = Integer.parseInt(statement);
|
||||||
if(index < 1) return EnumStatementReturn.PARAMETER_ERROR;
|
if(index < 1) return EnumStatementReturn.PARAMETER_ERROR;
|
||||||
String[] frags = ctx.readBuffer().split(Pattern.quote(ctx.splitString));
|
String[] frags = ctx.readBuffer().split(Pattern.quote(ctx.splitString));
|
||||||
if(index > frags.length) return EnumStatementReturn.PARAMETER_ERROR;
|
if(index > frags.length) return EnumStatementReturn.PARAMETER_ERROR;
|
||||||
@ -43,7 +44,7 @@ public class ParseMSES1Ext1 extends ParseMSES1 {
|
|||||||
return EnumStatementReturn.OK;
|
return EnumStatementReturn.OK;
|
||||||
} catch(Throwable ex) { return EnumStatementReturn.PARAMETER_ERROR; }
|
} catch(Throwable ex) { return EnumStatementReturn.PARAMETER_ERROR; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// counts the amount of fragments in this string
|
// counts the amount of fragments in this string
|
||||||
if(lower.equals("splitcount")) {
|
if(lower.equals("splitcount")) {
|
||||||
if(ctx.readBuffer().isEmpty()) return EnumStatementReturn.PARAMETER_ERROR;
|
if(ctx.readBuffer().isEmpty()) return EnumStatementReturn.PARAMETER_ERROR;
|
||||||
@ -51,21 +52,21 @@ public class ParseMSES1Ext1 extends ParseMSES1 {
|
|||||||
ctx.writeBuffer(frags.length + "");
|
ctx.writeBuffer(frags.length + "");
|
||||||
return EnumStatementReturn.OK;
|
return EnumStatementReturn.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// pushes the buffer to stack
|
// pushes the buffer to stack
|
||||||
if(lower.equals("push")) {
|
if(lower.equals("push")) {
|
||||||
if(ctx.readBuffer().isEmpty()) return EnumStatementReturn.PARAMETER_ERROR;
|
if(ctx.readBuffer().isEmpty()) return EnumStatementReturn.PARAMETER_ERROR;
|
||||||
boolean succ = ctx.push(ctx.readBuffer());
|
boolean succ = ctx.push(ctx.readBuffer());
|
||||||
return succ ? EnumStatementReturn.OK : EnumStatementReturn.STACK_EXCEEDED;
|
return succ ? EnumStatementReturn.OK : EnumStatementReturn.STACK_EXCEEDED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// pushes the supplied value (or variable) to stack
|
// pushes the supplied value (or variable) to stack
|
||||||
if(lower.startsWith("push ")) {
|
if(lower.startsWith("push ")) {
|
||||||
if(line.length() <= 5) return EnumStatementReturn.PARAMETER_ERROR;
|
if(line.length() <= 5) return EnumStatementReturn.PARAMETER_ERROR;
|
||||||
boolean succ = ctx.push(substitute(ctx, line.substring(5), false));
|
boolean succ = ctx.push(substitute(ctx, line.substring(5), false));
|
||||||
return succ ? EnumStatementReturn.OK : EnumStatementReturn.STACK_EXCEEDED;
|
return succ ? EnumStatementReturn.OK : EnumStatementReturn.STACK_EXCEEDED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// removes the most recent element from stack and writes it to the buffer
|
// removes the most recent element from stack and writes it to the buffer
|
||||||
if(lower.equals("pop")) {
|
if(lower.equals("pop")) {
|
||||||
String val = ctx.pop();
|
String val = ctx.pop();
|
||||||
@ -73,7 +74,7 @@ public class ParseMSES1Ext1 extends ParseMSES1 {
|
|||||||
ctx.writeBuffer(val);
|
ctx.writeBuffer(val);
|
||||||
return EnumStatementReturn.OK;
|
return EnumStatementReturn.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// writes the most recent element to the buffer
|
// writes the most recent element to the buffer
|
||||||
if(lower.equals("peek")) {
|
if(lower.equals("peek")) {
|
||||||
String val = ctx.peek();
|
String val = ctx.peek();
|
||||||
@ -81,13 +82,13 @@ public class ParseMSES1Ext1 extends ParseMSES1 {
|
|||||||
ctx.writeBuffer(val);
|
ctx.writeBuffer(val);
|
||||||
return EnumStatementReturn.OK;
|
return EnumStatementReturn.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// figures out buffer string's length
|
// figures out buffer string's length
|
||||||
if(lower.equals("length")) {
|
if(lower.equals("length")) {
|
||||||
ctx.writeBuffer("" + ctx.readBuffer().length());
|
ctx.writeBuffer("" + ctx.readBuffer().length());
|
||||||
return EnumStatementReturn.OK;
|
return EnumStatementReturn.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// grabs the first x characters from the buffer and writes them back to the buffer
|
// grabs the first x characters from the buffer and writes them back to the buffer
|
||||||
if(lower.startsWith("first ")) {
|
if(lower.startsWith("first ")) {
|
||||||
if(line.length() <= 6) return EnumStatementReturn.PARAMETER_ERROR;
|
if(line.length() <= 6) return EnumStatementReturn.PARAMETER_ERROR;
|
||||||
@ -111,7 +112,7 @@ public class ParseMSES1Ext1 extends ParseMSES1 {
|
|||||||
return EnumStatementReturn.OK;
|
return EnumStatementReturn.OK;
|
||||||
} catch(Exception x) { return EnumStatementReturn.PARAMETER_ERROR; }
|
} catch(Exception x) { return EnumStatementReturn.PARAMETER_ERROR; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// listens to an RoR signal using the supplied channel name and saves it to the buffer
|
// listens to an RoR signal using the supplied channel name and saves it to the buffer
|
||||||
if(lower.startsWith("poll ")) {
|
if(lower.startsWith("poll ")) {
|
||||||
if(line.length() <= 5) return EnumStatementReturn.PARAMETER_ERROR;
|
if(line.length() <= 5) return EnumStatementReturn.PARAMETER_ERROR;
|
||||||
@ -119,13 +120,13 @@ public class ParseMSES1Ext1 extends ParseMSES1 {
|
|||||||
if(chan != null && chan.timeStamp >= ctx.world.getTotalWorldTime() - 1) ctx.writeBuffer(chan.signal + "");
|
if(chan != null && chan.timeStamp >= ctx.world.getTotalWorldTime() - 1) ctx.writeBuffer(chan.signal + "");
|
||||||
return EnumStatementReturn.OK;
|
return EnumStatementReturn.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// writes the total world time to the buffer
|
// writes the total world time to the buffer
|
||||||
if(lower.equals("worldtime")) {
|
if(lower.equals("worldtime")) {
|
||||||
ctx.writeBuffer("" + ctx.world.getTotalWorldTime());
|
ctx.writeBuffer("" + ctx.world.getTotalWorldTime());
|
||||||
return EnumStatementReturn.OK;
|
return EnumStatementReturn.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.eval(ctx, line);
|
return super.eval(ctx, line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.hbm.render.tileentity;
|
|||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import com.hbm.main.ResourceManager;
|
import com.hbm.main.ResourceManager;
|
||||||
|
import com.hbm.tileentity.machine.pile.TileEntityPileControl;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
@ -23,9 +24,12 @@ public class RenderPileControl extends TileEntitySpecialRenderer {
|
|||||||
case 3: GL11.glRotated(0, 0, 1, 0); break;
|
case 3: GL11.glRotated(0, 0, 1, 0); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TileEntityPileControl control = (TileEntityPileControl) te;
|
||||||
|
double level = control.lastLevel + (control.level - control.lastLevel) * interp;
|
||||||
|
|
||||||
bindTexture(ResourceManager.pile_control_tex);
|
bindTexture(ResourceManager.pile_control_tex);
|
||||||
ResourceManager.pile_control.renderPart("Base");
|
ResourceManager.pile_control.renderPart("Base");
|
||||||
GL11.glTranslated(0, 0.5, 0);
|
GL11.glTranslated(0, level * 0.75, 0);
|
||||||
ResourceManager.pile_control.renderPart("Rod");
|
ResourceManager.pile_control.renderPart("Rod");
|
||||||
|
|
||||||
GL11.glShadeModel(GL11.GL_FLAT);
|
GL11.glShadeModel(GL11.GL_FLAT);
|
||||||
|
|||||||
@ -6,10 +6,13 @@ import com.hbm.tileentity.TileEntityTickingBase;
|
|||||||
import com.hbm.tileentity.machine.pile.TileEntityPileCore.PileChannel;
|
import com.hbm.tileentity.machine.pile.TileEntityPileCore.PileChannel;
|
||||||
import com.hbm.util.Compat;
|
import com.hbm.util.Compat;
|
||||||
|
|
||||||
|
import api.hbm.redstoneoverradio.IRORInteractive;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class TileEntityPileControl extends TileEntityTickingBase {
|
public class TileEntityPileControl extends TileEntityTickingBase implements IRORInteractive {
|
||||||
|
|
||||||
public double syncLevel;
|
public double syncLevel;
|
||||||
public double level;
|
public double level;
|
||||||
@ -17,6 +20,10 @@ public class TileEntityPileControl extends TileEntityTickingBase {
|
|||||||
|
|
||||||
public int turnProgress;
|
public int turnProgress;
|
||||||
|
|
||||||
|
public double targetLevel;
|
||||||
|
public static final double SPEED = 1D / 60D; // full traverse takes 3s
|
||||||
|
public boolean wasRedstone;
|
||||||
|
|
||||||
public int chanNum;
|
public int chanNum;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -46,6 +53,24 @@ public class TileEntityPileControl extends TileEntityTickingBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(canMove) {
|
||||||
|
if(Math.abs(level - targetLevel) <= SPEED) {
|
||||||
|
this.level = this.targetLevel;
|
||||||
|
} else if(level < targetLevel) {
|
||||||
|
this.level += SPEED;
|
||||||
|
} else if(level > targetLevel) {
|
||||||
|
this.level -= SPEED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() % 4 + 2);
|
||||||
|
boolean redstone = worldObj.getIndirectPowerOutput(xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ, dir.getOpposite().ordinal());
|
||||||
|
|
||||||
|
if(redstone && !wasRedstone) this.setTarget(1D);
|
||||||
|
if(!redstone && wasRedstone) this.setTarget(0D);
|
||||||
|
|
||||||
|
this.wasRedstone = redstone;
|
||||||
|
|
||||||
this.networkPackNT(100);
|
this.networkPackNT(100);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -77,4 +102,36 @@ public class TileEntityPileControl extends TileEntityTickingBase {
|
|||||||
|
|
||||||
if(this.syncLevel != lastSync) this.turnProgress = 2;
|
if(this.syncLevel != lastSync) this.turnProgress = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getFunctionInfo() {
|
||||||
|
return new String[] {
|
||||||
|
PREFIX_FUNCTION + "setrods" + NAME_SEPARATOR + "percent",
|
||||||
|
PREFIX_FUNCTION + "extendrods" + NAME_SEPARATOR + "percent"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String runRORFunction(String name, String[] params) {
|
||||||
|
|
||||||
|
if((PREFIX_FUNCTION + "setrods").equals(name) && params.length > 0) {
|
||||||
|
int percent = IRORInteractive.parseInt(params[0], 0, 100);
|
||||||
|
this.setTarget(percent / 100D);
|
||||||
|
this.markChanged();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((PREFIX_FUNCTION + "extendrods").equals(name) && params.length > 0) {
|
||||||
|
int percent = IRORInteractive.parseInt(params[0], -100, 100);
|
||||||
|
this.setTarget(MathHelper.clamp_double(this.targetLevel + percent / 100D, 0D, 1D));
|
||||||
|
this.markChanged();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTarget(double target) {
|
||||||
|
this.targetLevel = target;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -193,8 +193,13 @@ public class TileEntityPileCore extends TileEntityTickingBase {
|
|||||||
|
|
||||||
if(!worldObj.isRemote) {
|
if(!worldObj.isRemote) {
|
||||||
|
|
||||||
if(worldObj.getTotalWorldTime() % 3 == 0) for(PileChannel chan : this.ventilationChannels) {
|
for(PileChannel chan : this.ventilationChannels) {
|
||||||
if(chan.air <= 0) continue;
|
if(chan.air <= 0) continue;
|
||||||
|
|
||||||
|
int toUse = (int) Math.ceil(chan.air * 5D / 1_000);
|
||||||
|
chan.air -= toUse;
|
||||||
|
|
||||||
|
if(worldObj.getTotalWorldTime() % 3 != 0) continue;
|
||||||
|
|
||||||
double x = chan.entry.getX() + 0.5 + chan.entry.getDir().offsetX * (this.width - 0.375);
|
double x = chan.entry.getX() + 0.5 + chan.entry.getDir().offsetX * (this.width - 0.375);
|
||||||
double y = chan.entry.getY() + 0.5;
|
double y = chan.entry.getY() + 0.5;
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import com.hbm.inventory.fluid.Fluids;
|
|||||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||||
import com.hbm.tileentity.TileEntityTickingBase;
|
import com.hbm.tileentity.TileEntityTickingBase;
|
||||||
import com.hbm.tileentity.machine.pile.TileEntityPileCore.PileChannel;
|
import com.hbm.tileentity.machine.pile.TileEntityPileCore.PileChannel;
|
||||||
|
import com.hbm.util.BobMathUtil;
|
||||||
import com.hbm.util.Compat;
|
import com.hbm.util.Compat;
|
||||||
|
|
||||||
import api.hbm.fluidmk2.IFluidStandardReceiverMK2;
|
import api.hbm.fluidmk2.IFluidStandardReceiverMK2;
|
||||||
@ -25,7 +26,7 @@ public class TileEntityPileVent extends TileEntityTickingBase implements IFluidS
|
|||||||
public int chanNum;
|
public int chanNum;
|
||||||
|
|
||||||
public TileEntityPileVent() {
|
public TileEntityPileVent() {
|
||||||
this.compair = new FluidTank(Fluids.AIR, 4_000);
|
this.compair = new FluidTank(Fluids.AIR, 4_000).withPressure(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public FluidTank[] getAllTanks() { return new FluidTank[] {compair}; }
|
@Override public FluidTank[] getAllTanks() { return new FluidTank[] {compair}; }
|
||||||
@ -35,7 +36,7 @@ public class TileEntityPileVent extends TileEntityTickingBase implements IFluidS
|
|||||||
public boolean canConnect(FluidType type, ForgeDirection dir) {
|
public boolean canConnect(FluidType type, ForgeDirection dir) {
|
||||||
if(type != compair.getTankType()) return false;
|
if(type != compair.getTankType()) return false;
|
||||||
ForgeDirection conDir = getOrientation();
|
ForgeDirection conDir = getOrientation();
|
||||||
return dir == conDir.getOpposite();
|
return dir == conDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -44,17 +45,17 @@ public class TileEntityPileVent extends TileEntityTickingBase implements IFluidS
|
|||||||
if(!worldObj.isRemote) {
|
if(!worldObj.isRemote) {
|
||||||
|
|
||||||
ForgeDirection dir = getOrientation();
|
ForgeDirection dir = getOrientation();
|
||||||
this.trySubscribe(compair.getTankType(), worldObj, xCoord - dir.offsetX, yCoord, zCoord - dir.offsetZ, dir.getOpposite());
|
this.trySubscribe(compair.getTankType(), worldObj, xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ, dir);
|
||||||
|
|
||||||
this.isActive = false;
|
this.isActive = false;
|
||||||
|
|
||||||
if(this.compair.getFill() > 0) {
|
if(this.compair.getFill() > 0) {
|
||||||
int x = xCoord + dir.offsetX;
|
int x = xCoord - dir.offsetX;
|
||||||
int y = yCoord;
|
int y = yCoord;
|
||||||
int z = zCoord + dir.offsetZ;
|
int z = zCoord - dir.offsetZ;
|
||||||
|
|
||||||
if(worldObj.getBlock(x, y, z) == ModBlocks.pile_block && worldObj.getBlockMetadata(x, y, z) == BlockPile.META_AIR_IN) {
|
if(worldObj.getBlock(x, y, z) == ModBlocks.pile_block && worldObj.getBlockMetadata(x, y, z) == BlockPile.META_AIR_IN) {
|
||||||
TileEntity tile = Compat.getTileStandard(worldObj, xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ);
|
TileEntity tile = Compat.getTileStandard(worldObj, x, y, z);
|
||||||
|
|
||||||
if(tile instanceof TileEntityPileBaseMK2) {
|
if(tile instanceof TileEntityPileBaseMK2) {
|
||||||
TileEntityPileBaseMK2 pile = (TileEntityPileBaseMK2) tile;
|
TileEntityPileBaseMK2 pile = (TileEntityPileBaseMK2) tile;
|
||||||
@ -66,7 +67,9 @@ public class TileEntityPileVent extends TileEntityTickingBase implements IFluidS
|
|||||||
if(ventChan != null) {
|
if(ventChan != null) {
|
||||||
this.isActive = true;
|
this.isActive = true;
|
||||||
this.chanNum = core.getVentilationChannelNum(ventChan);
|
this.chanNum = core.getVentilationChannelNum(ventChan);
|
||||||
// compair stuff here
|
int toFill = BobMathUtil.min(compair.getFill(), 1_000 - ventChan.air);
|
||||||
|
ventChan.air += toFill;
|
||||||
|
this.compair.setFill(this.compair.getFill() - toFill);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Loading…
x
Reference in New Issue
Block a user