Skip to content

Commit

Permalink
Bug fixin 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Sep 1, 2024
1 parent 2c0d245 commit 75db0d9
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 42 deletions.
5 changes: 3 additions & 2 deletions changelog-next.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
- Increased lava/flame damage when shoot from Nozzle/Pressure Gun
- Fixed bug where some fluids wouldn't render in uis.
- Fixed Mechanical Spouts and Mechanical Drains interactions with Conveyors.
- Fixed Conveyors not ticking/updating item display correctly.
- Fixed a crash.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ org.gradle.parallel=true
loader_version=0.15.11

# Mod Properties
mod_version = 0.4.1
mod_version = 0.4.2
maven_group = eu.pb4
archives_base_name = polyfactory

Expand Down
38 changes: 4 additions & 34 deletions src/main/java/eu/pb4/polyfactory/block/fluids/MSpoutBlock.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
package eu.pb4.polyfactory.block.fluids;

import com.kneelawk.graphlib.api.graph.user.BlockNode;
import eu.pb4.factorytools.api.resourcepack.BaseItemProvider;
import eu.pb4.factorytools.api.util.WorldPointer;
import eu.pb4.factorytools.api.virtualentity.ItemDisplayElementUtil;
import eu.pb4.factorytools.api.virtualentity.LodItemDisplayElement;
import eu.pb4.polyfactory.block.FactoryBlockEntities;
import eu.pb4.polyfactory.block.mechanical.RotationUser;
import eu.pb4.polyfactory.block.mechanical.machines.TallItemMachineBlock;
import eu.pb4.polyfactory.block.mechanical.machines.crafting.PressBlockEntity;
import eu.pb4.polyfactory.block.network.NetworkComponent;
import eu.pb4.polyfactory.block.other.FilledStateProvider;
import eu.pb4.polyfactory.item.FactoryItems;
import eu.pb4.polyfactory.models.GenericParts;
import eu.pb4.polyfactory.models.RotationAwareModel;
import eu.pb4.polyfactory.nodes.pipe.PumpNode;
import eu.pb4.polyfactory.util.FactoryUtil;
import eu.pb4.polyfactory.util.movingitem.ContainerHolder;
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils;
import eu.pb4.polymer.virtualentity.api.ElementHolder;
import eu.pb4.polymer.virtualentity.api.attachment.BlockBoundAttachment;
import eu.pb4.polymer.virtualentity.api.attachment.HolderAttachment;
Expand All @@ -28,8 +22,6 @@
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityTicker;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.CustomModelDataComponent;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;
import net.minecraft.screen.ScreenHandler;
Expand Down Expand Up @@ -72,31 +64,9 @@ public boolean pushItemTo(WorldPointer self, Direction pushDirection, Direction
return false;
}

var be = (PressBlockEntity) self.getBlockEntity();
var be = (MSpoutBlockEntity) self.getBlockEntity();

if (self.getBlockState().get(INPUT_FACING).getOpposite() != pushDirection) {
var stack = be.getStack(1);
if (stack.isEmpty()) {
be.setStack(1, conveyor.pullAndDestroy().get());
return true;
}

var container = conveyor.getContainer();

if (ItemStack.areItemsAndComponentsEqual(container.get(), stack)) {
var i = Math.min(container.get().getCount(), stack.getMaxCount() - stack.getCount());
stack.increment(i);
container.get().decrement(i);
}

if (container.get().isEmpty()) {
conveyor.clearContainer();
}

return true;
}

var container = be.getContainerHolder(0);
var container = be.getContainerHolder(MSpoutBlockEntity.INPUT_FIRST);

if (container.isContainerEmpty()) {
container.pushAndAttach(conveyor.pullAndRemove());
Expand Down Expand Up @@ -128,9 +98,9 @@ public void getItemFrom(WorldPointer self, Direction pushDirection, Direction re
return;
}

var be = (PressBlockEntity) self.getBlockEntity();
var be = (MSpoutBlockEntity) self.getBlockEntity();

var out = be.getContainerHolder(2);
var out = be.getContainerHolder(MSpoutBlockEntity.OUTPUT_FIRST);

if (out.isContainerEmpty()) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -573,8 +573,8 @@ private void updateAnimation(Direction dir, DirectionValue value) {

@Override
protected void onTick() {
if (this.movingItemContainer != null && this.getTick() % 2 == 0) {
this.movingItemContainer.checkItems();
if (this.movingItemContainer != null) {
this.movingItemContainer.tick();
}
}

Expand Down Expand Up @@ -692,11 +692,9 @@ public void pushAndAttach(MovingItem container) {
}

this.movingItemContainer = container;
container.scale(1);
updateDelta(-1, this.delta);
this.addElementWithoutUpdates(container);
}

public void tryTick() {
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ protected void configure(RegistryWrapper.WrapperLookup arg) {
this.getOrCreateTagBuilder(FactoryBlockTags.CONVEYOR_SIDE_OUTPUT)
.add(FactoryBlocks.PRESS)
.add(FactoryBlocks.MIXER)
.add(FactoryBlocks.MECHANICAL_SPOUT)
.add(FactoryBlocks.MECHANICAL_DRAIN)
.add(FactoryBlocks.GRINDER)
.add(Blocks.HOPPER)
.add(Blocks.COMPOSTER)
;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ public void tick() {
if (this.tick++ % 2 == 1) {
return;
}
this.checkItems();

for (var x : this.itemDisplay) {
x.tick();
Expand All @@ -172,6 +173,7 @@ public void tick() {
this.riddenBase.setTeleportDuration(4);
this.isFirstMove = false;
}

}

@Override
Expand Down

0 comments on commit 75db0d9

Please sign in to comment.