Merge branch 'master' into 1.15
This commit is contained in:
commit
f6db78c04f
4 files changed
+40
-2
No files matched your search
@@ -0,0 +1,10 @@
|
||||
package carpet.fakes;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface PistonBlockInterface
|
||||
{
|
||||
boolean publicShouldExtend(World world_1, BlockPos blockPos_1, Direction direction_1);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package carpet.helpers;
|
||||
|
||||
import carpet.fakes.PistonBlockInterface;
|
||||
import carpet.settings.CarpetSettings;
|
||||
import net.minecraft.block.AbstractRedstoneGateBlock;
|
||||
import net.minecraft.block.BedBlock;
|
||||
@@ -27,6 +28,7 @@ import net.minecraft.block.dispenser.FallibleItemDispenserBehavior;
|
||||
import net.minecraft.block.enums.BlockHalf;
|
||||
import net.minecraft.block.enums.ComparatorMode;
|
||||
import net.minecraft.block.enums.SlabType;
|
||||
import net.minecraft.block.piston.PistonHandler;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
@@ -157,10 +159,14 @@ public class BlockRotator
|
||||
// Block rotation for blocks that can be placed in all 6 or 4 rotations.
|
||||
if(block instanceof FacingBlock || block instanceof DispenserBlock)
|
||||
{
|
||||
if (block instanceof PistonBlock && (world.isReceivingRedstonePower(blockpos) || iblockstate.get(PistonBlock.EXTENDED)))
|
||||
Direction face = iblockstate.get(FacingBlock.FACING);
|
||||
if (block instanceof PistonBlock && (
|
||||
iblockstate.get(PistonBlock.EXTENDED)
|
||||
|| ( ((PistonBlockInterface)block).publicShouldExtend(world, blockpos, face) && (new PistonHandler(world, blockpos, face, true)).calculatePush() )
|
||||
)
|
||||
)
|
||||
return stack;
|
||||
|
||||
Direction face = iblockstate.get(FacingBlock.FACING);
|
||||
Direction rotated_face = face.rotateClockwise(sourceFace.getAxis());
|
||||
if(sourceFace.getId() % 2 == 0 || rotated_face == face)
|
||||
{ // Flip to make blocks always rotate clockwise relative to the dispenser
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.fakes.PistonBlockInterface;
|
||||
import net.minecraft.block.PistonBlock;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@Mixin(PistonBlock.class)
|
||||
public abstract class PistonBlock_rotatorBlockMixin implements PistonBlockInterface
|
||||
{
|
||||
@Shadow protected abstract boolean shouldExtend(World world_1, BlockPos blockPos_1, Direction direction_1);
|
||||
|
||||
@Override
|
||||
public boolean publicShouldExtend(World world_1, BlockPos blockPos_1, Direction direction_1)
|
||||
{
|
||||
return shouldExtend(world_1, blockPos_1,direction_1);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user