obj util better color multiplication, an affront to god

This commit is contained in:
Bob 2022-04-24 00:01:53 +02:00
parent 5f1c5cc5ba
commit 98b0f46afe
15 changed files with 78 additions and 15 deletions

View File

@ -43,8 +43,14 @@ public class FluidDuctBase extends BlockContainer implements IBlockFluidDuct {
}
}
} else {
changeTypeRecursively(world, x, y, z, type, 64);
return true;
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof TileEntityPipeBaseNT) {
TileEntityPipeBaseNT pipe = (TileEntityPipeBaseNT) te;
changeTypeRecursively(world, x, y, z, pipe.getType(), type, 64);
return true;
}
}
}
@ -52,14 +58,14 @@ public class FluidDuctBase extends BlockContainer implements IBlockFluidDuct {
}
@Override
public void changeTypeRecursively(World world, int x, int y, int z, FluidType type, int loopsRemaining) {
public void changeTypeRecursively(World world, int x, int y, int z, FluidType prevType, FluidType type, int loopsRemaining) {
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof TileEntityPipeBaseNT) {
TileEntityPipeBaseNT pipe = (TileEntityPipeBaseNT) te;
if(pipe.getType() != type) {
if(pipe.getType() == prevType && pipe.getType() != type) {
pipe.setType(type);
if(loopsRemaining > 0) {
@ -67,7 +73,7 @@ public class FluidDuctBase extends BlockContainer implements IBlockFluidDuct {
Block b = world.getBlock(x, y, z);
if(b instanceof IBlockFluidDuct) {
((IBlockFluidDuct) b).changeTypeRecursively(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, type, loopsRemaining - 1);
((IBlockFluidDuct) b).changeTypeRecursively(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, prevType, type, loopsRemaining - 1);
}
}
}

View File

@ -6,5 +6,5 @@ import net.minecraft.world.World;
public interface IBlockFluidDuct {
public void changeTypeRecursively(World world, int x, int y, int z, FluidType type, int loopsRemaining);
public void changeTypeRecursively(World world, int x, int y, int z, FluidType prevType, FluidType type, int loopsRemaining);
}

View File

@ -63,6 +63,8 @@ public class FluidContainerRegistry {
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.iv_xp), new ItemStack(ModItems.iv_xp_empty), Fluids.XPJUICE, 100));
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(Items.experience_bottle), new ItemStack(Items.glass_bottle), Fluids.XPJUICE, 100));
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.can_mug), new ItemStack(ModItems.can_empty), Fluids.MUG, 100));
FluidType[] fluids = Fluids.getAll();
for(int i = 1; i < fluids.length; i++) {

View File

@ -51,7 +51,7 @@ public class GUIHadron extends GuiInfoContainer {
List<String> stats = new ArrayList();
stats.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("hadron.stats"));
stats.add((hadron.stat_success ? EnumChatFormatting.GREEN : EnumChatFormatting.RED) + I18n.format("hadron." + this.hadron.state.name().toLowerCase()));
stats.add((hadron.stat_success ? EnumChatFormatting.GREEN : EnumChatFormatting.RED) + I18n.format("hadron." + this.hadron.stat_state.name().toLowerCase()));
if(this.hadron.state.showCoord) stats.add(EnumChatFormatting.RED + I18nUtil.resolveKey("hadron.stats_coord", hadron.stat_x, hadron.stat_y, hadron.stat_z));
stats.add(EnumChatFormatting.GRAY + I18nUtil.resolveKey("hadron.stats_momentum", hadron.stat_charge));
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 41, guiTop + 92, 25, 11, mouseX, mouseY, stats.toArray(new String[0]));

View File

