feat: crucible improvements
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Timo Ley 2022-11-25 16:26:42 +01:00
parent 491360a906
commit 05dfb876ce
2 changed files with 78 additions and 4 deletions

View file

@ -19,8 +19,6 @@
## Crucible
- Old Crucible crafting
- No Flux goo & gas
- No boiling down to primal aspects
## Config
- Config options for many things

View file

@ -6,6 +6,8 @@ import org.spongepowered.asm.mixin.Shadow;
import dev.tilera.auracore.api.IAlembic;
import dev.tilera.auracore.aura.AuraManager;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidTank;
@ -25,6 +27,21 @@ public abstract class MixinTileCrucible extends TileThaumcraft implements IAspec
public AspectList aspects;
@Shadow(remap = false)
public FluidTank tank;
@Shadow(remap = false)
int bellows;
@Shadow(remap = false)
private long counter;
@Shadow(remap = false)
public abstract AspectList takeRandomFromSource();
@Shadow(remap = false)
public abstract void getBellows();
@Shadow(remap = false)
public abstract int tagAmount();
@Shadow(remap = false)
abstract void drawEffects();
boolean spillNextTick = false;
/**
* @author tilera
@ -85,6 +102,65 @@ public abstract class MixinTileCrucible extends TileThaumcraft implements IAspec
}
/**
* @author tilera
* @reason Flux to aura & no aspect boiling down
*/
@Overwrite
public void updateEntity() {
++this.counter;
int prevheat = this.heat;
if (!super.worldObj.isRemote) {
if (this.bellows < 0) {
this.getBellows();
}
if (this.spillNextTick) {
this.spillRemnants();
this.spillNextTick = false;
this.getBellows();
}
if (this.tank.getFluidAmount() <= 0) {
if (this.heat > 0) {
--this.heat;
}
} else {
Material mat = super.worldObj.getBlock(super.xCoord, super.yCoord - 1, super.zCoord).getMaterial();
Block bi = super.worldObj.getBlock(super.xCoord, super.yCoord - 1, super.zCoord);
int md = super.worldObj.getBlockMetadata(super.xCoord, super.yCoord - 1, super.zCoord);
if (mat != Material.lava && mat != Material.fire && (bi != ConfigBlocks.blockAiry || md != 1)) {
if (this.heat > 0) {
--this.heat;
if (this.heat == 149) {
this.markDirty();
super.worldObj.markBlockForUpdate(super.xCoord, super.yCoord, super.zCoord);
}
}
} else if (this.heat < 200) {
this.heat = (short)(this.heat + 1 + this.bellows * 2);
if (prevheat < 151 && this.heat >= 151) {
this.markDirty();
super.worldObj.markBlockForUpdate(super.xCoord, super.yCoord, super.zCoord);
}
}
}
if (this.tagAmount() > 500 && this.counter % 5L == 0L) {
AspectList tt = this.takeRandomFromSource();
AuraManager.addFluxToClosest(this.worldObj, this.xCoord, this.yCoord, this.zCoord, tt);
if (this.tagAmount() <= 500) {
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}
}
} else if (this.tank.getFluidAmount() > 0) {
this.drawEffects();
}
if (super.worldObj.isRemote && prevheat < 151 && this.heat >= 151) {
++this.heat;
}
}
/**
* @author tilera
* @reason Implement aspect container properly
@ -93,7 +169,7 @@ public abstract class MixinTileCrucible extends TileThaumcraft implements IAspec
public boolean takeFromContainer(Aspect tag, int amount) {
if (this.aspects.getAmount(tag) >= amount) {
this.aspects.reduce(tag, amount);
//this.spillNextTick = true;
this.spillNextTick = true;
this.markDirty();
super.worldObj.markBlockForUpdate(super.xCoord, super.yCoord, super.zCoord);
return true;
@ -110,7 +186,7 @@ public abstract class MixinTileCrucible extends TileThaumcraft implements IAspec
if (this.doesContainerContain(ot)) {
for (Aspect tag : ot.getAspects()) {
this.aspects.reduce(tag, ot.getAmount(tag));
//this.spillNextTick = true;
this.spillNextTick = true;
this.markDirty();
super.worldObj.markBlockForUpdate(super.xCoord, super.yCoord, super.zCoord);
}