mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-29 08:27:03 +01:00
Merge remote-tracking branch 'origin/mc1.15/dev' into mc1.15/dev
This commit is contained in:
commit
cf5eea5a10
2 changed files with 52 additions and 48 deletions
|
@ -1,15 +1,5 @@
|
||||||
package com.simibubi.create.content.contraptions.relays.advanced;
|
package com.simibubi.create.content.contraptions.relays.advanced;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlocks;
|
|
||||||
import com.simibubi.create.AllShapes;
|
|
||||||
import com.simibubi.create.AllTileEntities;
|
|
||||||
import com.simibubi.create.content.contraptions.base.HorizontalAxisKineticBlock;
|
|
||||||
import com.simibubi.create.content.contraptions.relays.elementary.CogWheelBlock;
|
|
||||||
import com.simibubi.create.content.contraptions.relays.elementary.CogwheelBlockItem;
|
|
||||||
import com.simibubi.create.foundation.block.ITE;
|
|
||||||
import com.simibubi.create.foundation.utility.placement.IPlacementHelper;
|
|
||||||
import com.simibubi.create.foundation.utility.placement.PlacementHelpers;
|
|
||||||
import com.simibubi.create.foundation.utility.placement.PlacementOffset;
|
|
||||||
import mcp.MethodsReturnNonnullByDefault;
|
import mcp.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -29,6 +19,16 @@ import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
import com.simibubi.create.AllBlocks;
|
||||||
|
import com.simibubi.create.AllShapes;
|
||||||
|
import com.simibubi.create.AllTileEntities;
|
||||||
|
import com.simibubi.create.content.contraptions.base.HorizontalAxisKineticBlock;
|
||||||
|
import com.simibubi.create.content.contraptions.relays.elementary.CogWheelBlock;
|
||||||
|
import com.simibubi.create.content.contraptions.relays.elementary.CogwheelBlockItem;
|
||||||
|
import com.simibubi.create.foundation.block.ITE;
|
||||||
|
import com.simibubi.create.foundation.utility.placement.IPlacementHelper;
|
||||||
|
import com.simibubi.create.foundation.utility.placement.PlacementHelpers;
|
||||||
|
import com.simibubi.create.foundation.utility.placement.PlacementOffset;
|
||||||
|
|
||||||
public class SpeedControllerBlock extends HorizontalAxisKineticBlock implements ITE<SpeedControllerTileEntity> {
|
public class SpeedControllerBlock extends HorizontalAxisKineticBlock implements ITE<SpeedControllerTileEntity> {
|
||||||
|
|
||||||
|
@ -100,8 +100,8 @@ public class SpeedControllerBlock extends HorizontalAxisKineticBlock implements
|
||||||
|
|
||||||
Axis newAxis = state.get(HORIZONTAL_AXIS) == Axis.X ? Axis.Z : Axis.X;
|
Axis newAxis = state.get(HORIZONTAL_AXIS) == Axis.X ? Axis.Z : Axis.X;
|
||||||
|
|
||||||
if (CogwheelBlockItem.DiagonalCogHelper.hasLargeCogwheelNeighbor(world, newPos, newAxis)
|
if (CogwheelBlockItem.hasLargeCogwheelNeighbor(world, newPos, newAxis)
|
||||||
|| CogwheelBlockItem.DiagonalCogHelper.hasSmallCogwheelNeighbor(world, newPos, newAxis))
|
|| CogwheelBlockItem.hasSmallCogwheelNeighbor(world, newPos, newAxis))
|
||||||
return PlacementOffset.fail();
|
return PlacementOffset.fail();
|
||||||
|
|
||||||
return PlacementOffset.success(newPos, s -> s.with(CogWheelBlock.AXIS, newAxis));
|
return PlacementOffset.success(newPos, s -> s.with(CogWheelBlock.AXIS, newAxis));
|
||||||
|
|
|
@ -1,15 +1,5 @@
|
||||||
package com.simibubi.create.content.contraptions.relays.elementary;
|
package com.simibubi.create.content.contraptions.relays.elementary;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlocks;
|
|
||||||
import com.simibubi.create.AllShapes;
|
|
||||||
import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock;
|
|
||||||
import com.simibubi.create.content.contraptions.base.HorizontalKineticBlock;
|
|
||||||
import com.simibubi.create.content.contraptions.base.IRotate;
|
|
||||||
import com.simibubi.create.foundation.advancement.AllTriggers;
|
|
||||||
import com.simibubi.create.foundation.utility.Iterate;
|
|
||||||
import com.simibubi.create.foundation.utility.placement.IPlacementHelper;
|
|
||||||
import com.simibubi.create.foundation.utility.placement.PlacementHelpers;
|
|
||||||
import com.simibubi.create.foundation.utility.placement.PlacementOffset;
|
|
||||||
import mcp.MethodsReturnNonnullByDefault;
|
import mcp.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
@ -27,6 +17,16 @@ import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
import com.simibubi.create.AllBlocks;
|
||||||
|
import com.simibubi.create.AllShapes;
|
||||||
|
import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock;
|
||||||
|
import com.simibubi.create.content.contraptions.base.HorizontalKineticBlock;
|
||||||
|
import com.simibubi.create.content.contraptions.base.IRotate;
|
||||||
|
import com.simibubi.create.foundation.advancement.AllTriggers;
|
||||||
|
import com.simibubi.create.foundation.utility.Iterate;
|
||||||
|
import com.simibubi.create.foundation.utility.placement.IPlacementHelper;
|
||||||
|
import com.simibubi.create.foundation.utility.placement.PlacementHelpers;
|
||||||
|
import com.simibubi.create.foundation.utility.placement.PlacementOffset;
|
||||||
|
|
||||||
import static com.simibubi.create.content.contraptions.base.RotatedPillarKineticBlock.AXIS;
|
import static com.simibubi.create.content.contraptions.base.RotatedPillarKineticBlock.AXIS;
|
||||||
|
|
||||||
|
@ -169,6 +169,10 @@ public class CogwheelBlockItem extends BlockItem {
|
||||||
for (Direction dir : directions) {
|
for (Direction dir : directions) {
|
||||||
BlockPos newPos = pos.offset(dir)
|
BlockPos newPos = pos.offset(dir)
|
||||||
.offset(side);
|
.offset(side);
|
||||||
|
|
||||||
|
if (hasLargeCogwheelNeighbor(world, newPos, dir.getAxis()) || hasSmallCogwheelNeighbor(world, newPos, dir.getAxis()))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (!world.getBlockState(newPos)
|
if (!world.getBlockState(newPos)
|
||||||
.getMaterial()
|
.getMaterial()
|
||||||
.isReplaceable())
|
.isReplaceable())
|
||||||
|
@ -225,30 +229,6 @@ public class CogwheelBlockItem extends BlockItem {
|
||||||
.subtract(ray.getHitVec()
|
.subtract(ray.getHitVec()
|
||||||
.align(Iterate.axisSet)));
|
.align(Iterate.axisSet)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static public boolean hasLargeCogwheelNeighbor(World world, BlockPos pos, Direction.Axis axis) {
|
|
||||||
for (Direction dir : Iterate.directions) {
|
|
||||||
if (dir.getAxis() == axis)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (AllBlocks.LARGE_COGWHEEL.has(world.getBlockState(pos.offset(dir))))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static public boolean hasSmallCogwheelNeighbor(World world, BlockPos pos, Direction.Axis axis) {
|
|
||||||
for (Direction dir : Iterate.directions) {
|
|
||||||
if (dir.getAxis() == axis)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (AllBlocks.COGWHEEL.has(world.getBlockState(pos.offset(dir))))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@MethodsReturnNonnullByDefault
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ -294,8 +274,8 @@ public class CogwheelBlockItem extends BlockItem {
|
||||||
.isReplaceable())
|
.isReplaceable())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (DiagonalCogHelper.hasLargeCogwheelNeighbor(world, newPos, newAxis)
|
if (hasLargeCogwheelNeighbor(world, newPos, newAxis)
|
||||||
|| DiagonalCogHelper.hasSmallCogwheelNeighbor(world, newPos, newAxis))
|
|| hasSmallCogwheelNeighbor(world, newPos, newAxis))
|
||||||
return PlacementOffset.fail();
|
return PlacementOffset.fail();
|
||||||
|
|
||||||
return PlacementOffset.success(newPos, s -> s.with(CogWheelBlock.AXIS, newAxis));
|
return PlacementOffset.success(newPos, s -> s.with(CogWheelBlock.AXIS, newAxis));
|
||||||
|
@ -303,5 +283,29 @@ public class CogwheelBlockItem extends BlockItem {
|
||||||
|
|
||||||
return PlacementOffset.fail();
|
return PlacementOffset.fail();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
static public boolean hasLargeCogwheelNeighbor(World world, BlockPos pos, Axis axis) {
|
||||||
|
for (Direction dir : Iterate.directions) {
|
||||||
|
if (dir.getAxis() == axis)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (AllBlocks.LARGE_COGWHEEL.has(world.getBlockState(pos.offset(dir))))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static public boolean hasSmallCogwheelNeighbor(World world, BlockPos pos, Axis axis) {
|
||||||
|
for (Direction dir : Iterate.directions) {
|
||||||
|
if (dir.getAxis() == axis)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (AllBlocks.COGWHEEL.has(world.getBlockState(pos.offset(dir))))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue