mirror of
https://github.com/TicTicBoooom-Mods/MasterfulMachinery.git
synced 2026-03-18 21:40:34 +01:00
fixed ports and some inconsistencies
This commit is contained in:
@@ -18,7 +18,7 @@ apply plugin: 'net.minecraftforge.gradle'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
version = '1.16.5-0.1.2-T' + System.currentTimeMillis()
|
||||
version = '1.16.5-0.1.4-T' + System.currentTimeMillis()
|
||||
group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = 'MasterfulMachinery'
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ public class MachineStructureRecipeCategory implements IRecipeCategory<MachineSt
|
||||
continue;
|
||||
}
|
||||
|
||||
BlockPos bp = new BlockPos(part.getPos().getX(), part.getPos().getY(), part.getPos().getZ());
|
||||
BlockPos bp = new BlockPos(-part.getPos().getX(), part.getPos().getY(), -part.getPos().getZ());
|
||||
|
||||
if (!part.getBlock().equals("")) {
|
||||
ResourceLocation resourceLocation = new ResourceLocation(part.getBlock());
|
||||
@@ -168,19 +168,20 @@ public class MachineStructureRecipeCategory implements IRecipeCategory<MachineSt
|
||||
block = reg.get();
|
||||
}
|
||||
}
|
||||
BlockState defaultState = block.defaultBlockState().setValue(DirectionalBlock.FACING, Direction.NORTH);
|
||||
new GuiBlockRenderBuilder(defaultState).at(new BlockPos(0, 0, 0))
|
||||
.withPrePosition(new Vector3f(6.5f, -5, 10))
|
||||
.withRotation(new Quaternion(new Vector3f(1, 0, 0), 15 + yRotation, true))
|
||||
.withRotation(new Quaternion(new Vector3f(0, -1, 0), 225 - xRotation, true))
|
||||
.withScale(new Vector3f(12f, -12f, 12f))
|
||||
.finalize(matrixStack);
|
||||
if (block != null) {
|
||||
BlockState defaultState = block.defaultBlockState().setValue(DirectionalBlock.FACING, Direction.NORTH);
|
||||
new GuiBlockRenderBuilder(defaultState).at(new BlockPos(0, 0, 0))
|
||||
.withPrePosition(new Vector3f(6.5f, -5, 10))
|
||||
.withRotation(new Quaternion(new Vector3f(1, 0, 0), 15 + yRotation, true))
|
||||
.withRotation(new Quaternion(new Vector3f(0, -1, 0), 225 - xRotation, true))
|
||||
.withScale(new Vector3f(12f, -12f, 12f))
|
||||
.finalize(matrixStack);
|
||||
}
|
||||
}
|
||||
|
||||
this.recipe = recipe;
|
||||
xLastMousePosition = mouseX;
|
||||
yLastMousePosition = mouseY;
|
||||
|
||||
getButton().draw(matrixStack, 144, 125);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,6 @@ import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
// TODO: processing io
|
||||
|
||||
public class MachineProcessRecipe implements IRecipe<IInventory> {
|
||||
|
||||
|
||||
@@ -34,12 +32,14 @@ public class MachineProcessRecipe implements IRecipe<IInventory> {
|
||||
private final List<PortState> outputs;
|
||||
private int ticks;
|
||||
private String structureId;
|
||||
private ResourceLocation rl;
|
||||
|
||||
public MachineProcessRecipe(List<PortState> inputs, List<PortState> outputs, int ticks, String structureId) {
|
||||
public MachineProcessRecipe(List<PortState> inputs, List<PortState> outputs, int ticks, String structureId, ResourceLocation rl) {
|
||||
this.inputs = inputs;
|
||||
this.outputs = outputs;
|
||||
this.ticks = ticks;
|
||||
this.structureId = structureId;
|
||||
this.rl = rl;
|
||||
}
|
||||
|
||||
public boolean matches(List<IPortStorage> inputPorts, String structureId) {
|
||||
@@ -75,8 +75,6 @@ public class MachineProcessRecipe implements IRecipe<IInventory> {
|
||||
return update;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (update.getTicksTaken() >= ticks) {
|
||||
for (PortState input : inputs) {
|
||||
input.processRequirement(inputPorts);
|
||||
@@ -114,7 +112,7 @@ public class MachineProcessRecipe implements IRecipe<IInventory> {
|
||||
}
|
||||
for (PortState input : outputs) {
|
||||
if (input.isConsumePerTick()) {
|
||||
input.processRequirement(outputPorts);
|
||||
input.processResult(outputPorts);
|
||||
}
|
||||
}
|
||||
update.setTicksTaken(update.getTicksTaken() + 1);
|
||||
@@ -145,7 +143,7 @@ public class MachineProcessRecipe implements IRecipe<IInventory> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getId() {
|
||||
return new ResourceLocation(MM.ID, "machine_process");
|
||||
return rl;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -171,7 +169,7 @@ public class MachineProcessRecipe implements IRecipe<IInventory> {
|
||||
List<PortState> inputStates = getStates(inputs);
|
||||
List<PortState> outputStates = getStates(outputs);
|
||||
|
||||
return new MachineProcessRecipe(inputStates, outputStates, ticks, structureId);
|
||||
return new MachineProcessRecipe(inputStates, outputStates, ticks, structureId, rl);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@@ -207,7 +205,7 @@ public class MachineProcessRecipe implements IRecipe<IInventory> {
|
||||
String structureId = buf.readUtf();
|
||||
List<PortState> inputs = getStates(buf, inputCount);
|
||||
List<PortState> outputs = getStates(buf, outputCount);
|
||||
return new MachineProcessRecipe(inputs, outputs, ticks, structureId);
|
||||
return new MachineProcessRecipe(inputs, outputs, ticks, structureId, rl);
|
||||
}
|
||||
|
||||
private List<PortState> getStates(PacketBuffer buf, int count) {
|
||||
|
||||
@@ -56,7 +56,7 @@ public class PortMekSlurryInventory implements ISlurryHandler, ISlurryTank {
|
||||
if (this.stack.getAmount() + stack.getAmount() > capacity) {
|
||||
return new SlurryStack(stack.getType(), this.stack.getAmount() + stack.getAmount() - capacity);
|
||||
} else {
|
||||
return SlurryStack.EMPTY;
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class PortMekSlurryInventory implements ISlurryHandler, ISlurryTank {
|
||||
} else {
|
||||
this.stack.setAmount(this.stack.getAmount() + stack.getAmount());
|
||||
}
|
||||
return SlurryStack.EMPTY;
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,9 @@ public class MekSlurryPortState extends PortState {
|
||||
MekSlurryPortStorage gasStorage = (MekSlurryPortStorage) st;
|
||||
SlurryStack extract = gasStorage.getInv().extract(current, Action.EXECUTE, AutomationType.EXTERNAL);
|
||||
current -= extract.getAmount();
|
||||
if (current <= 0){
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,25 +64,28 @@ public class MekSlurryPortState extends PortState {
|
||||
|
||||
@Override
|
||||
public void processResult(List<IPortStorage> storage) {
|
||||
long current = 0;
|
||||
long current = amount;
|
||||
for (IPortStorage st : storage) {
|
||||
if (st instanceof MekSlurryPortStorage) {
|
||||
MekSlurryPortStorage gasStorage = (MekSlurryPortStorage) st;
|
||||
SlurryStack extract = gasStorage.getInv().insertChemical(new SlurryStack(Objects.requireNonNull(MekanismAPI.slurryRegistry().getValue(RLUtils.toRL(slurry))), current), Action.EXECUTE);
|
||||
current += extract.getAmount();
|
||||
current -= extract.getAmount();
|
||||
if (current <= 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validateResult(List<IPortStorage> storage) {
|
||||
long current = 0;
|
||||
long current = amount;
|
||||
for (IPortStorage st : storage) {
|
||||
if (st instanceof MekSlurryPortStorage) {
|
||||
MekSlurryPortStorage gasStorage = (MekSlurryPortStorage) st;
|
||||
SlurryStack extract = gasStorage.getInv().insertChemical(new SlurryStack(Objects.requireNonNull(MekanismAPI.slurryRegistry().getValue(RLUtils.toRL(slurry))), current), Action.EXECUTE);
|
||||
current += extract.getAmount();
|
||||
if (current >= amount) {
|
||||
SlurryStack extract = gasStorage.getInv().insertChemical(new SlurryStack(Objects.requireNonNull(MekanismAPI.slurryRegistry().getValue(RLUtils.toRL(slurry))), current), Action.SIMULATE);
|
||||
current -= extract.getAmount();
|
||||
if (current <= 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ public class MekSlurryPortStorage implements IPortStorage {
|
||||
public static final Codec<MekSlurryPortStorage> CODEC = RecordCodecBuilder.create(x -> x.group(
|
||||
Codec.LONG.fieldOf("capacity").forGetter(z -> z.capacity)
|
||||
).apply(x, MekSlurryPortStorage::new));
|
||||
|
||||
@Getter
|
||||
private final PortMekSlurryInventory inv;
|
||||
private long capacity;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
{
|
||||
"type": "masterfulmachinery:items",
|
||||
"data": {
|
||||
"item": "minecraft:wool",
|
||||
"item": "minecraft:white_wool",
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user