Skip to content
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

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.gregtechceu.gtceu.api.machine.feature.multiblock;

import com.gregtechceu.gtceu.api.capability.IParallelHatch;
import com.gregtechceu.gtceu.api.machine.feature.IMachineFeature;
import com.gregtechceu.gtceu.api.machine.multiblock.MultiblockControllerMachine;
import com.gregtechceu.gtceu.api.machine.property.GTMachineModelProperties;
import com.gregtechceu.gtceu.api.pattern.BlockPattern;
import com.gregtechceu.gtceu.api.pattern.MultiblockState;
import com.gregtechceu.gtceu.common.machine.multiblock.part.ParallelHatchPartMachine;

import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
Expand Down Expand Up @@ -138,13 +138,13 @@ default BlockPattern getPattern() {
List<IMultiPart> getParts();

/**
* The instance of {@link IParallelHatch} attached to this Controller.
* The instance of {@link ParallelHatchPartMachine} attached to this Controller.
* <p>
* Note that this will return a singular instance, and will not account for multiple attached IParallelHatches
* Note that this will return a singular instance, and will not account for multiple attached ParallelHatches
*
* @return an {@link Optional} of the attached IParallelHatch, empty if one is not attached
* @return an {@link Optional} of the attached ParallelHatch, empty if one is not attached
*/
Optional<IParallelHatch> getParallelHatch();
Optional<ParallelHatchPartMachine> getParallelHatch();

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.gregtechceu.gtceu.api.block.MetaMachineBlock;
import com.gregtechceu.gtceu.api.block.property.GTBlockStateProperties;
import com.gregtechceu.gtceu.api.blockentity.BlockEntityCreationInfo;
import com.gregtechceu.gtceu.api.capability.IParallelHatch;
import com.gregtechceu.gtceu.api.machine.MetaMachine;
import com.gregtechceu.gtceu.api.machine.MultiblockMachineDefinition;
import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController;
Expand All @@ -18,6 +17,7 @@
import com.gregtechceu.gtceu.api.sync_system.annotations.SyncToClient;
import com.gregtechceu.gtceu.client.model.machine.MachineRenderState;
import com.gregtechceu.gtceu.client.renderer.MultiblockInWorldPreviewRenderer;
import com.gregtechceu.gtceu.common.machine.multiblock.part.ParallelHatchPartMachine;
import com.gregtechceu.gtceu.config.ConfigHolder;

import net.minecraft.MethodsReturnNonnullByDefault;
Expand Down Expand Up @@ -51,7 +51,7 @@ public class MultiblockControllerMachine extends MetaMachine implements IMultiCo

private MultiblockState multiblockState;
private final List<IMultiPart> parts = new ArrayList<>();
private @Nullable IParallelHatch parallelHatch = null;
private @Nullable ParallelHatchPartMachine parallelHatch = null;
@Getter
@SyncToClient
private BlockPos[] partPositions = new BlockPos[0];
Expand Down Expand Up @@ -140,7 +140,7 @@ public List<IMultiPart> getParts() {
}

@Override
public Optional<IParallelHatch> getParallelHatch() {
public Optional<ParallelHatchPartMachine> getParallelHatch() {
return Optional.ofNullable(parallelHatch);
}

Expand Down Expand Up @@ -188,7 +188,7 @@ public void onStructureFormed() {
}
this.parts.sort(getPartSorter());
for (var part : parts) {
if (part instanceof IParallelHatch pHatch) {
if (part instanceof ParallelHatchPartMachine pHatch) {
parallelHatch = pHatch;
}
part.addedToController(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.gregtechceu.gtceu.api.GTValues;
import com.gregtechceu.gtceu.api.blockentity.BlockEntityCreationInfo;
import com.gregtechceu.gtceu.api.capability.IEnergyContainer;
import com.gregtechceu.gtceu.api.capability.IParallelHatch;
import com.gregtechceu.gtceu.api.capability.recipe.EURecipeCapability;
import com.gregtechceu.gtceu.api.capability.recipe.IO;
import com.gregtechceu.gtceu.api.capability.recipe.IRecipeHandler;
Expand All @@ -20,6 +19,7 @@
import com.gregtechceu.gtceu.api.recipe.modifier.RecipeModifierList;
import com.gregtechceu.gtceu.api.sync_system.annotations.SaveField;
import com.gregtechceu.gtceu.common.data.GTRecipeModifiers;
import com.gregtechceu.gtceu.common.machine.multiblock.part.ParallelHatchPartMachine;
import com.gregtechceu.gtceu.utils.GTUtil;

import com.lowdragmc.lowdraglib.gui.modular.ModularUI;
Expand Down Expand Up @@ -109,7 +109,7 @@ public void addDisplayText(List<Component> textList) {
exact = true;
} else {
numParallels = getParallelHatch()
.map(IParallelHatch::getCurrentParallel)
.map(ParallelHatchPartMachine::getCurrentParallel)
.orElse(0);
subtickParallels = 0;
batchParallels = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.gregtechceu.gtceu.common.machine.multiblock.electric.research;

import com.gregtechceu.gtceu.api.blockentity.BlockEntityCreationInfo;
import com.gregtechceu.gtceu.api.capability.IObjectHolder;
import com.gregtechceu.gtceu.api.capability.IOpticalComputationProvider;
import com.gregtechceu.gtceu.api.capability.IOpticalComputationReceiver;
import com.gregtechceu.gtceu.api.capability.forge.GTCapability;
Expand All @@ -16,6 +15,7 @@
import com.gregtechceu.gtceu.api.recipe.ActionResult;
import com.gregtechceu.gtceu.api.recipe.GTRecipe;
import com.gregtechceu.gtceu.api.recipe.RecipeHelper;
import com.gregtechceu.gtceu.common.machine.multiblock.part.ObjectHolderMachine;

import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.network.chat.Component;
Expand All @@ -37,7 +37,7 @@ public class ResearchStationMachine extends WorkableElectricMultiblockMachine
@Getter
private IOpticalComputationProvider computationProvider;
@Getter
private IObjectHolder objectHolder;
private ObjectHolderMachine objectHolder;

public ResearchStationMachine(BlockEntityCreationInfo info) {
super(info, (m) -> new ResearchStationRecipeLogic((ResearchStationMachine) m));
Expand All @@ -52,12 +52,12 @@ public ResearchStationRecipeLogic getRecipeLogic() {
public void onStructureFormed() {
super.onStructureFormed();
for (IMultiPart part : getParts()) {
if (part instanceof IObjectHolder iObjectHolder) {
if (iObjectHolder.getFrontFacing() != getFrontFacing().getOpposite()) {
if (part instanceof ObjectHolderMachine objectHolder) {
if (objectHolder.getFrontFacing() != getFrontFacing().getOpposite()) {
onStructureInvalid();
return;
}
this.objectHolder = iObjectHolder;
this.objectHolder = objectHolder;
}

part.self()
Expand Down Expand Up @@ -85,7 +85,7 @@ public void onStructureInvalid() {
computationProvider = null;
// recheck the ability to make sure it wasn't the one broken
for (IMultiPart part : getParts()) {
if (part instanceof IObjectHolder holder) {
if (part instanceof ObjectHolderMachine holder) {
if (holder == objectHolder) {
objectHolder.setLocked(false);
}
Expand Down Expand Up @@ -178,14 +178,14 @@ protected ActionResult matchTickRecipeNoOutput(GTRecipe recipe) {
protected ActionResult handleRecipeIO(GTRecipe recipe, IO io) {
if (io == IO.IN) {
// lock the object holder on recipe start
IObjectHolder holder = getMachine().getObjectHolder();
ObjectHolderMachine holder = getMachine().getObjectHolder();
holder.setLocked(true);
return ActionResult.SUCCESS;
}

// "replace" the items in the slots rather than outputting elsewhere
// unlock the object holder
IObjectHolder holder = getMachine().getObjectHolder();
ObjectHolderMachine holder = getMachine().getObjectHolder();
if (lastRecipe == null) {
holder.setLocked(false);
return ActionResult.SUCCESS;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.gregtechceu.gtceu.common.machine.multiblock.part;

import com.gregtechceu.gtceu.api.blockentity.BlockEntityCreationInfo;
import com.gregtechceu.gtceu.api.capability.IObjectHolder;
import com.gregtechceu.gtceu.api.capability.recipe.IO;
import com.gregtechceu.gtceu.api.gui.GuiTextures;
import com.gregtechceu.gtceu.api.gui.widget.BlockableSlotWidget;
Expand Down Expand Up @@ -31,7 +30,7 @@

@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class ObjectHolderMachine extends MultiblockPartMachine implements IObjectHolder {
public class ObjectHolderMachine extends MultiblockPartMachine {

// purposefully not exposed to automation or capabilities
@SaveField
Expand All @@ -41,6 +40,9 @@ public class ObjectHolderMachine extends MultiblockPartMachine implements IObjec
@SyncToClient
private boolean isLocked;

@Getter
private NotifiableItemStackHandler handler;

public ObjectHolderMachine(BlockEntityCreationInfo info) {
super(info);
heldItems = new ObjectHolderHandler(this);
Expand All @@ -51,27 +53,22 @@ public void setLocked(boolean locked) {
syncDataHolder.markClientSyncFieldDirty("isLocked");
}

@Override
public @NotNull ItemStack getHeldItem(boolean remove) {
return getHeldItem(0, remove);
}

@Override
public void setHeldItem(@NotNull ItemStack heldItem) {
heldItems.setStackInSlot(0, heldItem);
}

@Override
public @NotNull ItemStack getDataItem(boolean remove) {
return getHeldItem(1, remove);
}

@Override
public void setDataItem(@NotNull ItemStack dataItem) {
heldItems.setStackInSlot(1, dataItem);
}

@Override
public @NotNull NotifiableItemStackHandler getAsHandler() {
return heldItems;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.gregtechceu.gtceu.api.GTValues;
import com.gregtechceu.gtceu.api.blockentity.BlockEntityCreationInfo;
import com.gregtechceu.gtceu.api.capability.IParallelHatch;
import com.gregtechceu.gtceu.api.gui.widget.IntInputWidget;
import com.gregtechceu.gtceu.api.machine.feature.IFancyUIMachine;
import com.gregtechceu.gtceu.api.machine.feature.IRecipeLogicMachine;
Expand All @@ -17,7 +16,7 @@

import lombok.Getter;

public class ParallelHatchPartMachine extends TieredPartMachine implements IFancyUIMachine, IParallelHatch {
public class ParallelHatchPartMachine extends TieredPartMachine implements IFancyUIMachine {

private static final int MIN_PARALLEL = 1;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.gregtechceu.gtceu.integration.jade.provider;

import com.gregtechceu.gtceu.GTCEu;
import com.gregtechceu.gtceu.api.capability.IParallelHatch;
import com.gregtechceu.gtceu.api.machine.feature.IRecipeLogicMachine;
import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController;
import com.gregtechceu.gtceu.common.machine.multiblock.part.ParallelHatchPartMachine;
import com.gregtechceu.gtceu.utils.FormattingUtil;

import net.minecraft.ChatFormatting;
Expand Down Expand Up @@ -62,7 +62,7 @@ public void appendTooltip(ITooltip iTooltip, BlockAccessor blockAccessor, IPlugi

@Override
public void appendServerData(CompoundTag compoundTag, BlockAccessor blockAccessor) {
if (blockAccessor.getBlockEntity() instanceof IParallelHatch parallelHatch) {
if (blockAccessor.getBlockEntity() instanceof ParallelHatchPartMachine parallelHatch) {
compoundTag.putInt("parallel", parallelHatch.getCurrentParallel());
} else if (blockAccessor.getBlockEntity() instanceof IMultiController controller) {
if (controller instanceof IRecipeLogicMachine rlm &&
Expand Down