- Added the Mechanical Saw
- Bunch of fixes for mechanical blocks
This commit is contained in:
simibubi 2019-10-19 23:42:44 +02:00
parent d8ab5dc122
commit ee75468719
35 changed files with 545 additions and 151 deletions

View file

@ -16,6 +16,7 @@ import com.simibubi.create.modules.contraptions.receivers.EncasedFanBlock;
import com.simibubi.create.modules.contraptions.receivers.HarvesterBlock;
import com.simibubi.create.modules.contraptions.receivers.HarvesterBlock.HarvesterBladeBlock;
import com.simibubi.create.modules.contraptions.receivers.MechanicalPressBlock;
import com.simibubi.create.modules.contraptions.receivers.SawBlock;
import com.simibubi.create.modules.contraptions.receivers.TurntableBlock;
import com.simibubi.create.modules.contraptions.receivers.constructs.MechanicalBearingBlock;
import com.simibubi.create.modules.contraptions.receivers.constructs.MechanicalPistonBlock;
@ -121,6 +122,7 @@ public enum AllBlocks {
ROTATION_CHASSIS(new RotationChassisBlock()),
DRILL(new DrillBlock()),
DRILL_HEAD(new DrillHeadBlock()),
SAW(new SawBlock()),
HARVESTER(new HarvesterBlock()),
HARVESTER_BLADE(new HarvesterBladeBlock()),

View file

@ -79,6 +79,8 @@ public enum AllItems {
FLOUR(ingredient()),
DOUGH(ingredient()),
PROPELLER(ingredient()),
CRUSHED_IRON(ingredient()),
CRUSHED_GOLD(ingredient()),
__LOGISTICS__(),
CARDBOARD_BOX_1616(new CardboardBoxItem(standardItemProperties())),

View file

@ -16,6 +16,8 @@ import com.simibubi.create.modules.contraptions.receivers.HarvesterTileEntity;
import com.simibubi.create.modules.contraptions.receivers.HarvesterTileEntityRenderer;
import com.simibubi.create.modules.contraptions.receivers.MechanicalPressTileEntity;
import com.simibubi.create.modules.contraptions.receivers.MechanicalPressTileEntityRenderer;
import com.simibubi.create.modules.contraptions.receivers.SawTileEntity;
import com.simibubi.create.modules.contraptions.receivers.SawTileEntityRenderer;
import com.simibubi.create.modules.contraptions.receivers.TurntableTileEntity;
import com.simibubi.create.modules.contraptions.receivers.constructs.ChassisTileEntity;
import com.simibubi.create.modules.contraptions.receivers.constructs.MechanicalBearingTileEntity;
@ -97,6 +99,7 @@ public enum AllTileEntities {
CHASSIS(ChassisTileEntity::new, AllBlocks.ROTATION_CHASSIS, AllBlocks.TRANSLATION_CHASSIS,
AllBlocks.TRANSLATION_CHASSIS_SECONDARY),
DRILL(DrillTileEntity::new, AllBlocks.DRILL),
SAW(SawTileEntity::new, AllBlocks.SAW),
HARVESTER(HarvesterTileEntity::new, AllBlocks.HARVESTER),
CRUSHING_WHEEL(CrushingWheelTileEntity::new, AllBlocks.CRUSHING_WHEEL),
CRUSHING_WHEEL_CONTROLLER(CrushingWheelControllerTileEntity::new, AllBlocks.CRUSHING_WHEEL_CONTROLLER),
@ -163,6 +166,7 @@ public enum AllTileEntities {
bind(MotorTileEntity.class, new MotorTileEntityRenderer());
bind(EncasedShaftTileEntity.class, new EncasedShaftTileEntityRenderer());
bind(DrillTileEntity.class, new DrillTileEntityRenderer());
bind(SawTileEntity.class, new SawTileEntityRenderer());
bind(EncasedFanTileEntity.class, new EncasedFanTileEntityRenderer());
bind(GearboxTileEntity.class, new GearboxTileEntityRenderer());
bind(GearshiftTileEntity.class, new SplitShaftTileEntityRenderer());

View file

@ -1,5 +1,6 @@
package com.simibubi.create.foundation.utility;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.block.Block;
@ -10,7 +11,7 @@ import net.minecraft.util.math.shapes.VoxelShape;
public class VoxelShaper {
private Map<Direction, VoxelShape> shapes;
private Map<Direction, VoxelShape> shapes = new HashMap<>();
public VoxelShape get(Direction direction) {
return shapes.get(direction);
@ -21,7 +22,7 @@ public class VoxelShaper {
for (Direction facing : Direction.values()) {
if (facing.getAxis().isVertical())
continue;
voxelShaper.shapes.put(facing, rotatedCopy(southShape, (int) facing.getHorizontalAngle(), 0));
voxelShaper.shapes.put(facing, rotatedCopy(southShape, 0, (int) -facing.getHorizontalAngle()));
}
return voxelShaper;
}
@ -29,8 +30,8 @@ public class VoxelShaper {
public static VoxelShaper forDirectionalBlock(VoxelShape southShape) {
VoxelShaper voxelShaper = new VoxelShaper();
for (Direction facing : Direction.values()) {
int rotX = facing.getAxis().isVertical() ? 0 : (int) facing.getHorizontalAngle();
int rotY = facing.getAxis().isVertical() ? (facing == Direction.UP ? 90 : 270) : 0;
int rotX = facing.getAxis().isVertical() ? (facing == Direction.UP ? 270 : 90) : 0;
int rotY = facing.getAxis().isVertical() ? 0 : (int) -facing.getHorizontalAngle();
voxelShaper.shapes.put(facing, rotatedCopy(southShape, rotX, rotY));
}
return voxelShaper;
@ -43,13 +44,16 @@ public class VoxelShaper {
}
public static VoxelShape rotatedCopy(VoxelShape shape, int rotX, int rotY) {
Vec3d v1 = new Vec3d(shape.getStart(Axis.X), shape.getStart(Axis.Y), shape.getStart(Axis.Z)).scale(16);
Vec3d v2 = new Vec3d(shape.getEnd(Axis.X), shape.getEnd(Axis.Y), shape.getEnd(Axis.Z)).scale(16);
Vec3d center = new Vec3d(8, 8, 8);
Vec3d v1 = new Vec3d(shape.getStart(Axis.X), shape.getStart(Axis.Y), shape.getStart(Axis.Z)).scale(16)
.subtract(center);
Vec3d v2 = new Vec3d(shape.getEnd(Axis.X), shape.getEnd(Axis.Y), shape.getEnd(Axis.Z)).scale(16)
.subtract(center);
v1 = VecHelper.rotate(v1, rotX, Axis.X);
v1 = VecHelper.rotate(v1, rotY, Axis.Y);
v1 = VecHelper.rotate(v1, rotY, Axis.Y).add(center);
v2 = VecHelper.rotate(v2, rotX, Axis.X);
v2 = VecHelper.rotate(v2, rotY, Axis.Y);
v2 = VecHelper.rotate(v2, rotY, Axis.Y).add(center);
return Block.makeCuboidShape(v1.x, v1.y, v1.z, v2.x, v2.y, v2.z);
}

View file

@ -0,0 +1,10 @@
package com.simibubi.create.foundation.utility;
import net.minecraft.block.Block;
public class VoxelShapers {
public static final VoxelShaper SHORT_CASING = VoxelShaper
.forDirectionalBlock(Block.makeCuboidShape(0, 0, 0, 16, 16, 12));
}

View file

@ -0,0 +1,96 @@
package com.simibubi.create.modules.contraptions.base;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer.Builder;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public abstract class DirectionalAxisKineticBlock extends DirectionalKineticBlock {
public static final BooleanProperty AXIS_ALONG_FIRST_COORDINATE = BooleanProperty.create("axis_along_first");
public DirectionalAxisKineticBlock(Properties properties) {
super(properties);
}
@Override
protected void fillStateContainer(Builder<Block, BlockState> builder) {
builder.add(AXIS_ALONG_FIRST_COORDINATE);
super.fillStateContainer(builder);
}
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
Direction facing = context.getNearestLookingDirection().getOpposite();
BlockPos pos = context.getPos();
World world = context.getWorld();
boolean alongFirst = false;
if (context.isPlacerSneaking())
facing = facing.getOpposite();
if (facing.getAxis().isHorizontal()) {
alongFirst = facing.getAxis() == Axis.Z;
Block blockAbove = world.getBlockState(pos.offset(Direction.UP)).getBlock();
boolean shaftAbove = blockAbove instanceof IRotate && ((IRotate) blockAbove).hasShaftTowards(world,
pos.up(), world.getBlockState(pos.up()), Direction.DOWN);
Block blockBelow = world.getBlockState(pos.offset(Direction.DOWN)).getBlock();
boolean shaftBelow = blockBelow instanceof IRotate && ((IRotate) blockBelow).hasShaftTowards(world,
pos.down(), world.getBlockState(pos.down()), Direction.UP);
if (shaftAbove || shaftBelow)
alongFirst = facing.getAxis() == Axis.X;
}
if (facing.getAxis().isVertical()) {
alongFirst = context.getPlacementHorizontalFacing().getAxis() == Axis.X;
Direction prefferedSide = null;
for (Direction side : Direction.values()) {
if (side.getAxis().isVertical())
continue;
BlockState blockState = context.getWorld().getBlockState(context.getPos().offset(side));
if (blockState.getBlock() instanceof IRotate) {
if (((IRotate) blockState.getBlock()).hasShaftTowards(context.getWorld(),
context.getPos().offset(side), blockState, side.getOpposite()))
if (prefferedSide != null && prefferedSide.getAxis() != side.getAxis()) {
prefferedSide = null;
break;
} else {
prefferedSide = side;
}
}
}
if (prefferedSide != null) {
alongFirst = prefferedSide.getAxis() == Axis.X;
}
}
return this.getDefaultState().with(FACING, facing).with(AXIS_ALONG_FIRST_COORDINATE, alongFirst);
}
@Override
public Axis getRotationAxis(BlockState state) {
Axis pistonAxis = state.get(FACING).getAxis();
boolean alongFirst = state.get(AXIS_ALONG_FIRST_COORDINATE);
if (pistonAxis == Axis.X)
return alongFirst ? Axis.Y : Axis.Z;
if (pistonAxis == Axis.Y)
return alongFirst ? Axis.X : Axis.Z;
if (pistonAxis == Axis.Z)
return alongFirst ? Axis.X : Axis.Y;
return super.getRotationAxis(state);
}
@Override
public boolean hasShaftTowards(World world, BlockPos pos, BlockState state, Direction face) {
return face.getAxis() == getRotationAxis(state);
}
}

View file

@ -4,9 +4,9 @@ import java.util.List;
import com.simibubi.create.foundation.block.IRenderUtilityBlock;
import com.simibubi.create.foundation.block.IWithTileEntity;
import com.simibubi.create.foundation.utility.VoxelShapers;
import com.simibubi.create.modules.contraptions.base.DirectionalKineticBlock;
import com.simibubi.create.modules.contraptions.receivers.constructs.IHaveMovementBehavior;
import com.simibubi.create.modules.contraptions.relays.ShaftBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -24,7 +24,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
@ -34,11 +33,6 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class DrillBlock extends DirectionalKineticBlock
implements IHaveMovementBehavior, IWithTileEntity<DrillTileEntity> {
protected static final VoxelShape CORE_SHAPE = makeCuboidShape(3, 3, 3, 13, 13, 13),
DRILL_SHAPE_X = VoxelShapes.or(CORE_SHAPE, ShaftBlock.AXIS_X),
DRILL_SHAPE_Y = VoxelShapes.or(CORE_SHAPE, ShaftBlock.AXIS_Y),
DRILL_SHAPE_Z = VoxelShapes.or(CORE_SHAPE, ShaftBlock.AXIS_Z);
public DrillBlock() {
super(Properties.from(Blocks.IRON_BLOCK));
}
@ -55,16 +49,7 @@ public class DrillBlock extends DirectionalKineticBlock
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
Axis axis = state.get(FACING).getAxis();
if (axis == Axis.X)
return DRILL_SHAPE_X;
if (axis == Axis.Y)
return DRILL_SHAPE_Y;
if (axis == Axis.Z)
return DRILL_SHAPE_Z;
return CORE_SHAPE;
return VoxelShapers.SHORT_CASING.get(state.get(FACING));
}
@Override

View file

@ -4,6 +4,7 @@ import java.util.List;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.block.IRenderUtilityBlock;
import com.simibubi.create.foundation.utility.VoxelShaper;
import com.simibubi.create.modules.contraptions.receivers.constructs.IHaveMovementBehavior;
import net.minecraft.block.Block;
@ -28,7 +29,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
@ -39,9 +39,7 @@ import net.minecraftforge.common.IPlantable;
public class HarvesterBlock extends HorizontalBlock implements IHaveMovementBehavior {
public static final VoxelShape SHAPE_SOUTH = makeCuboidShape(0, 4, 0, 16, 12, 6),
SHAPE_NORTH = makeCuboidShape(0, 4, 10, 16, 12, 16), SHAPE_WEST = makeCuboidShape(10, 4, 0, 16, 12, 16),
SHAPE_EAST = makeCuboidShape(0, 4, 0, 6, 12, 16);
private static VoxelShaper SHAPER = VoxelShaper.forHorizontalBlock(Block.makeCuboidShape(0, 2, 0, 16, 14, 3));
public HarvesterBlock() {
super(Properties.from(Blocks.IRON_BLOCK));
@ -65,17 +63,7 @@ public class HarvesterBlock extends HorizontalBlock implements IHaveMovementBeha
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
Direction direction = state.get(HORIZONTAL_FACING);
if (direction == Direction.NORTH)
return SHAPE_NORTH;
if (direction == Direction.SOUTH)
return SHAPE_SOUTH;
if (direction == Direction.EAST)
return SHAPE_EAST;
if (direction == Direction.WEST)
return SHAPE_WEST;
return VoxelShapes.empty();
return SHAPER.get(direction);
}
@Override

View file

@ -0,0 +1,90 @@
package com.simibubi.create.modules.contraptions.receivers;
import com.simibubi.create.foundation.block.IWithTileEntity;
import com.simibubi.create.foundation.utility.VoxelShapers;
import com.simibubi.create.modules.contraptions.base.DirectionalAxisKineticBlock;
import com.simibubi.create.modules.contraptions.receivers.constructs.IHaveMovementBehavior;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.material.PushReaction;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer.Builder;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
public class SawBlock extends DirectionalAxisKineticBlock
implements IWithTileEntity<SawTileEntity>, IHaveMovementBehavior {
public static final BooleanProperty RUNNING = BooleanProperty.create("running");
public SawBlock() {
super(Properties.from(Blocks.ANDESITE));
setDefaultState(getDefaultState().with(RUNNING, false));
}
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT_MIPPED;
}
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
BlockState stateForPlacement = super.getStateForPlacement(context);
Direction facing = stateForPlacement.get(FACING);
if (facing.getAxis().isVertical())
return stateForPlacement;
return stateForPlacement.with(AXIS_ALONG_FIRST_COORDINATE, facing.getAxis() == Axis.X);
}
@Override
protected void fillStateContainer(Builder<Block, BlockState> builder) {
builder.add(RUNNING);
super.fillStateContainer(builder);
}
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return new SawTileEntity();
}
@Override
protected boolean hasStaticPart() {
return true;
}
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return VoxelShapers.SHORT_CASING.get(state.get(FACING));
}
@Override
public PushReaction getPushReaction(BlockState state) {
return PushReaction.PUSH_ONLY;
}
public boolean isHorizontal(BlockState state) {
return state.get(FACING).getAxis().isHorizontal();
}
@Override
public Axis getRotationAxis(BlockState state) {
return isHorizontal(state) ? state.get(FACING).getAxis() : super.getRotationAxis(state);
}
@Override
public boolean hasShaftTowards(World world, BlockPos pos, BlockState state, Direction face) {
return isHorizontal(state) ? face == state.get(FACING).getOpposite()
: super.hasShaftTowards(world, pos, state, face);
}
}

View file

@ -0,0 +1,22 @@
package com.simibubi.create.modules.contraptions.receivers;
import static com.simibubi.create.modules.contraptions.receivers.SawBlock.RUNNING;
import com.simibubi.create.AllTileEntities;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
public class SawTileEntity extends KineticTileEntity {
public SawTileEntity() {
super(AllTileEntities.SAW.type);
}
@Override
public void onSpeedChanged() {
boolean shouldRun = Math.abs(speed) > 1 / 64f;
boolean running = getBlockState().get(RUNNING);
if (shouldRun != running)
world.setBlockState(pos, getBlockState().with(RUNNING, shouldRun));
}
}

View file

@ -0,0 +1,24 @@
package com.simibubi.create.modules.contraptions.receivers;
import static net.minecraft.state.properties.BlockStateProperties.AXIS;
import static net.minecraft.state.properties.BlockStateProperties.FACING;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.modules.contraptions.base.IRotate;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
import net.minecraft.block.BlockState;
public class SawTileEntityRenderer extends KineticTileEntityRenderer {
@Override
protected BlockState getRenderedBlockState(KineticTileEntity te) {
BlockState state = te.getBlockState();
if (state.get(FACING).getAxis().isHorizontal()) {
return AllBlocks.SHAFT_HALF.block.getDefaultState().with(FACING, state.get(FACING).getOpposite());
}
return AllBlocks.SHAFT.block.getDefaultState().with(AXIS, ((IRotate) state.getBlock()).getRotationAxis(state));
}
}

View file

@ -2,23 +2,18 @@ package com.simibubi.create.modules.contraptions.receivers.constructs;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateConfig;
import com.simibubi.create.modules.contraptions.base.IRotate;
import com.simibubi.create.modules.contraptions.base.KineticBlock;
import com.simibubi.create.modules.contraptions.base.DirectionalAxisKineticBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.EnumProperty;
import net.minecraft.state.StateContainer.Builder;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.Hand;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.SoundCategory;
@ -33,11 +28,9 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.common.Tags;
public class MechanicalPistonBlock extends KineticBlock {
public class MechanicalPistonBlock extends DirectionalAxisKineticBlock {
public static final EnumProperty<PistonState> STATE = EnumProperty.create("state", PistonState.class);
public static final DirectionProperty FACING = BlockStateProperties.FACING;
public static final BooleanProperty AXIS_ALONG_FIRST_COORDINATE = BooleanProperty.create("axis_along_first");
protected static final VoxelShape BASE_SHAPE_UP = makeCuboidShape(0, 0, 0, 16, 12, 16),
BASE_SHAPE_DOWN = makeCuboidShape(0, 4, 0, 16, 16, 16),
@ -63,60 +56,10 @@ public class MechanicalPistonBlock extends KineticBlock {
@Override
protected void fillStateContainer(Builder<Block, BlockState> builder) {
builder.add(STATE, FACING, AXIS_ALONG_FIRST_COORDINATE);
builder.add(STATE);
super.fillStateContainer(builder);
}
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
Direction facing = context.getNearestLookingDirection().getOpposite();
BlockPos pos = context.getPos();
World world = context.getWorld();
boolean alongFirst = false;
if (context.isPlacerSneaking())
facing = facing.getOpposite();
if (facing.getAxis().isHorizontal()) {
alongFirst = facing.getAxis() == Axis.Z;
Block blockAbove = world.getBlockState(pos.offset(Direction.UP)).getBlock();
boolean shaftAbove = blockAbove instanceof IRotate && ((IRotate) blockAbove).hasShaftTowards(world,
pos.up(), world.getBlockState(pos.up()), Direction.DOWN);
Block blockBelow = world.getBlockState(pos.offset(Direction.DOWN)).getBlock();
boolean shaftBelow = blockBelow instanceof IRotate && ((IRotate) blockBelow).hasShaftTowards(world,
pos.down(), world.getBlockState(pos.down()), Direction.UP);
if (shaftAbove || shaftBelow)
alongFirst = facing.getAxis() == Axis.X;
}
if (facing.getAxis().isVertical()) {
alongFirst = context.getPlacementHorizontalFacing().getAxis() == Axis.X;
Direction prefferedSide = null;
for (Direction side : Direction.values()) {
if (side.getAxis().isVertical())
continue;
BlockState blockState = context.getWorld().getBlockState(context.getPos().offset(side));
if (blockState.getBlock() instanceof IRotate) {
if (((IRotate) blockState.getBlock()).hasShaftTowards(context.getWorld(),
context.getPos().offset(side), blockState, side.getOpposite()))
if (prefferedSide != null && prefferedSide.getAxis() != side.getAxis()) {
prefferedSide = null;
break;
} else {
prefferedSide = side;
}
}
}
if (prefferedSide != null) {
alongFirst = prefferedSide.getAxis() == Axis.X;
}
}
return this.getDefaultState().with(FACING, facing).with(STATE, PistonState.RETRACTED)
.with(AXIS_ALONG_FIRST_COORDINATE, alongFirst);
}
@Override
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn,
BlockRayTraceResult hit) {
@ -154,26 +97,6 @@ public class MechanicalPistonBlock extends KineticBlock {
return true;
}
@Override
public Axis getRotationAxis(BlockState state) {
Axis pistonAxis = state.get(FACING).getAxis();
boolean alongFirst = state.get(AXIS_ALONG_FIRST_COORDINATE);
if (pistonAxis == Axis.X)
return alongFirst ? Axis.Y : Axis.Z;
if (pistonAxis == Axis.Y)
return alongFirst ? Axis.X : Axis.Z;
if (pistonAxis == Axis.Z)
return alongFirst ? Axis.X : Axis.Y;
return super.getRotationAxis(state);
}
@Override
public boolean hasShaftTowards(World world, BlockPos pos, BlockState state, Direction face) {
return face.getAxis() == getRotationAxis(state);
}
public enum PistonState implements IStringSerializable {
RETRACTED, MOVING, EXTENDED;

View file

@ -11,6 +11,7 @@ import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllTileEntities;
import com.simibubi.create.Create;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.contraptions.receivers.SawBlock;
import com.simibubi.create.modules.contraptions.receivers.constructs.IHaveMovementBehavior.MovementContext;
import com.simibubi.create.modules.contraptions.receivers.constructs.IHaveMovementBehavior.MoverType;
import com.simibubi.create.modules.contraptions.receivers.constructs.MechanicalPistonBlock.PistonState;
@ -180,6 +181,9 @@ public class MechanicalPistonTileEntity extends KineticTileEntity implements ITi
state = state.updatePostPlacement(face, world.getBlockState(targetPos.offset(face)), world, targetPos,
targetPos.offset(face));
if (AllBlocks.SAW.typeOf(state))
state = state.with(SawBlock.RUNNING, false);
world.destroyBlock(targetPos, world.getBlockState(targetPos).getCollisionShape(world, targetPos).isEmpty());
getWorld().setBlockState(targetPos, state, 3);
TileEntity tileEntity = world.getTileEntity(targetPos);

View file

@ -20,6 +20,7 @@ import org.apache.commons.lang3.tuple.MutablePair;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateConfig;
import com.simibubi.create.modules.contraptions.receivers.SawBlock;
import com.simibubi.create.modules.contraptions.receivers.constructs.IHaveMovementBehavior.MovementContext;
import com.simibubi.create.modules.contraptions.receivers.constructs.MechanicalPistonBlock.PistonState;
@ -419,6 +420,8 @@ public class TranslationConstruct {
private static BlockInfo capture(World world, BlockPos pos) {
BlockState blockstate = world.getBlockState(pos);
if (AllBlocks.SAW.typeOf(blockstate))
blockstate = blockstate.with(SawBlock.RUNNING, true);
TileEntity tileentity = world.getTileEntity(pos);
CompoundNBT compoundnbt = null;
if (tileentity != null) {

View file

@ -8,6 +8,7 @@ import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.ItemStackHelper;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ActionResult;
@ -60,6 +61,10 @@ public class CardboardBoxItem extends Item {
return box;
}
@Override
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
}
public static void addAddress(ItemStack box, String address) {
box.getOrCreateTag().putString("Address", address);
}

View file

@ -0,0 +1,33 @@
{
"forge_marker": 1,
"variants": {
"axis_along_first=true,running=true,facing=up": { "model": "create:block/saw", "y": 90 },
"axis_along_first=false,running=true,facing=up": { "model": "create:block/saw" },
"axis_along_first=true,running=true,facing=down": { "model": "create:block/saw", "x": 180, "y": 90 },
"axis_along_first=false,running=true,facing=down": { "model": "create:block/saw", "x": 180 },
"axis_along_first=true,running=false,facing=up": { "model": "create:block/saw_inactive", "y": 90 },
"axis_along_first=false,running=false,facing=up": { "model": "create:block/saw_inactive" },
"axis_along_first=true,running=false,facing=down": { "model": "create:block/saw_inactive", "x": 180, "y": 90 },
"axis_along_first=false,running=false,facing=down": { "model": "create:block/saw_inactive", "x": 180 },
"axis_along_first=false,running=true,facing=south": { "model": "create:block/saw_horizontal", "y": 0 },
"axis_along_first=false,running=true,facing=north": { "model": "create:block/saw_horizontal", "y": 180 },
"axis_along_first=false,running=true,facing=west": { "model": "create:block/saw_horizontal", "y": 90 },
"axis_along_first=false,running=true,facing=east": { "model": "create:block/saw_horizontal", "y": 270 },
"axis_along_first=true,running=true,facing=south": { "model": "create:block/saw_horizontal", "y": 0 },
"axis_along_first=true,running=true,facing=north": { "model": "create:block/saw_horizontal", "y": 180 },
"axis_along_first=true,running=true,facing=west": { "model": "create:block/saw_horizontal", "y": 90 },
"axis_along_first=true,running=true,facing=east": { "model": "create:block/saw_horizontal", "y": 270 },
"axis_along_first=false,running=false,facing=south": { "model": "create:block/saw_horizontal_inactive", "y": 0 },
"axis_along_first=false,running=false,facing=north": { "model": "create:block/saw_horizontal_inactive", "y": 180 },
"axis_along_first=false,running=false,facing=west": { "model": "create:block/saw_horizontal_inactive", "y": 90 },
"axis_along_first=false,running=false,facing=east": { "model": "create:block/saw_horizontal_inactive", "y": 270 },
"axis_along_first=true,running=false,facing=south": { "model": "create:block/saw_horizontal_inactive", "y": 0 },
"axis_along_first=true,running=false,facing=north": { "model": "create:block/saw_horizontal_inactive", "y": 180 },
"axis_along_first=true,running=false,facing=west": { "model": "create:block/saw_horizontal_inactive", "y": 90 },
"axis_along_first=true,running=false,facing=east": { "model": "create:block/saw_horizontal_inactive", "y": 270 }
}
}

View file

@ -23,6 +23,8 @@
"item.create.propeller": "Propeller",
"item.create.flour": "Wheat Flour",
"item.create.dough": "Dough",
"item.create.crushed_iron": "Crushed Iron Ore",
"item.create.crushed_gold": "Crushed Gold Ore",
"item.create.logistical_controller_supply": "Item Supply",
"item.create.logistical_controller_request": "Item Request",
@ -60,6 +62,7 @@
"block.create.crushing_wheel": "Crushing Wheel",
"block.create.drill": "Mechanical Drill",
"block.create.harvester": "Mechanical Harvester",
"block.create.saw": "Mechanical Saw",
"block.create.water_wheel": "Water Wheel",
"block.create.belt_support": "Belt Support",
"block.create.mechanical_press": "Mechanical Press",

View file

@ -2,7 +2,8 @@
"__comment": "Model generated using MrCrayfish's Model Creator (https://mrcrayfish.com/tools?id=mc)",
"textures": {
"gearbox_top": "create:block/gearbox_top",
"anvil": "minecraft:block/anvil",
"anvil": "create:block/noisy_iron_block",
"anvil2": "minecraft:block/anvil",
"gearbox": "create:block/gearbox",
"axis_top": "create:block/axis_top",
"axis": "create:block/axis",
@ -14,12 +15,12 @@
"from": [ 4, 4, 11 ],
"to": [ 12, 12, 13 ],
"faces": {
"north": { "texture": "#anvil", "uv": [ 3, 3, 11, 11 ] },
"east": { "texture": "#anvil", "uv": [ 10, 5, 12, 13 ] },
"south": { "texture": "#anvil", "uv": [ 3, 3, 11, 11 ] },
"west": { "texture": "#anvil", "uv": [ 8, 4, 10, 12 ] },
"up": { "texture": "#anvil", "uv": [ 5, 5, 13, 7 ] },
"down": { "texture": "#anvil", "uv": [ 4, 3, 12, 5 ] }
"north": { "texture": "#anvil2", "uv": [ 3, 3, 11, 11 ] },
"east": { "texture": "#anvil2", "uv": [ 10, 5, 12, 13 ] },
"south": { "texture": "#anvil2", "uv": [ 3, 3, 11, 11 ] },
"west": { "texture": "#anvil2", "uv": [ 8, 4, 10, 12 ] },
"up": { "texture": "#anvil2", "uv": [ 5, 5, 13, 7 ] },
"down": { "texture": "#anvil2", "uv": [ 4, 3, 12, 5 ] }
}
},
{

View file

@ -5,7 +5,8 @@
"gearbox": "create:block/gearbox",
"stonecutter_saw": "minecraft:block/stonecutter_saw",
"andesite_casing_short": "create:block/andesite_casing_short",
"mechanical_saw_top": "create:block/mechanical_saw_top"
"mechanical_saw_top": "create:block/mechanical_saw_top",
"particle": "create:block/mechanical_saw_top"
},
"elements": [
{
@ -67,14 +68,14 @@
},
{
"name": "Top",
"from": [ 0, 12, 3 ],
"to": [ 16, 13, 13 ],
"from": [ 0, 12, 2 ],
"to": [ 16, 13, 14 ],
"faces": {
"north": { "texture": "#mechanical_saw_top", "uv": [ 0, 12, 16, 13 ] },
"north": { "texture": "#mechanical_saw_top", "uv": [ 0, 13, 16, 14 ] },
"east": { "texture": "#mechanical_saw_top", "uv": [ 0, 3, 1, 13 ], "rotation": 90 },
"south": { "texture": "#mechanical_saw_top", "uv": [ 0, 3, 16, 4 ] },
"south": { "texture": "#mechanical_saw_top", "uv": [ 0, 2, 16, 3 ] },
"west": { "texture": "#mechanical_saw_top", "uv": [ 15, 3, 16, 13 ], "rotation": 270 },
"up": { "texture": "#mechanical_saw_top", "uv": [ 0, 3, 16, 13 ] }
"up": { "texture": "#mechanical_saw_top", "uv": [ 0, 2, 16, 14 ] }
}
}
]

View file

@ -0,0 +1,98 @@
{
"__comment": "Model generated using MrCrayfish's Model Creator (https://mrcrayfish.com/tools?id=mc)",
"textures": {
"particle": "create:block/gearbox_top",
"slit": "create:block/mechanical_saw_top",
"gearbox_top": "create:block/gearbox_top",
"encased_belt": "create:block/encased_belt",
"stonecutter_saw": "minecraft:block/stonecutter_saw",
"gearbox": "create:block/gearbox",
"andesite_casing_short": "create:block/andesite_casing_short"
},
"parent": "create:block/block",
"elements": [
{
"name": "Bottom",
"from": [ 0, 0, 0 ],
"to": [ 16, 2, 12 ],
"faces": {
"north": { "texture": "#andesite_casing_short", "uv": [ 0, 14, 16, 16 ] },
"east": { "texture": "#andesite_casing_short", "uv": [ 4, 14, 16, 16 ] },
"south": { "texture": "#encased_belt", "uv": [ 0, 14, 16, 16 ] },
"west": { "texture": "#andesite_casing_short", "uv": [ 0, 14, 12, 16 ] },
"up": { "texture": "#andesite_casing_short", "uv": [ 0, 4, 16, 16 ] },
"down": { "texture": "#andesite_casing_short", "uv": [ 0, 4, 16, 16 ] }
}
},
{
"name": "Top",
"from": [ 0, 14, 0 ],
"to": [ 16, 16, 12 ],
"faces": {
"north": { "texture": "#andesite_casing_short", "uv": [ 0, 4, 16, 6 ] },
"east": { "texture": "#andesite_casing_short", "uv": [ 4, 4, 16, 6 ] },
"south": { "texture": "#encased_belt", "uv": [ 0, 0, 16, 2 ] },
"west": { "texture": "#andesite_casing_short", "uv": [ 0, 4, 12, 6 ] },
"up": { "texture": "#andesite_casing_short", "uv": [ 0, 4, 16, 16 ] },
"down": { "texture": "#andesite_casing_short", "uv": [ 0, 4, 16, 16 ] }
}
},
{
"name": "Back",
"from": [ 0, 2, 0 ],
"to": [ 2, 14, 2 ],
"faces": {
"north": { "texture": "#gearbox_top", "uv": [ 14, 2, 16, 14 ] },
"east": { "texture": "#gearbox_top", "uv": [ 14, 2, 16, 14 ] },
"south": { "texture": "#gearbox_top", "uv": [ 0, 2, 2, 14 ] },
"west": { "texture": "#gearbox_top", "uv": [ 0, 2, 2, 14 ] }
}
},
{
"name": "Inner",
"from": [ 0, 2, 2 ],
"to": [ 16, 14, 11 ],
"faces": {
"east": { "texture": "#andesite_casing_short", "uv": [ 2, 6, 14, 15 ], "rotation": 90 },
"south": { "texture": "#gearbox_top", "uv": [ 0, 2, 16, 14 ] },
"west": { "texture": "#andesite_casing_short", "uv": [ 2, 6, 14, 15 ], "rotation": 270 }
}
},
{
"name": "SawSlit",
"from": [ 1, 7, 11.062 ],
"to": [ 15, 9, 11.062 ],
"faces": {
"south": { "texture": "#slit", "uv": [ 1, 7, 15, 9 ] }
}
},
{
"name": "Blade",
"from": [ 1, 8, 11 ],
"to": [ 15, 8.062, 18 ],
"faces": {
"up": { "texture": "#stonecutter_saw", "uv": [ 1, 9, 15, 16 ], "rotation": 180 },
"down": { "texture": "#stonecutter_saw", "uv": [ 1, 9, 15, 16 ] }
}
},
{
"name": "Back",
"from": [ 14, 2, 0 ],
"to": [ 16, 14, 2 ],
"faces": {
"north": { "texture": "#gearbox_top", "uv": [ 0, 2, 2, 14 ] },
"east": { "texture": "#gearbox_top", "uv": [ 14, 2, 16, 14 ] },
"south": { "texture": "#gearbox_top", "uv": [ 0, 2, 2, 14 ] },
"west": { "texture": "#gearbox_top", "uv": [ 0, 2, 2, 14 ] }
}
},
{
"name": "Back",
"from": [ 2, 2, 1 ],
"to": [ 14, 14, 2 ],
"faces": {
"north": { "texture": "#gearbox", "uv": [ 2, 2, 14, 14 ] }
}
}
]
}

View file

@ -0,0 +1,6 @@
{
"parent": "create:block/saw_horizontal",
"textures": {
"stonecutter_saw": "create:block/static_saw"
}
}

View file

@ -1,6 +1,6 @@
{
"parent": "create:block/saw",
"textures": {
"stonecutter_saw": "create:block/static_saw",
"stonecutter_saw": "create:block/static_saw"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "create:item/crushed_gold"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "create:item/crushed_iron"
}
}

View file

@ -2,7 +2,8 @@
"__comment": "Model generated using MrCrayfish's Model Creator (https://mrcrayfish.com/tools?id=mc)",
"textures": {
"gearbox_top": "create:block/gearbox_top",
"anvil": "minecraft:block/anvil",
"anvil": "create:block/noisy_iron_block",
"anvil2": "minecraft:block/anvil",
"gearbox": "create:block/gearbox",
"andesite_casing_short": "create:block/andesite_casing_short"
},
@ -70,12 +71,12 @@
"from": [ 4, 4, 11 ],
"to": [ 12, 12, 13 ],
"faces": {
"north": { "texture": "#anvil", "uv": [ 3, 3, 11, 11 ] },
"east": { "texture": "#anvil", "uv": [ 10, 5, 12, 13 ] },
"south": { "texture": "#anvil", "uv": [ 3, 3, 11, 11 ] },
"west": { "texture": "#anvil", "uv": [ 8, 4, 10, 12 ] },
"up": { "texture": "#anvil", "uv": [ 5, 5, 13, 7 ] },
"down": { "texture": "#anvil", "uv": [ 4, 3, 12, 5 ] }
"north": { "texture": "#anvil2", "uv": [ 3, 3, 11, 11 ] },
"east": { "texture": "#anvil2", "uv": [ 10, 5, 12, 13 ] },
"south": { "texture": "#anvil2", "uv": [ 3, 3, 11, 11 ] },
"west": { "texture": "#anvil2", "uv": [ 8, 4, 10, 12 ] },
"up": { "texture": "#anvil2", "uv": [ 5, 5, 13, 7 ] },
"down": { "texture": "#anvil2", "uv": [ 4, 3, 12, 5 ] }
}
},
{

View file

@ -0,0 +1,3 @@
{
"parent": "create:block/saw_horizontal"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 557 B

After

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 409 B

After

Width:  |  Height:  |  Size: 410 B

View file

@ -8,13 +8,13 @@
],
"results": [
{
"item": "minecraft:gold_ingot",
"item": "create:crushed_gold",
"count": 1
},
{
"item": "minecraft:gold_nugget",
"count": 9,
"chance": 0.5
"item": "create:crushed_gold",
"count": 2,
"chance": 0.3
},
{
"item": "minecraft:cobblestone",

View file

@ -8,13 +8,13 @@
],
"results": [
{
"item": "minecraft:iron_ingot",
"item": "create:crushed_iron",
"count": 1
},
{
"item": "minecraft:iron_nugget",
"count": 9,
"chance": 0.5
"item": "create:crushed_iron",
"count": 2,
"chance": 0.3
},
{
"item": "minecraft:cobblestone",

View file

@ -0,0 +1,15 @@
{
"type": "minecraft:smelting",
"ingredient": {
"item": "create:crushed_gold"
},
"result": "minecraft:gold_ingot",
"experience": 0.1,
"cookingtime": 200,
"conditions": [
{
"type": "create:module",
"module": "contraptions"
}
]
}

View file

@ -0,0 +1,15 @@
{
"type": "minecraft:smelting",
"ingredient": {
"item": "create:crushed_iron"
},
"result": "minecraft:iron_ingot",
"experience": 0.1,
"cookingtime": 200,
"conditions": [
{
"type": "create:module",
"module": "contraptions"
}
]
}

View file

@ -0,0 +1,22 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "create:crushed_gold"
}
],
"results": [
{
"item": "minecraft:gold_nugget",
"count": 10,
"chance": 1
},
{
"item": "minecraft:gold_nugget",
"count": 5,
"chance": 0.5
}
],
"processingTime": 100
}

View file

@ -0,0 +1,22 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "create:crushed_iron"
}
],
"results": [
{
"item": "minecraft:iron_nugget",
"count": 10,
"chance": 1
},
{
"item": "minecraft:iron_nugget",
"count": 5,
"chance": 0.5
}
],
"processingTime": 100
}