Search in sources :

Example 1 with GantryContraption

use of com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryContraption in project FrostedHeart by TeamMoegMC.

the class MixinGantryContraptionEntity method checkPinionShaft.

@Inject(at = @At("HEAD"), method = "checkPinionShaft", remap = false)
protected void checkPinionShaft(CallbackInfo cbi) {
    Direction facing = ((GantryContraption) contraption).getFacing();
    Vector3d currentPosition = getAnchorVec().add(.5, .5, .5);
    BlockPos gantryShaftPos = new BlockPos(currentPosition).offset(facing.getOpposite());
    TileEntity te = world.getTileEntity(gantryShaftPos);
    if (te instanceof IGantryShaft) {
        GantryShaftTileEntity gte = (GantryShaftTileEntity) te;
        ((IGantryShaft) gte).setEntity(this);
        gte.networkDirty = true;
        return;
    }
}
Also used : GantryShaftTileEntity(com.simibubi.create.content.contraptions.relays.advanced.GantryShaftTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) GantryContraption(com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryContraption) Vector3d(net.minecraft.util.math.vector.Vector3d) IGantryShaft(com.teammoeg.frostedheart.util.IGantryShaft) GantryShaftTileEntity(com.simibubi.create.content.contraptions.relays.advanced.GantryShaftTileEntity) BlockPos(net.minecraft.util.math.BlockPos) Direction(net.minecraft.util.Direction) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 2 with GantryContraption

use of com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryContraption in project FrostedHeart by TeamMoegMC.

the class MixinGantryShaftTileEntity method calculateStressApplied.

@Override
public float calculateStressApplied() {
    if (currentComp != null && currentComp.isAlive()) {
        // float impact = currentComp.getContraption().getBlocks().size()*4;
        Direction facing = ((GantryContraption) currentComp.getContraption()).getFacing();
        Vector3d currentPosition = currentComp.getAnchorVec().add(.5, .5, .5);
        BlockPos gantryShaftPos = new BlockPos(currentPosition).offset(facing.getOpposite());
        if (gantryShaftPos.equals(this.pos)) {
            ContraptionCostUtils.setSpeedAndCollect(currentComp, (int) speed);
            this.lastStressApplied = ContraptionCostUtils.getCost(currentComp) + 0.5F;
            return lastStressApplied;
        }
    }
    currentComp = null;
    return 0;
}
Also used : GantryContraption(com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryContraption) Vector3d(net.minecraft.util.math.vector.Vector3d) BlockPos(net.minecraft.util.math.BlockPos) Direction(net.minecraft.util.Direction)

Aggregations

GantryContraption (com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryContraption)2 Direction (net.minecraft.util.Direction)2 BlockPos (net.minecraft.util.math.BlockPos)2 Vector3d (net.minecraft.util.math.vector.Vector3d)2 GantryShaftTileEntity (com.simibubi.create.content.contraptions.relays.advanced.GantryShaftTileEntity)1 IGantryShaft (com.teammoeg.frostedheart.util.IGantryShaft)1 TileEntity (net.minecraft.tileentity.TileEntity)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1