Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incinerator multiblock #286

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public class SuSyMetaTileEntities {
public static MetaTileEntityEvaporationPool EVAPORATION_POOL;
public static int EVAPORATION_POOL_ID;
public static MetaTileEntityFlareStack FLARE_STACK;
public static MetaTileEntityIncinerator INCINERATOR;
public static MetaTileEntityFrothFlotationTank FROTH_FLOTATION_TANK;
public static MetaTileEntityMultiStageFlashDistiller MULTI_STAGE_FLASH_DISTILLER;

Expand Down Expand Up @@ -266,6 +267,7 @@ public static void init() {
registerSimpleMTE(ELECTROSTATIC_SEPARATOR, 12, 17035, "electrostatic_separator", SuSyRecipeMaps.ELECTROSTATIC_SEPARATOR, SusyTextures.ELECTROSTATIC_SEPARATOR_OVERLAY, true, GTUtility.defaultTankSizeFunction);
registerSimpleMTE(POLISHING_MACHINE, 12, 17048, "polishing_machine", SuSyRecipeMaps.POLISHING_MACHINE, SusyTextures.POLISHING_MACHINE_OVERLAY, true, GTUtility.defaultTankSizeFunction);
registerSimpleMTE(TEXTILE_SPINNER, 12, 17061, "textile_spinner", SuSyRecipeMaps.SPINNING_RECIPES, SusyTextures.TEXTILE_SPINNER_OVERLAY, true);
registerMetaTileEntity(17074, new MetaTileEntityIncinerator(susyId("incinerator")));
}

private static void registerSimpleSteamMTE(SuSySimpleSteamMetaTileEntity[] machines, int startId, String name, RecipeMap<?> recipeMap, SuSySteamProgressIndicator progressIndicator, ICubeRenderer texture, boolean isBricked) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidTank;

public abstract class VoidingMultiblockBase extends MultiblockWithDisplayBase {
public abstract class FluidVoidingMultiblockBase extends MultiblockWithDisplayBase {
// Update this value based on your needs
// For instance, if you want your glorified trashcan to be tiered
public int rateBonus = 1;
Expand All @@ -28,7 +28,7 @@ public abstract class VoidingMultiblockBase extends MultiblockWithDisplayBase {

public Object2BooleanOpenHashMap<Fluid> fluidCache = new Object2BooleanOpenHashMap<>();

public VoidingMultiblockBase(ResourceLocation metaTileEntityId) {
public FluidVoidingMultiblockBase(ResourceLocation metaTileEntityId) {
super(metaTileEntityId);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package supersymmetry.common.metatileentities.multi;

import gregtech.api.metatileentity.multiblock.MultiblockAbility;
import gregtech.api.metatileentity.multiblock.MultiblockWithDisplayBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.items.IItemHandlerModifiable;
import supersymmetry.Supersymmetry;

public abstract class ItemVoidingMultiblockBase extends MultiblockWithDisplayBase {
public final int voidingFrequency = 10;
public int bonusMultiplier = 1;
public boolean active = true;

public ItemVoidingMultiblockBase(ResourceLocation metaTileEntityId) {
super(metaTileEntityId);
}

public int baseVoidingRate() {
return 32;
}
private int actualVoidingRate() {
return baseVoidingRate() * this.bonusMultiplier;
}
protected void doVoiding() {
int toSubtract = actualVoidingRate();
for(IItemHandlerModifiable storage: getAbilities(MultiblockAbility.IMPORT_ITEMS)) {
for(int i = 0; i < storage.getSlots() && toSubtract > 0; i++) {
ItemStack stack = storage.getStackInSlot(i);
if(!stack.isEmpty()) {
ItemStack replaceWith = stack.copy();
The-Minecraft-Scientist marked this conversation as resolved.
Show resolved Hide resolved
int removeFromThisStack = Integer.min(stack.getCount(), toSubtract);
replaceWith.setCount(stack.getCount() - removeFromThisStack);
storage.setStackInSlot(i, replaceWith);
toSubtract -= removeFromThisStack;
}
}
}
}

@Override
protected void updateFormedValid() {
if(getWorld().isRemote) return;
if(getOffsetTimer() % voidingFrequency == 0) {
doVoiding();
}
}

@Override
public boolean isActive() {
return active;
}

@Override
public boolean hasMaintenanceMechanics() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import supersymmetry.client.renderer.textures.SusyTextures;
import supersymmetry.common.metatileentities.multi.VoidingMultiblockBase;
import supersymmetry.common.metatileentities.multi.FluidVoidingMultiblockBase;

import javax.annotation.Nonnull;
import java.util.List;

public class MetaTileEntityDumper extends VoidingMultiblockBase {
public class MetaTileEntityDumper extends FluidVoidingMultiblockBase {
public MetaTileEntityDumper(ResourceLocation metaTileEntityId) {
super(metaTileEntityId);
// Hardcode these annoyances for now
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import supersymmetry.client.renderer.textures.SusyTextures;
import supersymmetry.common.metatileentities.multi.VoidingMultiblockBase;
import supersymmetry.common.metatileentities.multi.FluidVoidingMultiblockBase;

import javax.annotation.Nonnull;
import java.util.List;

import static gregtech.api.util.RelativeDirection.*;

public class MetaTileEntityFlareStack extends VoidingMultiblockBase {
public class MetaTileEntityFlareStack extends FluidVoidingMultiblockBase {
// Storing this, just in case it is ever needed
private int height = 5;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package supersymmetry.common.metatileentities.multi.electric;

import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
import gregtech.api.metatileentity.multiblock.IMultiblockPart;
import gregtech.api.metatileentity.multiblock.MultiblockAbility;
import gregtech.api.metatileentity.multiblock.MultiblockWithDisplayBase;
import gregtech.api.pattern.BlockPattern;
import gregtech.api.pattern.FactoryBlockPattern;
import gregtech.api.unification.material.Materials;
import gregtech.client.renderer.ICubeRenderer;
import gregtech.client.renderer.texture.Textures;
import gregtech.common.blocks.*;
import net.minecraft.util.ResourceLocation;
import org.jetbrains.annotations.NotNull;
import supersymmetry.common.metatileentities.multi.ItemVoidingMultiblockBase;

public class MetaTileEntityIncinerator extends ItemVoidingMultiblockBase {
public MetaTileEntityIncinerator(ResourceLocation metaTileEntityId) {
super(metaTileEntityId);
}

@Override
protected @NotNull BlockPattern createStructurePattern() {
return FactoryBlockPattern.start()
//S: steel casing
//G: grate casing
//C: coil
//B: alu frame box
//F: steel firebox casing
//P: steel pipe casing
//M: muffler hatch
//I: self
.aisle("SSSSGS", "SSSCCC", " SSFFF", " SCCC", " BFB", " BFB", " B ", " B "," B ")
.aisle("SSSSGG", "S##G#C", "S##G#F", " SSC#C", " F#F", " F#F", " BPB", " BPB", " BMB")
.aisle("SSSSGS", "SSICCC", " SSFFF", " SCCC", " BFB", " BFB", " B ", " B "," B ")
.where('S', states(MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.STEEL_SOLID)).setMinGlobalLimited(28, 26).or(abilities(MultiblockAbility.IMPORT_ITEMS).setExactLimit(1)))
.where('G', states(MetaBlocks.MULTIBLOCK_CASING.getState(BlockMultiblockCasing.MultiblockCasingType.GRATE_CASING)))
.where('C', heatingCoils())
.where('B', states(MetaBlocks.FRAMES.get(Materials.Aluminium).getBlock(Materials.Aluminium)))
.where('F', states(MetaBlocks.BOILER_FIREBOX_CASING.getState(BlockFireboxCasing.FireboxCasingType.STEEL_FIREBOX)))
.where('P', states(MetaBlocks.BOILER_CASING.getState(BlockBoilerCasing.BoilerCasingType.STEEL_PIPE)))
.where('M', abilities(MultiblockAbility.MUFFLER_HATCH).setExactLimit(1))
.where('I', selfPredicate())
.where(' ', any())
.where('#', air())
.build();
}

@Override
public ICubeRenderer getBaseTexture(IMultiblockPart iMultiblockPart) {
return Textures.SOLID_STEEL_CASING;
}

@Override
public MetaTileEntity createMetaTileEntity(IGregTechTileEntity iGregTechTileEntity) {
return new MetaTileEntityIncinerator(this.metaTileEntityId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import supersymmetry.client.renderer.textures.SusyTextures;
import supersymmetry.common.metatileentities.multi.VoidingMultiblockBase;
import supersymmetry.common.metatileentities.multi.FluidVoidingMultiblockBase;

import javax.annotation.Nonnull;
import java.util.List;

import static gregtech.api.util.RelativeDirection.*;

public class MetaTileEntitySmokeStack extends VoidingMultiblockBase {
public class MetaTileEntitySmokeStack extends FluidVoidingMultiblockBase {
// Storing this, just in case it is ever needed
private int height = 5;

Expand Down