Skip to content

Commit

Permalink
Merge pull request #12 from FortressNebula/master
Browse files Browse the repository at this point in the history
Beep Boop: fixed slightly concerning bearing issue
  • Loading branch information
Eriksonnaren authored Mar 25, 2022
2 parents a02d40e + 85b78ca commit 23cb058
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.eriksonn.createaeronautics.blocks.propeller_bearing;

public interface MecanicalBearingTileEntityExtension {
boolean isPropeller();
}
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand All @@ -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<PropellerBearingTileEntity.RotationDirection> movementDirection;
protected float lastGeneratedSpeed;
public List<BlockPos> sailPositions;
Expand Down Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
}
}

0 comments on commit 23cb058

Please sign in to comment.