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

Queezer #23

Merged
merged 6 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -9,6 +9,7 @@
import net.minecraft.block.state.IBlockState;

import com.zorbatron.zbgt.api.ZBGTAPI;
import com.zorbatron.zbgt.api.util.ZBGTMods;
import com.zorbatron.zbgt.common.block.blocks.CoALCasing;
import com.zorbatron.zbgt.common.block.blocks.PreciseCasing;

Expand Down Expand Up @@ -117,6 +118,24 @@ public static TraceabilityPredicate machineCasings() {
return MACHINE_CASING_PREDICATE.get();
}

public static TraceabilityPredicate AIR_BLOCKS_COUNTED = new TraceabilityPredicate(
blockWorldState -> {
boolean isAirBlock = blockWorldState.getBlockState().getBlock().isAir(blockWorldState.getBlockState(),
blockWorldState.getWorld(), blockWorldState.getPos());

if (isAirBlock) {
blockWorldState.getMatchContext().getOrPut("AirBlocks", new LinkedList<>())
.add(blockWorldState.getPos());
return true;
}

return false;
});

public static TraceabilityPredicate airBlockWithCount() {
return AIR_BLOCKS_COUNTED;
}

public static TraceabilityPredicate autoBusesAndHatches(RecipeMap<?>[] recipeMaps) {
boolean checkedItemIn = false, checkedItemOut = false, checkedFluidIn = false, checkedFluidOut = false;
TraceabilityPredicate predicate = new TraceabilityPredicate();
Expand Down Expand Up @@ -155,13 +174,17 @@ public static TraceabilityPredicate autoBusesAndHatches(RecipeMap<?> recipeMap)
return autoBusesAndHatches(new RecipeMap<?>[] { recipeMap });
}