@ -125,20 +125,20 @@ public class HadronRecipes {
*/
public static ItemStack[] getOutput(ItemStack in1, ItemStack in2, int momentum, boolean analysisOnly) {
returnCode = EnumHadronState.NORESULT_WRONG_INGREDIENT;
for(HadronRecipe r : recipes) {
if((r.in1.isApplicable(in1) && r.in2.isApplicable(in2)) ||
(r.in1.isApplicable(in2) && r.in2.isApplicable(in1))) {
if(analysisOnly != r.analysisOnly) returnCode = EnumHadronState.NORESULT_WRONG_MODE;
if(analysisOnly && !r.analysisOnly) returnCode = EnumHadronState.NORESULT_WRONG_MODE;
if(momentum < r.momentum) returnCode = EnumHadronState.NORESULT_TOO_SLOW;
if(momentum >= r.momentum && analysisOnly == r.analysisOnly)
return new ItemStack[] {r.out1, r.out2};
}
}
returnCode = EnumHadronState.NORESULT_WRONG_INGREDIENT;
return null;
}

View File

@ -90,7 +90,7 @@ public class ObjUtil {
float brightness = 1.0F;
if(shadow) {
brightness = ((float)normal.yCoord + 0.7F) * 0.9F - (float)Math.abs(normal.xCoord) * 0.1F + (float)Math.abs(normal.zCoord) * 0.1F;
brightness = ((float)normal.yCoord * 0.3F + 0.7F) - (float)Math.abs(normal.xCoord) * 0.1F + (float)Math.abs(normal.zCoord) * 0.1F;
if(brightness < 0.45F)
brightness = 0.45F;

View File

@ -134,9 +134,9 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyUs
if(result == null) {
this.state = HadronRecipes.returnCode;
this.setStats(this.state, p.momentum, false);
this.delay = delayNoResult;
worldObj.playSoundEffect(p.posX, p.posY, p.posZ, "random.orb", 2, 0.5F);
this.setStats(this.state, p.momentum, false);
return;
}
@ -327,7 +327,7 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyUs
this.posY = posY;
this.posZ = posZ;
this.charge = 0;
this.charge = 750;
this.momentum = 0;
}
@ -345,7 +345,7 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyUs
TileEntityHadron.this.state = reason;
TileEntityHadron.this.delay = delayError;
TileEntityHadron.this.setExpireStats(reason, this.charge, posX, posY, posZ);
TileEntityHadron.this.setExpireStats(reason, this.momentum, posX, posY, posZ);
}
public boolean isExpired() {

View File

@ -102,6 +102,11 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements
this.updateConnections();
}
for(DirPos pos : getConPos()) {
if(tanks[2].getFill() > 0) this.sendFluid(tanks[2].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
if(tanks[3].getFill() > 0) this.sendFluid(tanks[3].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
UpgradeManager.eval(slots, 1, 3);
int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);

View File

@ -14,7 +14,9 @@ import com.hbm.inventory.recipes.RefineryRecipes;
import com.hbm.lib.Library;
import com.hbm.tileentity.INBTPacketReceiver;
import com.hbm.util.Tuple.Pair;
import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.fluid.IFluidStandardTransceiver;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.nbt.NBTTagCompound;
@ -22,7 +24,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMachineCatalyticCracker extends TileEntity implements IFluidSource, IFluidAcceptor, INBTPacketReceiver {
public class TileEntityMachineCatalyticCracker extends TileEntity implements IFluidSource, IFluidAcceptor, INBTPacketReceiver, IFluidStandardTransceiver {
public FluidTank[] tanks;
public List<IFluidAcceptor> list1 = new ArrayList();
@ -44,6 +46,7 @@ public class TileEntityMachineCatalyticCracker extends TileEntity implements IFl
if(!worldObj.isRemote) {
setupTanks();
updateConnections();
if(worldObj.getTotalWorldTime() % 20 == 0)
crack();
@ -53,6 +56,12 @@ public class TileEntityMachineCatalyticCracker extends TileEntity implements IFl
fillFluidInit(tanks[3].getTankType());
fillFluidInit(tanks[4].getTankType());
for(DirPos pos : getConPos()) {
for(int i = 2; i <= 4; i++) {
if(tanks[i].getFill() > 0) this.sendFluid(tanks[i].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
}
NBTTagCompound data = new NBTTagCompound();
for(int i = 0; i < 5; i++)
@ -69,6 +78,14 @@ public class TileEntityMachineCatalyticCracker extends TileEntity implements IFl
tanks[i].readFromNBT(nbt, "tank" + i);
}
private void updateConnections() {
for(DirPos pos : getConPos()) {
this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
this.trySubscribe(tanks[1].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
}
private void crack() {
Pair<FluidStack, FluidStack> quart = RefineryRecipes.getCracking(tanks[0].getTankType());
@ -184,6 +201,23 @@ public class TileEntityMachineCatalyticCracker extends TileEntity implements IFl
fillFluid(xCoord - dir.offsetX * 2 + rot.offsetX * 3, yCoord, zCoord - dir.offsetZ * 2 + rot.offsetZ * 3, this.getTact(), type);
fillFluid(xCoord - dir.offsetX * 2 - rot.offsetX * 4, yCoord, zCoord - dir.offsetZ * 2 - rot.offsetZ * 4, this.getTact(), type);
}
protected DirPos[] getConPos() {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
return new DirPos[] {
new DirPos(xCoord + dir.offsetX * 4 + rot.offsetX * 1, yCoord, zCoord + dir.offsetZ * 4 + rot.offsetZ * 1, dir),
new DirPos(xCoord + dir.offsetX * 4 - rot.offsetX * 2, yCoord, zCoord + dir.offsetZ * 4 - rot.offsetZ * 2, dir),
new DirPos(xCoord - dir.offsetX * 4 + rot.offsetX * 1, yCoord, zCoord - dir.offsetZ * 4 + rot.offsetZ * 1, dir.getOpposite()),
new DirPos(xCoord - dir.offsetX * 4 - rot.offsetX * 2, yCoord, zCoord - dir.offsetZ * 4 - rot.offsetZ * 2, dir.getOpposite()),
new DirPos(xCoord + dir.offsetX * 2 + rot.offsetX * 3, yCoord, zCoord + dir.offsetZ * 2 + rot.offsetZ * 3, rot),
new DirPos(xCoord + dir.offsetX * 2 - rot.offsetX * 4, yCoord, zCoord + dir.offsetZ * 2 - rot.offsetZ * 4, rot),
new DirPos(xCoord - dir.offsetX * 2 + rot.offsetX * 3, yCoord, zCoord - dir.offsetZ * 2 + rot.offsetZ * 3, rot.getOpposite()),
new DirPos(xCoord - dir.offsetX * 2 - rot.offsetX * 4, yCoord, zCoord - dir.offsetZ * 2 - rot.offsetZ * 4, rot.getOpposite())
};
}
@Override
public void fillFluid(int x, int y, int z, boolean newTact, FluidType type) {
@ -234,4 +268,14 @@ public class TileEntityMachineCatalyticCracker extends TileEntity implements IFl
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
@Override
public FluidTank[] getSendingTanks() {
return new FluidTank[] {tanks[2], tanks[3], tanks[4]};
}
@Override
public FluidTank[] getReceivingTanks() {
return new FluidTank[] {tanks[0], tanks[1]};
}
}

View File

@ -3052,6 +3052,7 @@ tile.charge_c4.name=Abrissladung
tile.charge_dynamite.name=Zeitbombe
tile.charge_miner.name=Bergbauladung mit Zeitzünder
tile.charge_semtex.name=Semtex-Bergbauladung
tile.charger.name=Ladestation
tile.cheater_virus.name=Geliertes Euphemium
tile.cheater_virus_seed.name=Instabiler Euphemiumschrabid-Block
tile.chlorine_gas.name=Chlorgas
@ -3515,6 +3516,8 @@ tile.rbmk_control.name=RBMK Steuerstäbe
tile.rbmk_control_auto.name=RBMK Automatische Steuerstäbe
tile.rbmk_control_mod.name=RBMK Moderierte Steuerstäbe
tile.rbmk_crane_console.name=RBMK Kransteuerung
tile.rbmk_heater.name=RBMK-Heizer
tile.rbmk_heatex.name=RBMK-Wärmetauscher
tile.rbmk_loader.name=RBMK-Dampfadapter
tile.rbmk_moderator.name=RBMK Graphitmoderator
tile.rbmk_outgasser.name=RBMK Bestrahlungskanal

View File

@ -3425,6 +3425,7 @@ tile.charge_c4.name=Demolition Charge
tile.charge_dynamite.name=Time Bomb
tile.charge_miner.name=Timed Mining Charge
tile.charge_semtex.name=Semtex Mining Charge
tile.charger.name=Charging Station
tile.cheater_virus.name=Gelid Euphemium
tile.cheater_virus_seed.name=Unstable Euphemium Schrabide Block
tile.chlorine_gas.name=Chlorine Gas
@ -3889,6 +3890,8 @@ tile.rbmk_control.name=RBMK Control Rods
tile.rbmk_control_auto.name=RBMK Automatic Control Rods
tile.rbmk_control_mod.name=RBMK Moderated Control Rods
tile.rbmk_crane_console.name=RBMK Crane Console
tile.rbmk_heater.name=RBMK Fluid Heater
tile.rbmk_heatex.name=RBMK Heat Exchanger
tile.rbmk_loader.name=RBMK Steam Connector
tile.rbmk_moderator.name=RBMK Graphite Moderator
tile.rbmk_outgasser.name=RBMK Irradiation Channel

Binary file not shown.

Before

Width:  |  Height:  |  Size: 221 B

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 341 B

After

Width:  |  Height:  |  Size: 489 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B