mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-08-10 17:55:44 +00:00
now we're cooking with fire
This commit is contained in:
parent
c052fa7be1
commit
fa6f54f01a
@ -52,6 +52,7 @@ public class BlockPile extends BlockContainer implements IBlockCT, IToolable {
|
||||
@SideOnly(Side.CLIENT) public CTStitchReceiver recChanIn;
|
||||
@SideOnly(Side.CLIENT) public CTStitchReceiver recChanOut;
|
||||
@SideOnly(Side.CLIENT) public CTStitchReceiver recCon;
|
||||
@SideOnly(Side.CLIENT) public CTStitchReceiver recCore;
|
||||
|
||||
@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.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.recCore = IBlockCT.primeReceiver(reg, RefStrings.MODID + ":pile_block_core", this.iconTop);
|
||||
}
|
||||
|
||||
@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(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_CORE) return recCore.fragCache;
|
||||
return rec.fragCache;
|
||||
}
|
||||
|
||||
|
||||
@ -17,7 +17,9 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
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;
|
||||
|
||||
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 == 1) world.setBlockMetadataWithNotify(x, y, z, BLOCK_META_CONTROL + 2, 2);
|
||||
if(i == 2) world.setBlockMetadataWithNotify(x, y, z, BLOCK_META_CONTROL + 0, 2);
|
||||
if(i == 3) world.setBlockMetadataWithNotify(x, y, z, BLOCK_META_CONTROL + 3, 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 + 3, 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 + 2, 2);
|
||||
}
|
||||
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.hbm.render.tileentity;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.tileentity.machine.pile.TileEntityPileControl;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@ -23,9 +24,12 @@ public class RenderPileControl extends TileEntitySpecialRenderer {
|
||||
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);
|
||||
ResourceManager.pile_control.renderPart("Base");
|
||||
GL11.glTranslated(0, 0.5, 0);
|
||||
GL11.glTranslated(0, level * 0.75, 0);
|
||||
ResourceManager.pile_control.renderPart("Rod");
|
||||
|
||||
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.util.Compat;
|
||||
|
||||
import api.hbm.redstoneoverradio.IRORInteractive;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
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 level;
|
||||
@ -17,6 +20,10 @@ public class TileEntityPileControl extends TileEntityTickingBase {
|
||||
|
||||
public int turnProgress;
|
||||
|
||||
public double targetLevel;
|
||||
public static final double SPEED = 1D / 60D; // full traverse takes 3s
|
||||
public boolean wasRedstone;
|
||||
|
||||
public int chanNum;
|
||||
|
||||
@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);
|
||||
|
||||
} else {
|
||||
@ -77,4 +102,36 @@ public class TileEntityPileControl extends TileEntityTickingBase {
|
||||
|
||||
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.getTotalWorldTime() % 3 == 0) for(PileChannel chan : this.ventilationChannels) {
|
||||
for(PileChannel chan : this.ventilationChannels) {
|
||||
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 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.tileentity.TileEntityTickingBase;
|
||||
import com.hbm.tileentity.machine.pile.TileEntityPileCore.PileChannel;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.Compat;
|
||||
|
||||
import api.hbm.fluidmk2.IFluidStandardReceiverMK2;
|
||||
@ -25,7 +26,7 @@ public class TileEntityPileVent extends TileEntityTickingBase implements IFluidS
|
||||
public int chanNum;
|
||||
|
||||
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}; }
|
||||
@ -35,7 +36,7 @@ public class TileEntityPileVent extends TileEntityTickingBase implements IFluidS
|
||||
public boolean canConnect(FluidType type, ForgeDirection dir) {
|
||||
if(type != compair.getTankType()) return false;
|
||||
ForgeDirection conDir = getOrientation();
|
||||
return dir == conDir.getOpposite();
|
||||
return dir == conDir;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -44,17 +45,17 @@ public class TileEntityPileVent extends TileEntityTickingBase implements IFluidS
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
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;
|
||||
|
||||
if(this.compair.getFill() > 0) {
|
||||
int x = xCoord + dir.offsetX;
|
||||
int x = xCoord - dir.offsetX;
|
||||
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) {
|
||||
TileEntity tile = Compat.getTileStandard(worldObj, xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ);
|
||||
TileEntity tile = Compat.getTileStandard(worldObj, x, y, z);
|
||||
|
||||
if(tile instanceof TileEntityPileBaseMK2) {
|
||||
TileEntityPileBaseMK2 pile = (TileEntityPileBaseMK2) tile;
|
||||
@ -66,7 +67,9 @@ public class TileEntityPileVent extends TileEntityTickingBase implements IFluidS
|
||||
if(ventChan != null) {
|
||||
this.isActive = true;
|
||||
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