public static TraceabilityPredicate maintenanceHatch(MultiblockControllerBase controller) {
public static TraceabilityPredicate maintenanceOrParallel(MultiblockControllerBase controller) {
TraceabilityPredicate predicate = new TraceabilityPredicate(
abilities(MultiblockAbility.MAINTENANCE_HATCH).setExactLimit(1));

if (controller instanceof IParallelMultiblock) {
predicate = predicate
.or(abilities(GCYMMultiblockAbility.PARALLEL_HATCH).setMaxGlobalLimited(1).setPreviewCount(1));
// Check if GYCM is loaded before checking if the controller is an IParallelMultiblock because if it isn't bad
// stuff will happen
if (ZBGTMods.GCYM.isModLoaded()) {
if (controller instanceof IParallelMultiblock) {
predicate = predicate
.or(abilities(GCYMMultiblockAbility.PARALLEL_HATCH).setMaxGlobalLimited(1).setPreviewCount(1));
}
}

return predicate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import com.zorbatron.zbgt.api.util.ZBGTMods;
import com.zorbatron.zbgt.common.metatileentities.multi.electric.*;
import com.zorbatron.zbgt.common.metatileentities.multi.electric.megamultis.*;
import com.zorbatron.zbgt.common.metatileentities.multi.electric.quads.MetaTileEntityQuadEBF;
import com.zorbatron.zbgt.common.metatileentities.multi.electric.quads.MetaTileEntityQueezer;
import com.zorbatron.zbgt.common.metatileentities.multi.multiblockpart.*;
import com.zorbatron.zbgt.common.metatileentities.storage.MetaTileEntityCreativeComputationProvider;

Expand All @@ -30,9 +32,12 @@ public class ZBGTMetaTileEntities {
public static MetaTileEntityMegaOCU MEGA_OCU;
public static MetaTileEntityMegaABS MEGA_ABS;
public static MetaTileEntityPreciseAssembler PRASS;
public static MetaTileEntityQuadEBF QUAD_EBF;

public static MetaTileEntityCoAL CoAL;

public static MetaTileEntityQuadEBF QUAD_EBF;
public static MetaTileEntityQueezer QUEEZER;

public static void init() {
// 18000-18049 (50) reserved for multiblock parts
CREATIVE_ENERGY_SOURCE = registerMetaTileEntity(18000,
Expand Down Expand Up @@ -105,5 +110,7 @@ public static void init() {

QUAD_EBF = registerMetaTileEntity(18057,
new MetaTileEntityQuadEBF(zbgtId("quad_ebf")));
QUEEZER = registerMetaTileEntity(18058,
new MetaTileEntityQueezer(zbgtId("queezer")));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ protected BlockPattern createStructurePattern() {
.where('P', states(getPipeCasingState()))
.where('C', states(getCasingState()).setMinGlobalLimited(630)
.or(autoEnergyInputs())
.or(maintenanceHatch(this))
.or(maintenanceOrParallel(this))
.or(autoBusesAndHatches(getRecipeMap()))
.or(abilities(MultiblockAbility.COMPUTATION_DATA_RECEPTION)
.setExactLimit(1)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.zorbatron.zbgt.api.render.ZBGTTextures;
import com.zorbatron.zbgt.common.ZBGTMetaTileEntities;

import gregicality.multiblocks.api.metatileentity.GCYMMultiblockAbility;
import gregicality.multiblocks.api.recipes.GCYMRecipeMaps;
import gregicality.multiblocks.api.render.GCYMTextures;
import gregicality.multiblocks.common.block.GCYMMetaBlocks;
Expand Down Expand Up @@ -127,9 +126,8 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) {
.where('G', states(getGlassState()))
.where('M', abilities(MultiblockAbility.MUFFLER_HATCH))
.where('C', heatingCoils())
.where('W', abilities(MultiblockAbility.MAINTENANCE_HATCH).setMinGlobalLimited(1).setMaxGlobalLimited(1)
.or(abilities(GCYMMultiblockAbility.PARALLEL_HATCH).setMaxGlobalLimited(1).setPreviewCount(1))
.or(states(getCasingState())))
.where('W', states(getCasingState())
.or(TraceabilityPredicates.maintenanceOrParallel(this)))
.where('#', air())
.build();
}
Expand Down Expand Up @@ -243,11 +241,13 @@ protected void addDisplayText(List<ITextComponent> textList) {
.addProgressLine(recipeMapWorkable.getProgressPercent());
}

@SideOnly(Side.CLIENT)
@Override
public ICubeRenderer getBaseTexture(IMultiblockPart iMultiblockPart) {
return GCYMTextures.BLAST_CASING;
}

@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable World player, @NotNull List<String> tooltip,
boolean advanced) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ public SoundEvent getBreakdownSound() {
return GTSoundEvents.BREAKDOWN_ELECTRICAL;
}

@SideOnly(Side.CLIENT)
@Override
public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) {
return Textures.HEAT_PROOF_CASING;
Expand All @@ -318,6 +319,7 @@ public List<ITextComponent> getDataInfo() {
return list;
}

@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable World player, List<String> tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) {
return Textures.INERT_PTFE_CASING;
}

@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable World player, List<String> tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public List<MultiblockShapeInfo> getMatchingShapes() {
return shapeInfo;
}

@SideOnly(Side.CLIENT)
@Override
public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) {
return Textures.CLEAN_STAINLESS_STEEL_CASING;
Expand All @@ -157,6 +158,7 @@ public boolean canBeDistinct() {
return true;
}

@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable World player, List<String> tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ protected IBlockState getCasingState() {
return MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.ALUMINIUM_FROSTPROOF);
}

@SideOnly(Side.CLIENT)
@Override
public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) {
return Textures.FROST_PROOF_CASING;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ protected ICubeRenderer getFrontOverlay() {
return Textures.DISPLAY;
}

@SideOnly(Side.CLIENT)
@Override
public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) {
return getPreciseCasingTier() == -1 ? ZBGTTextures.PRECISE_CASING_1 :
Expand Down Expand Up @@ -267,6 +268,7 @@ public boolean checkRecipe(@NotNull Recipe recipe, boolean consumeIfSuccess) {
return getRecipeMapIndex() == supposedRecipeMap;
}

@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable World player, List<String> tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.zorbatron.zbgt.common.metatileentities.multi.electric;
package com.zorbatron.zbgt.common.metatileentities.multi.electric.quads;

import java.util.ArrayList;
import java.util.Comparator;
Expand Down Expand Up @@ -116,6 +116,7 @@ public List<MultiblockShapeInfo> getMatchingShapes() {
return shapeInfo;
}

@SideOnly(Side.CLIENT)
@Override
public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) {
return Textures.HEAT_PROOF_CASING;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package com.zorbatron.zbgt.common.metatileentities.multi.electric.quads;

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

import net.minecraft.block.state.IBlockState;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import org.jetbrains.annotations.NotNull;

import com.zorbatron.zbgt.api.pattern.TraceabilityPredicates;

import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
import gregtech.api.metatileentity.multiblock.IMultiblockPart;
import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController;
import gregtech.api.pattern.BlockPattern;
import gregtech.api.pattern.FactoryBlockPattern;
import gregtech.api.recipes.RecipeMaps;
import gregtech.client.renderer.ICubeRenderer;
import gregtech.client.renderer.texture.Textures;
import gregtech.common.blocks.BlockMetalCasing;
import gregtech.common.blocks.MetaBlocks;
import gregtech.core.sound.GTSoundEvents;

public class MetaTileEntityQueezer extends RecipeMapMultiblockController {

public MetaTileEntityQueezer(ResourceLocation metaTileEntityId) {
super(metaTileEntityId, RecipeMaps.VACUUM_RECIPES);
this.recipeMapWorkable.setParallelLimit(4);
}

@Override
public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) {
return new MetaTileEntityQueezer(metaTileEntityId);
}

@Override
protected @NotNull BlockPattern createStructurePattern() {
return FactoryBlockPattern.start(RIGHT, FRONT, DOWN)
.aisle("XXXXX", "XXXXX", "XXXXX", "XXXXX", "XXXXX")
.aisle("XXSXX", "X#X#X", "XXXXX", "X#X#X", "XXXXX")
.aisle("XXXXX", "XXXXX", "XXXXX", "XXXXX", "XXXXX")
.where('S', selfPredicate())
.where('X', states(getCasingState())
.or(TraceabilityPredicates.autoBusesAndHatches(getRecipeMap()))
.or(TraceabilityPredicates.autoEnergyInputs(1, 8))
.or(TraceabilityPredicates.maintenanceOrParallel(this)))
.where('#', air())
.build();
}

protected IBlockState getCasingState() {
return MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.ALUMINIUM_FROSTPROOF);
}

@Override
public SoundEvent getBreakdownSound() {
return GTSoundEvents.BREAKDOWN_ELECTRICAL;
}

@SideOnly(Side.CLIENT)
@Override
public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) {
return Textures.FROST_PROOF_CASING;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.IFluidTank;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemStackHandler;

Expand Down Expand Up @@ -198,6 +200,7 @@ private Consumer<List<ITextComponent>> getFluidAmountText(TankWidget tankWidget)
};
}

@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, boolean advanced) {
tooltip.add(I18n.format("zbgt.machine.air_intake_universal.rate", this.fillAmount, this.tickRate));
Expand All @@ -213,6 +216,7 @@ public void registerAbilities(List<IFluidTank> abilityList) {
abilityList.add(fluidTank);
}

@SideOnly(Side.CLIENT)
public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) {
super.renderMetaTileEntity(renderState, translation, pipeline);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -67,6 +69,7 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) {
return new MetaTileEntityCreativeEnergyHatch(metaTileEntityId, isExportHatch);
}

@SideOnly(Side.CLIENT)
@Override
public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) {
super.renderMetaTileEntity(renderState, translation, pipeline);
Expand All @@ -84,6 +87,7 @@ public void addToMultiBlock(MultiblockControllerBase controllerBase) {
controllerBase instanceof MetaTileEntityActiveTransformer);
}

@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, boolean advanced) {
tooltip.add(I18n.format("gregtech.creative_tooltip.1") + TooltipHelper.RAINBOW +
Expand All @@ -93,6 +97,7 @@ public void addInformation(ItemStack stack, @Nullable World world, List<String>
tooltip.add(I18n.format("gregtech.universal.enabled"));
}

@SideOnly(Side.CLIENT)
@Override
public void addToolUsages(ItemStack stack, @Nullable World world, List<String> tooltip, boolean advanced) {
tooltip.add(I18n.format("gregtech.tool_action.screwdriver.access_covers"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidTank;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemStackHandler;

Expand Down Expand Up @@ -109,6 +111,7 @@ public void update() {
}
}

@SideOnly(Side.CLIENT)
@Override
public void renderMetaTileEntity(CCRenderState renderState, @NotNull Matrix4 translation,
IVertexOperation[] pipeline) {
Expand Down Expand Up @@ -144,6 +147,7 @@ protected IItemHandlerModifiable createExportItemHandler() {
return new ItemStackHandler(1);
}

@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable World player, @NotNull List<String> tooltip,
boolean advanced) {
Expand All @@ -153,6 +157,7 @@ public void addInformation(ItemStack stack, @Nullable World player, @NotNull Lis
tooltip.add(I18n.format("gregtech.universal.enabled"));
}

@SideOnly(Side.CLIENT)
@Override
public void addToolUsages(ItemStack stack, @Nullable World world, List<String> tooltip, boolean advanced) {
tooltip.add(I18n.format("gregtech.tool_action.screwdriver.access_covers"));
Expand Down
Loading