Skip to content

Commit

Permalink
Added consequences for failures
Browse files Browse the repository at this point in the history
  • Loading branch information
Zalgo239 committed Dec 23, 2023
1 parent aa31104 commit 77ec16d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,8 @@ public static void register() {
public static Material UUMatter;
public static Material PCBCoolant;

public static Material Corium;

/**
* Second Degree Compounds
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,13 @@ public static void register() {
.flags(FLAMMABLE)
.build();

// Free IDs 1560-1575
Corium = new Material.Builder(1560, gregtechId("corium"))
.liquid(new FluidBuilder().temperature(2500).block().density(8.0D))
.color(0x7A6B50)
.flags(NO_UNIFICATION, STICKY, GLOWING)
.build();

// Free IDs 1561-1575

LPG = new Material.Builder(1576, gregtechId("lpg"))
.liquid(new FluidBuilder().customStill())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import gregtech.api.pattern.FactoryBlockPattern;
import gregtech.api.unification.OreDictUnifier;
import gregtech.api.unification.material.Material;
import gregtech.api.unification.material.Materials;
import gregtech.api.unification.material.properties.FissionFuelProperty;
import gregtech.api.unification.material.properties.PropertyKey;
import gregtech.api.unification.ore.OrePrefix;
Expand All @@ -46,6 +47,10 @@
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;

import net.minecraftforge.fml.relauncher.Side;

import net.minecraftforge.fml.relauncher.SideOnly;

import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
Expand Down Expand Up @@ -132,17 +137,41 @@ protected void updateFormedValid() {
this.updateReactorState();

if (this.fissionReactor.checkForMeltdown()) {
// TODO Meltdown consequences
this.performMeltdownEffects();
}

if (this.fissionReactor.checkForExplosion()) {
// TODO Explosion consequences
this.performPrimaryExplosion();
if (this.fissionReactor.checkForSecondaryExplosion()) {
// TODO Secondary explosion consequences
this.performSecondaryExplosion();
}
}
}
}

protected void performMeltdownEffects() {
BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(this.getPos());
pos = pos.move(this.getFrontFacing().getOpposite(), Math.floorDiv(diameter, 2));
for (int i = 0; i <= this.heightBottom; i++) {
this.getWorld().setBlockState(pos.add(0, -i, 0), Materials.Corium.getFluid().getBlock().getDefaultState());
this.getWorld().setBlockState(pos.add(1, -i, 0), Materials.Corium.getFluid().getBlock().getDefaultState());
this.getWorld().setBlockState(pos.add(-1, -i, 0), Materials.Corium.getFluid().getBlock().getDefaultState());
this.getWorld().setBlockState(pos.add(0, -i, 1), Materials.Corium.getFluid().getBlock().getDefaultState());
this.getWorld().setBlockState(pos.add(0, -i, -1), Materials.Corium.getFluid().getBlock().getDefaultState());
}
this.getWorld().setBlockState(pos.add(0, 1, 0), Materials.Corium.getFluid().getBlock().getDefaultState());
}

protected void performPrimaryExplosion() {
BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(this.getPos());
pos = pos.move(this.getFrontFacing().getOpposite(), Math.floorDiv(diameter, 2));
this.getWorld().createExplosion(null, pos.getX(), pos.getY() + heightTop, pos.getZ(), 4.f, true);
}

protected void performSecondaryExplosion() {
BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(this.getPos());
pos = pos.move(this.getFrontFacing().getOpposite(), Math.floorDiv(diameter, 2));
this.getWorld().newExplosion(null, pos.getX(), pos.getY() + heightTop + 3, pos.getZ(), 10.f, true, true);
}

public boolean updateStructureDimensions() {
Expand Down Expand Up @@ -283,6 +312,7 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) {
return Textures.FISSION_REACTOR_TEXTURE;
}

@SideOnly(Side.CLIENT)
@NotNull
@Override
protected ICubeRenderer getFrontOverlay() {
Expand Down

0 comments on commit 77ec16d

Please sign in to comment.