From 85b78ca02075ee3b6ca09109559c5d60b8154121 Mon Sep 17 00:00:00 2001 From: FortressNebula Date: Thu, 17 Mar 2022 22:07:33 +0000 Subject: [PATCH] fixed slightly concerning bearing issue --- .../MecanicalBearingTileEntityExtension.java | 5 +++++ .../propeller_bearing/PropellerBearingTileEntity.java | 11 ++++++----- .../mixins/MechanicalBearingTileEntityMixin.java | 10 ++++++++-- 3 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 src/main/java/com/eriksonn/createaeronautics/blocks/propeller_bearing/MecanicalBearingTileEntityExtension.java diff --git a/src/main/java/com/eriksonn/createaeronautics/blocks/propeller_bearing/MecanicalBearingTileEntityExtension.java b/src/main/java/com/eriksonn/createaeronautics/blocks/propeller_bearing/MecanicalBearingTileEntityExtension.java new file mode 100644 index 0000000..636b3d3 --- /dev/null +++ b/src/main/java/com/eriksonn/createaeronautics/blocks/propeller_bearing/MecanicalBearingTileEntityExtension.java @@ -0,0 +1,5 @@ +package com.eriksonn.createaeronautics.blocks.propeller_bearing; + +public interface MecanicalBearingTileEntityExtension { + boolean isPropeller(); +} diff --git a/src/main/java/com/eriksonn/createaeronautics/blocks/propeller_bearing/PropellerBearingTileEntity.java b/src/main/java/com/eriksonn/createaeronautics/blocks/propeller_bearing/PropellerBearingTileEntity.java index b75315e..7ebeaf1 100644 --- a/src/main/java/com/eriksonn/createaeronautics/blocks/propeller_bearing/PropellerBearingTileEntity.java +++ b/src/main/java/com/eriksonn/createaeronautics/blocks/propeller_bearing/PropellerBearingTileEntity.java @@ -1,14 +1,11 @@ package com.eriksonn.createaeronautics.blocks.propeller_bearing; -import com.eriksonn.createaeronautics.blocks.stationary_potato_cannon.StationaryPotatoCannonTileEntity; import com.eriksonn.createaeronautics.particle.PropellerAirParticleData; import com.simibubi.create.AllTags; import com.simibubi.create.Create; import com.simibubi.create.content.contraptions.components.structureMovement.ControlledContraptionEntity; import com.simibubi.create.content.contraptions.components.structureMovement.bearing.BearingContraption; import com.simibubi.create.content.contraptions.components.structureMovement.bearing.MechanicalBearingTileEntity; - -import com.simibubi.create.content.contraptions.particle.AirParticleData; import com.simibubi.create.foundation.gui.AllIcons; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.INamedIconOptions; @@ -17,7 +14,6 @@ import com.simibubi.create.foundation.utility.ServerSpeedProvider; import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.block.BlockState; -import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.tileentity.TileEntityType; @@ -33,7 +29,7 @@ import java.util.List; import java.util.Map; -public class PropellerBearingTileEntity extends MechanicalBearingTileEntity{ +public class PropellerBearingTileEntity extends MechanicalBearingTileEntity implements MecanicalBearingTileEntityExtension{ public ScrollOptionBehaviour movementDirection; protected float lastGeneratedSpeed; public List sailPositions; @@ -258,6 +254,11 @@ protected void setBlockDirection(PropellerBearingBlock.Direction direction) { notifyUpdate(); } + @Override + public boolean isPropeller() { + return true; + } + static enum RotationDirection implements INamedIconOptions { CLOCKWISE(AllIcons.I_REFRESH), COUNTER_CLOCKWISE(AllIcons.I_ROTATE_CCW), diff --git a/src/main/java/com/eriksonn/createaeronautics/mixins/MechanicalBearingTileEntityMixin.java b/src/main/java/com/eriksonn/createaeronautics/mixins/MechanicalBearingTileEntityMixin.java index 5f0edb5..10435d4 100644 --- a/src/main/java/com/eriksonn/createaeronautics/mixins/MechanicalBearingTileEntityMixin.java +++ b/src/main/java/com/eriksonn/createaeronautics/mixins/MechanicalBearingTileEntityMixin.java @@ -1,5 +1,6 @@ package com.eriksonn.createaeronautics.mixins; +import com.eriksonn.createaeronautics.blocks.propeller_bearing.MecanicalBearingTileEntityExtension; import com.eriksonn.createaeronautics.utils.BearingContraptionExtension; import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException; import com.simibubi.create.content.contraptions.components.structureMovement.bearing.BearingContraption; @@ -11,14 +12,19 @@ import org.spongepowered.asm.mixin.injection.Redirect; @Mixin(MechanicalBearingTileEntity.class) -public class MechanicalBearingTileEntityMixin { +public class MechanicalBearingTileEntityMixin implements MecanicalBearingTileEntityExtension { @Redirect( method = "assemble()V", at = @At(value = "INVOKE", target = "Lcom/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingContraption;assemble(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)Z", remap = false), remap = false ) private boolean onTryAssemble(BearingContraption contraption, World world, BlockPos pos) throws AssemblyException { - ((BearingContraptionExtension) contraption).setPropeller(); + if (isPropeller()) ((BearingContraptionExtension) contraption).setPropeller(); return contraption.assemble(world, pos); } + + @Override + public boolean isPropeller() { + return false; + } }