mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-29 08:27:03 +01:00
Merge branch 'mc1.15/dev' of https://github.com/Creators-of-Create/Create into mc1.15/dev
This commit is contained in:
commit
d5c98043ad
18 changed files with 592 additions and 174 deletions
|
@ -16,7 +16,7 @@ a579c40c43dc2174afb66f42d00d0c4a0efaaeee assets\create\blockstates\andesite_bric
|
|||
82bd82270aff7d51e9239680ef4dd7b5c899ceb0 assets\create\blockstates\andesite_cobblestone_wall.json
|
||||
398922758a6219544e5b85c91c9cf8a543b437e5 assets\create\blockstates\andesite_pillar.json
|
||||
f9fa6aa530eb0891a74eadfbebc663172a57147a assets\create\blockstates\basin.json
|
||||
96a4fae5883eda130f8ec1a57d34534f6d0793c4 assets\create\blockstates\belt.json
|
||||
020a68d610b2fe298e5b0cee0dadfe8ac719c08c assets\create\blockstates\belt.json
|
||||
9bbc9a2dc2428175ae0cadf7537ed6815e3e241d assets\create\blockstates\belt_funnel.json
|
||||
40d10934934ea142d71fc6ce598b1455c3ad47b4 assets\create\blockstates\belt_observer.json
|
||||
4325605fbdea60d5f54286c309c825bebcd74b95 assets\create\blockstates\belt_tunnel.json
|
||||
|
|
|
@ -511,6 +511,142 @@
|
|||
"model": "create:block/belt_casing/vertical_pulley",
|
||||
"x": 90,
|
||||
"y": 270
|
||||
},
|
||||
"casing=false,facing=north,part=start,slope=sideways": {
|
||||
"model": "create:block/belt/sideways_end",
|
||||
"x": 180,
|
||||
"y": 180
|
||||
},
|
||||
"casing=true,facing=north,part=start,slope=sideways": {
|
||||
"model": "create:block/belt_casing/sideways_start",
|
||||
"x": 180,
|
||||
"y": 180
|
||||
},
|
||||
"casing=false,facing=south,part=start,slope=sideways": {
|
||||
"model": "create:block/belt/sideways_start"
|
||||
},
|
||||
"casing=true,facing=south,part=start,slope=sideways": {
|
||||
"model": "create:block/belt_casing/sideways_start"
|
||||
},
|
||||
"casing=false,facing=west,part=start,slope=sideways": {
|
||||
"model": "create:block/belt/sideways_end",
|
||||
"x": 180,
|
||||
"y": 90
|
||||
},
|
||||
"casing=true,facing=west,part=start,slope=sideways": {
|
||||
"model": "create:block/belt_casing/sideways_start",
|
||||
"x": 180,
|
||||
"y": 90
|
||||
},
|
||||
"casing=false,facing=east,part=start,slope=sideways": {
|
||||
"model": "create:block/belt/sideways_start",
|
||||
"y": 270
|
||||
},
|
||||
"casing=true,facing=east,part=start,slope=sideways": {
|
||||
"model": "create:block/belt_casing/sideways_start",
|
||||
"y": 270
|
||||
},
|
||||
"casing=false,facing=north,part=middle,slope=sideways": {
|
||||
"model": "create:block/belt/sideways_middle",
|
||||
"x": 180,
|
||||
"y": 180
|
||||
},
|
||||
"casing=true,facing=north,part=middle,slope=sideways": {
|
||||
"model": "create:block/belt_casing/sideways_middle",
|
||||
"x": 180,
|
||||
"y": 180
|
||||
},
|
||||
"casing=false,facing=south,part=middle,slope=sideways": {
|
||||
"model": "create:block/belt/sideways_middle"
|
||||
},
|
||||
"casing=true,facing=south,part=middle,slope=sideways": {
|
||||
"model": "create:block/belt_casing/sideways_middle"
|
||||
},
|
||||
"casing=false,facing=west,part=middle,slope=sideways": {
|
||||
"model": "create:block/belt/sideways_middle",
|
||||
"x": 180,
|
||||
"y": 90
|
||||
},
|
||||
"casing=true,facing=west,part=middle,slope=sideways": {
|
||||
"model": "create:block/belt_casing/sideways_middle",
|
||||
"x": 180,
|
||||
"y": 90
|
||||
},
|
||||
"casing=false,facing=east,part=middle,slope=sideways": {
|
||||
"model": "create:block/belt/sideways_middle",
|
||||
"y": 270
|
||||
},
|
||||
"casing=true,facing=east,part=middle,slope=sideways": {
|
||||
"model": "create:block/belt_casing/sideways_middle",
|
||||
"y": 270
|
||||
},
|
||||
"casing=false,facing=north,part=end,slope=sideways": {
|
||||
"model": "create:block/belt/sideways_start",
|
||||
"x": 180,
|
||||
"y": 180
|
||||
},
|
||||
"casing=true,facing=north,part=end,slope=sideways": {
|
||||
"model": "create:block/belt_casing/sideways_end",
|
||||
"x": 180,
|
||||
"y": 180
|
||||
},
|
||||
"casing=false,facing=south,part=end,slope=sideways": {
|
||||
"model": "create:block/belt/sideways_end"
|
||||
},
|
||||
"casing=true,facing=south,part=end,slope=sideways": {
|
||||
"model": "create:block/belt_casing/sideways_end"
|
||||
},
|
||||
"casing=false,facing=west,part=end,slope=sideways": {
|
||||
"model": "create:block/belt/sideways_start",
|
||||
"x": 180,
|
||||
"y": 90
|
||||
},
|
||||
"casing=true,facing=west,part=end,slope=sideways": {
|
||||
"model": "create:block/belt_casing/sideways_end",
|
||||
"x": 180,
|
||||
"y": 90
|
||||
},
|
||||
"casing=false,facing=east,part=end,slope=sideways": {
|
||||
"model": "create:block/belt/sideways_end",
|
||||
"y": 270
|
||||
},
|
||||
"casing=true,facing=east,part=end,slope=sideways": {
|
||||
"model": "create:block/belt_casing/sideways_end",
|
||||
"y": 270
|
||||
},
|
||||
"casing=false,facing=north,part=pulley,slope=sideways": {
|
||||
"model": "create:block/belt/sideways_middle",
|
||||
"x": 180,
|
||||
"y": 180
|
||||
},
|
||||
"casing=true,facing=north,part=pulley,slope=sideways": {
|
||||
"model": "create:block/belt_casing/sideways_pulley",
|
||||
"x": 180,
|
||||
"y": 180
|
||||
},
|
||||
"casing=false,facing=south,part=pulley,slope=sideways": {
|
||||
"model": "create:block/belt/sideways_middle"
|
||||
},
|
||||
"casing=true,facing=south,part=pulley,slope=sideways": {
|
||||
"model": "create:block/belt_casing/sideways_pulley"
|
||||
},
|
||||
"casing=false,facing=west,part=pulley,slope=sideways": {
|
||||
"model": "create:block/belt/sideways_middle",
|
||||
"x": 180,
|
||||
"y": 90
|
||||
},
|
||||
"casing=true,facing=west,part=pulley,slope=sideways": {
|
||||
"model": "create:block/belt_casing/sideways_pulley",
|
||||
"x": 180,
|
||||
"y": 90
|
||||
},
|
||||
"casing=false,facing=east,part=pulley,slope=sideways": {
|
||||
"model": "create:block/belt/sideways_middle",
|
||||
"y": 270
|
||||
},
|
||||
"casing=true,facing=east,part=pulley,slope=sideways": {
|
||||
"model": "create:block/belt_casing/sideways_pulley",
|
||||
"y": 270
|
||||
}
|
||||
}
|
||||
}
|
|
@ -391,6 +391,21 @@ public class AllBlocks {
|
|||
.simpleItem()
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<DepotBlock> DEPOT = REGISTRATE.block("depot", DepotBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p)))
|
||||
.item()
|
||||
.transform(customItemModel("_", "block"))
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<ChuteBlock> CHUTE = REGISTRATE.block("chute", ChuteBlock::new)
|
||||
.initialProperties(SharedProperties::softMetal)
|
||||
.addLayer(() -> RenderType::getCutoutMipped)
|
||||
.blockstate(new ChuteGenerator()::generate)
|
||||
.item(ChuteItem::new)
|
||||
.transform(customItemModel("_", "block"))
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<GaugeBlock> SPEEDOMETER = REGISTRATE.block("speedometer", GaugeBlock::speed)
|
||||
.initialProperties(SharedProperties::wooden)
|
||||
.transform(StressConfigDefaults.setNoImpact())
|
||||
|
@ -671,12 +686,41 @@ public class AllBlocks {
|
|||
.transform(customItemModel())
|
||||
.register();
|
||||
|
||||
|
||||
// Logistics
|
||||
|
||||
static {
|
||||
REGISTRATE.startSection(AllSections.LOGISTICS);
|
||||
}
|
||||
|
||||
public static final BlockEntry<ArmBlock> MECHANICAL_ARM = REGISTRATE.block("mechanical_arm", ArmBlock::new)
|
||||
.initialProperties(SharedProperties::softMetal)
|
||||
.blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p)))
|
||||
.transform(StressConfigDefaults.setImpact(8.0))
|
||||
.item(ArmItem::new)
|
||||
.transform(customItemModel())
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<RealityFunnelBlock> REALITY_FUNNEL =
|
||||
REGISTRATE.block("reality_funnel", RealityFunnelBlock::new)
|
||||
.initialProperties(SharedProperties::softMetal)
|
||||
.blockstate((c, p) -> p.directionalBlock(c.get(), AssetLookup.forPowered(c, p)))
|
||||
.item(FunnelItem::new)
|
||||
.transform(customItemModel())
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<BeltFunnelBlock> BELT_FUNNEL = REGISTRATE.block("belt_funnel", BeltFunnelBlock::new)
|
||||
.initialProperties(SharedProperties::softMetal)
|
||||
.blockstate(new BeltFunnelGenerator()::generate)
|
||||
.loot((p, b) -> p.registerDropping(b, REALITY_FUNNEL.get()))
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<ChuteFunnelBlock> CHUTE_FUNNEL = REGISTRATE.block("chute_funnel", ChuteFunnelBlock::new)
|
||||
.initialProperties(SharedProperties::softMetal)
|
||||
.blockstate(new ChuteFunnelGenerator()::generate)
|
||||
.loot((p, b) -> p.registerDropping(b, REALITY_FUNNEL.get()))
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<RedstoneContactBlock> REDSTONE_CONTACT =
|
||||
REGISTRATE.block("redstone_contact", RedstoneContactBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
|
@ -722,47 +766,6 @@ public class AllBlocks {
|
|||
.transform(BuilderTransformers.crate("creative"))
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<ChuteBlock> CHUTE = REGISTRATE.block("chute", ChuteBlock::new)
|
||||
.initialProperties(SharedProperties::softMetal)
|
||||
.addLayer(() -> RenderType::getCutoutMipped)
|
||||
.blockstate(new ChuteGenerator()::generate)
|
||||
.item(ChuteItem::new)
|
||||
.transform(customItemModel("_", "block"))
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<PackagerBlock> PACKAGER = REGISTRATE.block("packager", PackagerBlock::new)
|
||||
.initialProperties(SharedProperties::softMetal)
|
||||
.transform(StressConfigDefaults.setImpact(4.0))
|
||||
.properties(p -> p.nonOpaque())
|
||||
.blockstate((c, p) -> p.getVariantBuilder(c.get())
|
||||
.forAllStates(s -> ConfiguredModel.builder()
|
||||
.modelFile(AssetLookup.partialBaseModel(c, p))
|
||||
.rotationY(s.get(PackagerBlock.HORIZONTAL_AXIS) == Axis.X ? 90 : 0)
|
||||
.build()))
|
||||
.item()
|
||||
.transform(customItemModel())
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<RealityFunnelBlock> REALITY_FUNNEL =
|
||||
REGISTRATE.block("reality_funnel", RealityFunnelBlock::new)
|
||||
.initialProperties(SharedProperties::softMetal)
|
||||
.blockstate((c, p) -> p.directionalBlock(c.get(), AssetLookup.forPowered(c, p)))
|
||||
.item(FunnelItem::new)
|
||||
.transform(customItemModel())
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<BeltFunnelBlock> BELT_FUNNEL = REGISTRATE.block("belt_funnel", BeltFunnelBlock::new)
|
||||
.initialProperties(SharedProperties::softMetal)
|
||||
.blockstate(new BeltFunnelGenerator()::generate)
|
||||
.loot((p, b) -> p.registerDropping(b, REALITY_FUNNEL.get()))
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<ChuteFunnelBlock> CHUTE_FUNNEL = REGISTRATE.block("chute_funnel", ChuteFunnelBlock::new)
|
||||
.initialProperties(SharedProperties::softMetal)
|
||||
.blockstate(new ChuteFunnelGenerator()::generate)
|
||||
.loot((p, b) -> p.registerDropping(b, REALITY_FUNNEL.get()))
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<BeltObserverBlock> BELT_OBSERVER =
|
||||
REGISTRATE.block("belt_observer", BeltObserverBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
|
@ -785,19 +788,17 @@ public class AllBlocks {
|
|||
.transform(customItemModel())
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<ArmBlock> MECHANICAL_ARM = REGISTRATE.block("mechanical_arm", ArmBlock::new)
|
||||
public static final BlockEntry<PackagerBlock> PACKAGER = REGISTRATE.block("packager", PackagerBlock::new)
|
||||
.initialProperties(SharedProperties::softMetal)
|
||||
.blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p)))
|
||||
.transform(StressConfigDefaults.setImpact(8.0))
|
||||
.item(ArmItem::new)
|
||||
.transform(customItemModel())
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<DepotBlock> DEPOT = REGISTRATE.block("depot", DepotBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p)))
|
||||
.transform(StressConfigDefaults.setImpact(4.0))
|
||||
.properties(p -> p.nonOpaque())
|
||||
.blockstate((c, p) -> p.getVariantBuilder(c.get())
|
||||
.forAllStates(s -> ConfiguredModel.builder()
|
||||
.modelFile(AssetLookup.partialBaseModel(c, p))
|
||||
.rotationY(s.get(PackagerBlock.HORIZONTAL_AXIS) == Axis.X ? 90 : 0)
|
||||
.build()))
|
||||
.item()
|
||||
.transform(customItemModel("_", "block"))
|
||||
.transform(customItemModel())
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<ExtractorBlock> EXTRACTOR = REGISTRATE.block("extractor", ExtractorBlock::new)
|
||||
|
|
|
@ -89,7 +89,8 @@ public class StructureTransform {
|
|||
if (state.get(BlockStateProperties.BELL_ATTACHMENT) == BellAttachment.DOUBLE_WALL) {
|
||||
state = state.with(BlockStateProperties.BELL_ATTACHMENT, BellAttachment.SINGLE_WALL);
|
||||
}
|
||||
return state.with(HorizontalFaceBlock.HORIZONTAL_FACING, rotation.rotate(state.get(HorizontalFaceBlock.HORIZONTAL_FACING)));
|
||||
return state.with(HorizontalFaceBlock.HORIZONTAL_FACING,
|
||||
rotation.rotate(state.get(HorizontalFaceBlock.HORIZONTAL_FACING)));
|
||||
}
|
||||
return state.rotate(rotation);
|
||||
}
|
||||
|
@ -127,62 +128,14 @@ public class StructureTransform {
|
|||
return state;
|
||||
}
|
||||
|
||||
boolean halfTurn = rotation == Rotation.CLOCKWISE_180;
|
||||
if (block instanceof StairsBlock) {
|
||||
if (state.get(StairsBlock.FACING).getAxis() != rotationAxis) {
|
||||
for (int i = 0; i < rotation.ordinal(); i++) {
|
||||
Direction direction = state.get(StairsBlock.FACING);
|
||||
Half half = state.get(StairsBlock.HALF);
|
||||
if (direction.getAxisDirection() == AxisDirection.POSITIVE ^ half == Half.BOTTOM
|
||||
^ direction.getAxis() == Axis.Z)
|
||||
state = state.cycle(StairsBlock.HALF);
|
||||
else
|
||||
state = state.with(StairsBlock.FACING, direction.getOpposite());
|
||||
}
|
||||
} else {
|
||||
if (rotation == Rotation.CLOCKWISE_180) {
|
||||
state = state.cycle(StairsBlock.HALF);
|
||||
}
|
||||
}
|
||||
state = transformStairs(state, halfTurn);
|
||||
return state;
|
||||
}
|
||||
|
||||
if (AllBlocks.BELT.has(state)) {
|
||||
if (state.get(BeltBlock.HORIZONTAL_FACING).getAxis() != rotationAxis) {
|
||||
for (int i = 0; i < rotation.ordinal(); i++) {
|
||||
Slope slope = state.get(BeltBlock.SLOPE);
|
||||
Direction direction = state.get(BeltBlock.HORIZONTAL_FACING);
|
||||
|
||||
// Rotate diagonal
|
||||
if (slope != Slope.HORIZONTAL && slope != Slope.VERTICAL) {
|
||||
if (direction.getAxisDirection() == AxisDirection.POSITIVE ^ slope == Slope.DOWNWARD
|
||||
^ direction.getAxis() == Axis.Z) {
|
||||
state = state.with(BeltBlock.SLOPE, slope == Slope.UPWARD ? Slope.DOWNWARD : Slope.UPWARD);
|
||||
} else {
|
||||
state = state.with(BeltBlock.HORIZONTAL_FACING, direction.getOpposite());
|
||||
}
|
||||
|
||||
// Rotate horizontal/vertical
|
||||
} else {
|
||||
if (slope == Slope.HORIZONTAL ^ direction.getAxis() == Axis.Z) {
|
||||
state = state.with(BeltBlock.HORIZONTAL_FACING, direction.getOpposite());
|
||||
}
|
||||
state =
|
||||
state.with(BeltBlock.SLOPE, slope == Slope.HORIZONTAL ? Slope.VERTICAL : Slope.HORIZONTAL);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (rotation == Rotation.CLOCKWISE_180) {
|
||||
Slope slope = state.get(BeltBlock.SLOPE);
|
||||
Direction direction = state.get(BeltBlock.HORIZONTAL_FACING);
|
||||
if (slope == Slope.UPWARD || slope == Slope.DOWNWARD) {
|
||||
state = state
|
||||
.with(BeltBlock.SLOPE, slope == Slope.UPWARD ? Slope.DOWNWARD
|
||||
: slope == Slope.DOWNWARD ? Slope.UPWARD : slope);
|
||||
} else if (slope == Slope.VERTICAL) {
|
||||
state = state.with(BeltBlock.HORIZONTAL_FACING, direction.getOpposite());
|
||||
}
|
||||
}
|
||||
}
|
||||
state = transformBelt(state, halfTurn);
|
||||
return state;
|
||||
}
|
||||
|
||||
|
@ -197,7 +150,7 @@ public class StructureTransform {
|
|||
} else if (state.has(AXIS)) {
|
||||
state = state.with(AXIS, transformAxis(state.get(AXIS)));
|
||||
|
||||
} else if (rotation == Rotation.CLOCKWISE_180) {
|
||||
} else if (halfTurn) {
|
||||
|
||||
if (state.has(FACING)) {
|
||||
Direction stateFacing = state.get(FACING);
|
||||
|
@ -213,14 +166,111 @@ public class StructureTransform {
|
|||
|
||||
state = state.rotate(rotation);
|
||||
if (state.has(SlabBlock.TYPE) && state.get(SlabBlock.TYPE) != SlabType.DOUBLE)
|
||||
state = state
|
||||
.with(SlabBlock.TYPE,
|
||||
state = state.with(SlabBlock.TYPE,
|
||||
state.get(SlabBlock.TYPE) == SlabType.BOTTOM ? SlabType.TOP : SlabType.BOTTOM);
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
protected BlockState transformStairs(BlockState state, boolean halfTurn) {
|
||||
if (state.get(StairsBlock.FACING)
|
||||
.getAxis() != rotationAxis) {
|
||||
for (int i = 0; i < rotation.ordinal(); i++) {
|
||||
Direction direction = state.get(StairsBlock.FACING);
|
||||
Half half = state.get(StairsBlock.HALF);
|
||||
if (direction.getAxisDirection() == AxisDirection.POSITIVE ^ half == Half.BOTTOM
|
||||
^ direction.getAxis() == Axis.Z)
|
||||
state = state.cycle(StairsBlock.HALF);
|
||||
else
|
||||
state = state.with(StairsBlock.FACING, direction.getOpposite());
|
||||
}
|
||||
} else {
|
||||
if (halfTurn) {
|
||||
state = state.cycle(StairsBlock.HALF);
|
||||
}
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
protected BlockState transformBelt(BlockState state, boolean halfTurn) {
|
||||
Direction initialDirection = state.get(BeltBlock.HORIZONTAL_FACING);
|
||||
boolean diagonal = state.get(BeltBlock.SLOPE) == Slope.DOWNWARD || state.get(BeltBlock.SLOPE) == Slope.UPWARD;
|
||||
|
||||
if (!diagonal) {
|
||||
for (int i = 0; i < rotation.ordinal(); i++) {
|
||||
Direction direction = state.get(BeltBlock.HORIZONTAL_FACING);
|
||||
Slope slope = state.get(BeltBlock.SLOPE);
|
||||
boolean vertical = slope == Slope.VERTICAL;
|
||||
boolean horizontal = slope == Slope.HORIZONTAL;
|
||||
boolean sideways = slope == Slope.SIDEWAYS;
|
||||
|
||||
Direction newDirection = direction.getOpposite();
|
||||
Slope newSlope = Slope.VERTICAL;
|
||||
|
||||
if (vertical) {
|
||||
if (direction.getAxis() == rotationAxis) {
|
||||
newDirection = direction.rotateYCCW();
|
||||
newSlope = Slope.SIDEWAYS;
|
||||
} else {
|
||||
newSlope = Slope.HORIZONTAL;
|
||||
newDirection = direction;
|
||||
if (direction.getAxis() == Axis.Z)
|
||||
newDirection = direction.getOpposite();
|
||||
}
|
||||
}
|
||||
|
||||
if (sideways) {
|
||||
newDirection = direction;
|
||||
if (direction.getAxis() == rotationAxis)
|
||||
newSlope = Slope.HORIZONTAL;
|
||||
else
|
||||
newDirection = direction.rotateYCCW();
|
||||
}
|
||||
|
||||
if (horizontal) {
|
||||
newDirection = direction;
|
||||
if (direction.getAxis() == rotationAxis)
|
||||
newSlope = Slope.SIDEWAYS;
|
||||
}
|
||||
|
||||
state = state.with(BeltBlock.HORIZONTAL_FACING, newDirection);
|
||||
state = state.with(BeltBlock.SLOPE, newSlope);
|
||||
}
|
||||
|
||||
} else if (initialDirection.getAxis() != rotationAxis) {
|
||||
for (int i = 0; i < rotation.ordinal(); i++) {
|
||||
Direction direction = state.get(BeltBlock.HORIZONTAL_FACING);
|
||||
Direction newDirection = direction.getOpposite();
|
||||
Slope slope = state.get(BeltBlock.SLOPE);
|
||||
boolean upward = slope == Slope.UPWARD;
|
||||
boolean downward = slope == Slope.DOWNWARD;
|
||||
|
||||
// Rotate diagonal
|
||||
if (direction.getAxisDirection() == AxisDirection.POSITIVE ^ downward
|
||||
^ direction.getAxis() == Axis.Z) {
|
||||
state = state.with(BeltBlock.SLOPE, upward ? Slope.DOWNWARD : Slope.UPWARD);
|
||||
} else {
|
||||
state = state.with(BeltBlock.HORIZONTAL_FACING, newDirection);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (halfTurn) {
|
||||
Direction direction = state.get(BeltBlock.HORIZONTAL_FACING);
|
||||
Direction newDirection = direction.getOpposite();
|
||||
Slope slope = state.get(BeltBlock.SLOPE);
|
||||
boolean vertical = slope == Slope.VERTICAL;
|
||||
|
||||
if (diagonal) {
|
||||
state = state.with(BeltBlock.SLOPE,
|
||||
slope == Slope.UPWARD ? Slope.DOWNWARD : slope == Slope.DOWNWARD ? Slope.UPWARD : slope);
|
||||
} else if (vertical) {
|
||||
state = state.with(BeltBlock.HORIZONTAL_FACING, newDirection);
|
||||
}
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
public Axis transformAxis(Axis axisIn) {
|
||||
Direction facing = Direction.getFacingFromAxis(AxisDirection.POSITIVE, axisIn);
|
||||
facing = transformFacing(facing);
|
||||
|
|
|
@ -99,6 +99,8 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
|||
|
||||
@Override
|
||||
public Axis getRotationAxis(BlockState state) {
|
||||
if (state.get(SLOPE) == Slope.SIDEWAYS)
|
||||
return Axis.Y;
|
||||
return state.get(HORIZONTAL_FACING)
|
||||
.rotateY()
|
||||
.getAxis();
|
||||
|
@ -162,7 +164,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
|||
|
||||
@Override
|
||||
public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity entityIn) {
|
||||
if (state.get(SLOPE) == Slope.VERTICAL)
|
||||
if (!canTransport(state))
|
||||
return;
|
||||
if (entityIn instanceof PlayerEntity) {
|
||||
PlayerEntity player = (PlayerEntity) entityIn;
|
||||
|
@ -207,6 +209,13 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean canTransport(BlockState state) {
|
||||
if (!AllBlocks.BELT.has(state))
|
||||
return false;
|
||||
Slope slope = state.get(SLOPE);
|
||||
return slope != Slope.VERTICAL && slope != Slope.SIDEWAYS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) {
|
||||
updateNeighbouringTunnel(worldIn, pos, state);
|
||||
|
@ -273,6 +282,8 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
|||
return ActionResultType.PASS;
|
||||
if (state.get(SLOPE) == Slope.VERTICAL)
|
||||
return ActionResultType.PASS;
|
||||
if (state.get(SLOPE) == Slope.SIDEWAYS)
|
||||
return ActionResultType.PASS;
|
||||
if (!player.isCreative())
|
||||
heldItem.shrink(1);
|
||||
worldIn.setBlockState(pos, state.with(CASING, true), 2);
|
||||
|
@ -462,7 +473,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
|||
world.setBlockState(beltPos, currentState.with(CASING, false), 2);
|
||||
}
|
||||
|
||||
if (te.isController() && isVertical)
|
||||
if (te.isController() && !canTransport(currentState))
|
||||
te.getInventory()
|
||||
.ejectAll();
|
||||
} else {
|
||||
|
@ -531,7 +542,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
|||
}
|
||||
|
||||
public enum Slope implements IStringSerializable {
|
||||
HORIZONTAL, UPWARD, DOWNWARD, VERTICAL;
|
||||
HORIZONTAL, UPWARD, DOWNWARD, VERTICAL, SIDEWAYS;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
@ -580,7 +591,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
|||
if (slope == Slope.VERTICAL)
|
||||
return pos.up(direction.getAxisDirection() == AxisDirection.POSITIVE ? offset : -offset);
|
||||
pos = pos.offset(direction, offset);
|
||||
if (slope != Slope.HORIZONTAL)
|
||||
if (slope != Slope.HORIZONTAL && slope != Slope.SIDEWAYS)
|
||||
return pos.up(slope == Slope.UPWARD ? offset : -offset);
|
||||
return pos;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,10 @@ public class BeltGenerator extends SpecialBlockStateGen {
|
|||
|
||||
@Override
|
||||
protected int getXRotation(BlockState state) {
|
||||
return state.get(BeltBlock.SLOPE) == Slope.VERTICAL ? 90 : 0;
|
||||
Direction direction = state.get(BeltBlock.HORIZONTAL_FACING);
|
||||
Slope slope = state.get(BeltBlock.SLOPE);
|
||||
return slope == Slope.VERTICAL ? 90
|
||||
: slope == Slope.SIDEWAYS && direction.getAxisDirection() == AxisDirection.NEGATIVE ? 180 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,13 +44,14 @@ public class BeltGenerator extends SpecialBlockStateGen {
|
|||
boolean diagonal = slope == Slope.UPWARD || slope == Slope.DOWNWARD;
|
||||
boolean vertical = slope == Slope.VERTICAL;
|
||||
boolean pulley = part == Part.PULLEY;
|
||||
boolean sideways = slope == Slope.SIDEWAYS;
|
||||
boolean negative = direction.getAxisDirection() == AxisDirection.NEGATIVE;
|
||||
|
||||
if (!casing && pulley)
|
||||
part = Part.MIDDLE;
|
||||
|
||||
if ((!casing && vertical && negative || casing && diagonal && negative != (direction.getAxis() == Axis.X))
|
||||
&& part != Part.MIDDLE && !pulley)
|
||||
if ((!casing && vertical && negative || casing && diagonal && negative != (direction.getAxis() == Axis.X)
|
||||
|| !casing && sideways && negative) && part != Part.MIDDLE && !pulley)
|
||||
part = part == Part.END ? Part.START : Part.END;
|
||||
|
||||
if (!casing && vertical)
|
||||
|
|
|
@ -59,9 +59,11 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
|||
// UV shift
|
||||
float speed = te.getSpeed();
|
||||
if (speed != 0) {
|
||||
float time =
|
||||
AnimationTickHolder.getRenderTick() * blockState.get(HORIZONTAL_FACING).getAxisDirection().getOffset();
|
||||
if (renderedState.get(BeltBlock.HORIZONTAL_FACING).getAxis() == Axis.X)
|
||||
float time = AnimationTickHolder.getRenderTick() * blockState.get(HORIZONTAL_FACING)
|
||||
.getAxisDirection()
|
||||
.getOffset();
|
||||
Direction facing = renderedState.get(BeltBlock.HORIZONTAL_FACING);
|
||||
if (facing.getAxis() == Axis.X && renderedState.get(BeltBlock.SLOPE) != Slope.SIDEWAYS)
|
||||
speed = -speed;
|
||||
int textureIndex = (int) ((speed * time / 36) % 16);
|
||||
if (textureIndex < 0)
|
||||
|
@ -75,17 +77,28 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
|||
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
|
||||
|
||||
int packedLightmapCoords = WorldRenderer.getLightmapCoordinates(te.getWorld(), blockState, te.getPos());
|
||||
beltBuffer.light(packedLightmapCoords).renderInto(ms, vb);
|
||||
beltBuffer.light(packedLightmapCoords)
|
||||
.renderInto(ms, vb);
|
||||
|
||||
if (te.hasPulley()) {
|
||||
// TODO 1.15 find a way to cache this model matrix computation
|
||||
MatrixStack modelTransform = new MatrixStack();
|
||||
Direction dir = blockState.get(BeltBlock.HORIZONTAL_FACING);
|
||||
modelTransform.translate(0.5, 0.5, 0.5);
|
||||
modelTransform.multiply(Vector3f.POSITIVE_Y.getRadialQuaternion((float) (dir.getAxis() == Axis.X ? 0 : Math.PI / 2)));
|
||||
modelTransform.multiply(Vector3f.POSITIVE_X.getRadialQuaternion((float) (Math.PI / 2)));
|
||||
modelTransform.translate(-0.5, -0.5, -0.5);
|
||||
SuperByteBuffer superBuffer = CreateClient.bufferCache.renderDirectionalPartial(AllBlockPartials.BELT_PULLEY, blockState, dir, modelTransform);
|
||||
Direction dir = blockState.get(BeltBlock.HORIZONTAL_FACING)
|
||||
.rotateY();
|
||||
if (blockState.get(BeltBlock.SLOPE) == Slope.SIDEWAYS)
|
||||
dir = Direction.UP;
|
||||
MatrixStacker msr = MatrixStacker.of(modelTransform);
|
||||
|
||||
msr.centre();
|
||||
if (dir.getAxis() == Axis.X)
|
||||
msr.rotateY(90);
|
||||
if (dir.getAxis() == Axis.Y)
|
||||
msr.rotateX(90);
|
||||
msr.rotateX(90);
|
||||
msr.unCentre();
|
||||
|
||||
SuperByteBuffer superBuffer = CreateClient.bufferCache
|
||||
.renderDirectionalPartial(AllBlockPartials.BELT_PULLEY, blockState, dir, modelTransform);
|
||||
KineticTileEntityRenderer.standardKineticRotationTransform(superBuffer, te, light)
|
||||
.renderInto(ms, vb);
|
||||
}
|
||||
|
@ -102,16 +115,22 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
|||
|
||||
ms.push();
|
||||
|
||||
Vec3i directionVec = te.getBeltFacing().getDirectionVec();
|
||||
Vec3d beltStartOffset = new Vec3d(directionVec).scale(-.5).add(.5, 13 / 16f + .125f, .5);
|
||||
Vec3i directionVec = te.getBeltFacing()
|
||||
.getDirectionVec();
|
||||
Vec3d beltStartOffset = new Vec3d(directionVec).scale(-.5)
|
||||
.add(.5, 13 / 16f + .125f, .5);
|
||||
ms.translate(beltStartOffset.x, beltStartOffset.y, beltStartOffset.z);
|
||||
Slope slope = te.getBlockState().get(BeltBlock.SLOPE);
|
||||
Slope slope = te.getBlockState()
|
||||
.get(BeltBlock.SLOPE);
|
||||
int verticality = slope == Slope.DOWNWARD ? -1 : slope == Slope.UPWARD ? 1 : 0;
|
||||
boolean slopeAlongX = te.getBeltFacing().getAxis() == Axis.X;
|
||||
boolean slopeAlongX = te.getBeltFacing()
|
||||
.getAxis() == Axis.X;
|
||||
|
||||
for (TransportedItemStack transported : te.getInventory().getTransportedItems()) {
|
||||
for (TransportedItemStack transported : te.getInventory()
|
||||
.getTransportedItems()) {
|
||||
ms.push();
|
||||
MatrixStacker.of(ms).nudge(transported.angle);
|
||||
MatrixStacker.of(ms)
|
||||
.nudge(transported.angle);
|
||||
float offset = MathHelper.lerp(partialTicks, transported.prevBeltPosition, transported.beltPosition);
|
||||
float sideOffset = MathHelper.lerp(partialTicks, transported.prevSideOffset, transported.sideOffset);
|
||||
float verticalMovement = verticality;
|
||||
|
@ -124,24 +143,30 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
|||
if (offset < .5)
|
||||
verticalMovement = 0;
|
||||
verticalMovement = verticalMovement * (Math.min(offset, te.beltLength - .5f) - .5f);
|
||||
Vec3d offsetVec = new Vec3d(directionVec).scale(offset).add(0, verticalMovement, 0);
|
||||
Vec3d offsetVec = new Vec3d(directionVec).scale(offset)
|
||||
.add(0, verticalMovement, 0);
|
||||
boolean onSlope = slope != Slope.HORIZONTAL && MathHelper.clamp(offset, .5f, te.beltLength - .5f) == offset;
|
||||
boolean tiltForward =
|
||||
(slope == Slope.DOWNWARD ^ te.getBeltFacing().getAxisDirection() == AxisDirection.POSITIVE) == (te
|
||||
.getBeltFacing().getAxis() == Axis.Z);
|
||||
boolean tiltForward = (slope == Slope.DOWNWARD ^ te.getBeltFacing()
|
||||
.getAxisDirection() == AxisDirection.POSITIVE) == (te.getBeltFacing()
|
||||
.getAxis() == Axis.Z);
|
||||
float slopeAngle = onSlope ? tiltForward ? -45 : 45 : 0;
|
||||
|
||||
ms.translate(offsetVec.x, offsetVec.y, offsetVec.z);
|
||||
|
||||
boolean alongX = te.getBeltFacing().rotateY().getAxis() == Axis.X;
|
||||
boolean alongX = te.getBeltFacing()
|
||||
.rotateY()
|
||||
.getAxis() == Axis.X;
|
||||
if (!alongX)
|
||||
sideOffset *= -1;
|
||||
ms.translate(alongX ? sideOffset : 0, 0, alongX ? 0 : sideOffset);
|
||||
|
||||
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
|
||||
boolean blockItem = itemRenderer.getItemModelWithOverrides(transported.stack, te.getWorld(), null).isGui3d();
|
||||
ItemRenderer itemRenderer = Minecraft.getInstance()
|
||||
.getItemRenderer();
|
||||
boolean blockItem = itemRenderer.getItemModelWithOverrides(transported.stack, te.getWorld(), null)
|
||||
.isGui3d();
|
||||
if (Minecraft.getInstance().gameSettings.fancyGraphics) {
|
||||
Vec3d shadowPos = new Vec3d(te.getPos()).add(beltStartOffset.scale(1).add(offsetVec)
|
||||
Vec3d shadowPos = new Vec3d(te.getPos()).add(beltStartOffset.scale(1)
|
||||
.add(offsetVec)
|
||||
.add(alongX ? sideOffset : 0, .39, alongX ? 0 : sideOffset));
|
||||
ShadowRenderHelper.renderShadow(ms, buffer, shadowPos, .75f, blockItem ? .2f : .2f);
|
||||
}
|
||||
|
@ -181,7 +206,8 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
|||
}
|
||||
|
||||
protected BlockState getBeltState(KineticTileEntity te) {
|
||||
return te.getBlockState().with(BeltBlock.CASING, false);
|
||||
return te.getBlockState()
|
||||
.with(BeltBlock.CASING, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -73,6 +73,8 @@ public class BeltShapes {
|
|||
private static final VoxelShape
|
||||
SLOPE_DESC_PART = makeSlopePart(false),
|
||||
SLOPE_ASC_PART = makeSlopePart(true),
|
||||
SIDEWAYS_FULL_PART = makeSidewaysFull(),
|
||||
SIDEWAYS_END_PART = makeSidewaysEnding(),
|
||||
FLAT_FULL_PART = makeFlatFull(),
|
||||
FLAT_END_PART = makeFlatEnding();
|
||||
|
||||
|
@ -84,11 +86,19 @@ public class BeltShapes {
|
|||
VERTICAL_FULL = VerticalBeltShaper.make(FLAT_FULL_PART),
|
||||
VERTICAL_END = VerticalBeltShaper.make(compose(FLAT_END_PART, FLAT_FULL_PART)),
|
||||
VERTICAL_START = VerticalBeltShaper.make(compose(FLAT_FULL_PART, FLAT_END_PART));
|
||||
|
||||
//Flat Shapes
|
||||
private static final VoxelShaper
|
||||
FLAT_FULL = VoxelShaper.forHorizontalAxis(FLAT_FULL_PART, Axis.Z),
|
||||
FLAT_END = VoxelShaper.forHorizontal(compose(FLAT_END_PART, FLAT_FULL_PART), Direction.SOUTH),
|
||||
FLAT_START = VoxelShaper.forHorizontal(compose(FLAT_FULL_PART, FLAT_END_PART), Direction.SOUTH);
|
||||
|
||||
//Sideways Shapes
|
||||
private static final VoxelShaper
|
||||
SIDE_FULL = VoxelShaper.forHorizontalAxis(SIDEWAYS_FULL_PART, Axis.Z),
|
||||
SIDE_END = VoxelShaper.forHorizontal(compose(SIDEWAYS_END_PART, SIDEWAYS_FULL_PART), Direction.SOUTH),
|
||||
SIDE_START = VoxelShaper.forHorizontal(compose(SIDEWAYS_FULL_PART, SIDEWAYS_END_PART), Direction.SOUTH);
|
||||
|
||||
//Sloped Shapes
|
||||
private static final VoxelShaper
|
||||
SLOPE_DESC = VoxelShaper.forHorizontal(SLOPE_DESC_PART, Direction.SOUTH),
|
||||
|
@ -138,6 +148,17 @@ public class BeltShapes {
|
|||
return makeCuboidShape(1,3,0,15,13,16);
|
||||
}
|
||||
|
||||
private static VoxelShape makeSidewaysEnding(){
|
||||
return VoxelShapes.or(
|
||||
makeCuboidShape(4,1,0,12,15,16),
|
||||
makeCuboidShape(3,1,1,13,15,15)
|
||||
);
|
||||
}
|
||||
|
||||
private static VoxelShape makeSidewaysFull(){
|
||||
return makeCuboidShape(3,1,0,13,15,16);
|
||||
}
|
||||
|
||||
public static VoxelShape getShape(BlockState state) {
|
||||
if (cache.containsKey(state))
|
||||
return cache.get(state);
|
||||
|
@ -176,6 +197,14 @@ public class BeltShapes {
|
|||
return (part == Part.START ? FLAT_START : FLAT_END).get(facing);
|
||||
}
|
||||
|
||||
//sideways part
|
||||
if (slope == Slope.SIDEWAYS) {
|
||||
if (part == Part.MIDDLE || part == Part.PULLEY)
|
||||
return SIDE_FULL.get(axis);
|
||||
//flat ending
|
||||
return (part == Part.START ? SIDE_START : SIDE_END).get(facing);
|
||||
}
|
||||
|
||||
//slope
|
||||
if (part == Part.MIDDLE || part == Part.PULLEY)
|
||||
return (slope == Slope.DOWNWARD ? SLOPE_DESC : SLOPE_ASC).get(facing);
|
||||
|
|
|
@ -50,9 +50,11 @@ public class BeltConnectorHandler {
|
|||
|
||||
BlockPos first = NBTUtil.readBlockPos(tag.getCompound("FirstPulley"));
|
||||
|
||||
if (!world.getBlockState(first).has(BlockStateProperties.AXIS))
|
||||
if (!world.getBlockState(first)
|
||||
.has(BlockStateProperties.AXIS))
|
||||
continue;
|
||||
Axis axis = world.getBlockState(first).get(BlockStateProperties.AXIS);
|
||||
Axis axis = world.getBlockState(first)
|
||||
.get(BlockStateProperties.AXIS);
|
||||
|
||||
RayTraceResult rayTrace = Minecraft.getInstance().objectMouseOver;
|
||||
if (rayTrace == null || !(rayTrace instanceof BlockRayTraceResult)) {
|
||||
|
@ -66,7 +68,9 @@ public class BeltConnectorHandler {
|
|||
|
||||
BlockPos selected = ((BlockRayTraceResult) rayTrace).getPos();
|
||||
|
||||
if (world.getBlockState(selected).getMaterial().isReplaceable())
|
||||
if (world.getBlockState(selected)
|
||||
.getMaterial()
|
||||
.isReplaceable())
|
||||
return;
|
||||
if (!ShaftBlock.isShaft(world.getBlockState(selected)))
|
||||
selected = selected.offset(((BlockRayTraceResult) rayTrace).getFace());
|
||||
|
@ -79,7 +83,8 @@ public class BeltConnectorHandler {
|
|||
Vec3d start = new Vec3d(first);
|
||||
Vec3d end = new Vec3d(selected);
|
||||
Vec3d actualDiff = end.subtract(start);
|
||||
end = end.subtract(axis.getCoordinate(actualDiff.x, 0, 0), 0, axis.getCoordinate(0, 0, actualDiff.z));
|
||||
end = end.subtract(axis.getCoordinate(actualDiff.x, 0, 0), axis.getCoordinate(0, actualDiff.y, 0),
|
||||
axis.getCoordinate(0, 0, actualDiff.z));
|
||||
Vec3d diff = end.subtract(start);
|
||||
|
||||
double x = Math.abs(diff.x);
|
||||
|
@ -96,6 +101,8 @@ public class BeltConnectorHandler {
|
|||
for (int k = -1; k <= 1; k++) {
|
||||
if (axis.getCoordinate(i, j, k) != 0)
|
||||
continue;
|
||||
if (axis == Axis.Y && i != 0 && k != 0)
|
||||
continue;
|
||||
if (i == 0 && j == 0 && k == 0)
|
||||
continue;
|
||||
validDiffs.add(new Vec3d(i, j, k));
|
||||
|
@ -110,9 +117,11 @@ public class BeltConnectorHandler {
|
|||
}
|
||||
}
|
||||
step = validDiffs.get(closestIndex);
|
||||
|
||||
}
|
||||
|
||||
if (axis == Axis.Y && step.x != 0 && step.z != 0)
|
||||
return;
|
||||
|
||||
step = new Vec3d(Math.signum(step.x), Math.signum(step.y), Math.signum(step.z));
|
||||
for (float f = 0; f < length; f += .0625f) {
|
||||
Vec3d position = start.add(step.scale(f));
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.simibubi.create.content.contraptions.relays.belt.item;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
|
@ -31,8 +33,6 @@ import net.minecraft.util.NonNullList;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class BeltConnectorItem extends BlockItem {
|
||||
|
||||
public BeltConnectorItem(Properties properties) {
|
||||
|
@ -75,7 +75,7 @@ public class BeltConnectorItem extends BlockItem {
|
|||
// Remove first if no longer existant or valid
|
||||
if (tag.contains("FirstPulley")) {
|
||||
firstPulley = NBTUtil.readBlockPos(tag.getCompound("FirstPulley"));
|
||||
if (!validateAxis(world, firstPulley)) {
|
||||
if (!validateAxis(world, firstPulley) || !firstPulley.withinDistance(pos, maxLength() * 2)) {
|
||||
tag.remove("FirstPulley");
|
||||
context.getItem()
|
||||
.setTag(tag);
|
||||
|
@ -131,9 +131,12 @@ public class BeltConnectorItem extends BlockItem {
|
|||
|
||||
for (BlockPos pos : beltsToCreate) {
|
||||
BeltBlock.Part part = pos.equals(start) ? Part.START : pos.equals(end) ? Part.END : Part.MIDDLE;
|
||||
boolean pulley = ShaftBlock.isShaft(world.getBlockState(pos));
|
||||
BlockState shaftState = world.getBlockState(pos);
|
||||
boolean pulley = ShaftBlock.isShaft(shaftState);
|
||||
if (part == Part.MIDDLE && pulley)
|
||||
part = Part.PULLEY;
|
||||
if (pulley && shaftState.get(ShaftBlock.AXIS) == Axis.Y)
|
||||
slope = Slope.SIDEWAYS;
|
||||
world.setBlockState(pos, beltBlock.with(BeltBlock.SLOPE, slope)
|
||||
.with(BeltBlock.PART, part)
|
||||
.with(BeltBlock.HORIZONTAL_FACING, facing), 3);
|
||||
|
@ -193,11 +196,11 @@ public class BeltConnectorItem extends BlockItem {
|
|||
return false;
|
||||
if (!world.isAreaLoaded(second, 1))
|
||||
return false;
|
||||
if (!second.withinDistance(first, AllConfigs.SERVER.kinetics.maxBeltLength.get()))
|
||||
if (!second.withinDistance(first, maxLength()))
|
||||
return false;
|
||||
|
||||
BlockPos diff = second.subtract(first);
|
||||
Axis axis = world.getBlockState(first)
|
||||
Axis shaftAxis = world.getBlockState(first)
|
||||
.get(BlockStateProperties.AXIS);
|
||||
|
||||
int x = diff.getX();
|
||||
|
@ -206,13 +209,15 @@ public class BeltConnectorItem extends BlockItem {
|
|||
int sames = ((Math.abs(x) == Math.abs(y)) ? 1 : 0) + ((Math.abs(y) == Math.abs(z)) ? 1 : 0)
|
||||
+ ((Math.abs(z) == Math.abs(x)) ? 1 : 0);
|
||||
|
||||
if (axis.getCoordinate(x, y, z) != 0)
|
||||
if (shaftAxis.getCoordinate(x, y, z) != 0)
|
||||
return false;
|
||||
if (sames != 1)
|
||||
return false;
|
||||
if (axis != world.getBlockState(second)
|
||||
if (shaftAxis != world.getBlockState(second)
|
||||
.get(BlockStateProperties.AXIS))
|
||||
return false;
|
||||
if (shaftAxis == Axis.Y && x != 0 && z != 0)
|
||||
return false;
|
||||
|
||||
TileEntity tileEntity = world.getTileEntity(first);
|
||||
TileEntity tileEntity2 = world.getTileEntity(second);
|
||||
|
@ -232,7 +237,7 @@ public class BeltConnectorItem extends BlockItem {
|
|||
for (BlockPos currentPos = first.add(step); !currentPos.equals(second) && limit-- > 0; currentPos =
|
||||
currentPos.add(step)) {
|
||||
BlockState blockState = world.getBlockState(currentPos);
|
||||
if (ShaftBlock.isShaft(blockState) && blockState.get(ShaftBlock.AXIS) == axis)
|
||||
if (ShaftBlock.isShaft(blockState) && blockState.get(ShaftBlock.AXIS) == shaftAxis)
|
||||
continue;
|
||||
if (!blockState.getMaterial()
|
||||
.isReplaceable())
|
||||
|
@ -243,14 +248,15 @@ public class BeltConnectorItem extends BlockItem {
|
|||
|
||||
}
|
||||
|
||||
protected static Integer maxLength() {
|
||||
return AllConfigs.SERVER.kinetics.maxBeltLength.get();
|
||||
}
|
||||
|
||||
public static boolean validateAxis(World world, BlockPos pos) {
|
||||
if (!world.isAreaLoaded(pos, 1))
|
||||
return false;
|
||||
if (!ShaftBlock.isShaft(world.getBlockState(pos)))
|
||||
return false;
|
||||
if (world.getBlockState(pos)
|
||||
.get(BlockStateProperties.AXIS) == Axis.Y)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ public class BeltFunnelBlock extends HorizontalInteractionFunnelBlock {
|
|||
return true;
|
||||
if (!(stateBelow.getBlock() instanceof BeltBlock))
|
||||
return false;
|
||||
if (stateBelow.get(BeltBlock.SLOPE) == Slope.VERTICAL)
|
||||
if (!BeltBlock.canTransport(stateBelow))
|
||||
return false;
|
||||
if (stateBelow.get(BeltBlock.HORIZONTAL_FACING)
|
||||
.getAxis() != state.get(HORIZONTAL_FACING)
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"0": "create:block/belt",
|
||||
"particle": "create:block/belt"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "Bottom",
|
||||
"from": [11, 1, 0],
|
||||
"to": [13, 15, 15],
|
||||
"faces": {
|
||||
"east": {"uv": [1, 0, 15, 15], "rotation": 90, "texture": "#0"},
|
||||
"south": {"uv": [1, 3, 15, 5], "rotation": 90, "texture": "#0"},
|
||||
"west": {"uv": [1, 0, 15, 15], "rotation": 270, "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 2, 15], "texture": "#0"},
|
||||
"down": {"uv": [14, 0, 16, 15], "rotation": 180, "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Top",
|
||||
"from": [3, 1, 0],
|
||||
"to": [5, 15, 15],
|
||||
"faces": {
|
||||
"east": {"uv": [1, 1, 15, 16], "rotation": 270, "texture": "#0"},
|
||||
"south": {"uv": [1, 5, 15, 3], "rotation": 270, "texture": "#0"},
|
||||
"west": {"uv": [1, 1, 15, 16], "rotation": 90, "texture": "#0"},
|
||||
"up": {"uv": [0, 1, 2, 16], "rotation": 180, "texture": "#0"},
|
||||
"down": {"uv": [14, 1, 16, 16], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Side",
|
||||
"from": [4, 1, 14],
|
||||
"to": [12, 15, 16],
|
||||
"faces": {
|
||||
"north": {"uv": [1, 4, 15, 12], "rotation": 270, "texture": "#0"},
|
||||
"east": {"uv": [1, 11, 15, 13], "rotation": 90, "texture": "#0"},
|
||||
"south": {"uv": [1, 4, 15, 12], "rotation": 90, "texture": "#0"},
|
||||
"west": {"uv": [1, 3, 15, 5], "rotation": 90, "texture": "#0"},
|
||||
"up": {"uv": [0, 4, 2, 12], "rotation": 90, "texture": "#0"},
|
||||
"down": {"uv": [14, 4, 16, 12], "rotation": 90, "texture": "#0"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"0": "create:block/belt",
|
||||
"particle": "create:block/belt"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "Bottom",
|
||||
"from": [11, 1, 0],
|
||||
"to": [13, 15, 16],
|
||||
"faces": {
|
||||
"east": {"uv": [1, 0, 15, 16], "rotation": 90, "texture": "#0"},
|
||||
"west": {"uv": [1, 0, 15, 16], "rotation": 270, "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 2, 16], "texture": "#0"},
|
||||
"down": {"uv": [14, 0, 16, 16], "rotation": 180, "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Top",
|
||||
"from": [3, 1, 0],
|
||||
"to": [5, 15, 16],
|
||||
"faces": {
|
||||
"east": {"uv": [1, 0, 15, 16], "rotation": 270, "texture": "#0"},
|
||||
"west": {"uv": [1, 0, 15, 16], "rotation": 90, "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 2, 16], "rotation": 180, "texture": "#0"},
|
||||
"down": {"uv": [14, 0, 16, 16], "texture": "#0"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"0": "create:block/belt",
|
||||
"particle": "create:block/belt"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "Bottom",
|
||||
"from": [11, 1, 1],
|
||||
"to": [13, 15, 16],
|
||||
"faces": {
|
||||
"north": {"uv": [1, 11, 15, 13], "rotation": 270, "texture": "#0"},
|
||||
"east": {"uv": [1, 1, 15, 16], "rotation": 90, "texture": "#0"},
|
||||
"west": {"uv": [1, 1, 15, 16], "rotation": 270, "texture": "#0"},
|
||||
"up": {"uv": [0, 1, 2, 16], "texture": "#0"},
|
||||
"down": {"uv": [14, 1, 16, 16], "rotation": 180, "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Top",
|
||||
"from": [3, 1, 1],
|
||||
"to": [5, 15, 16],
|
||||
"faces": {
|
||||
"north": {"uv": [1, 3, 15, 5], "rotation": 90, "texture": "#0"},
|
||||
"east": {"uv": [1, 1, 15, 16], "rotation": 270, "texture": "#0"},
|
||||
"west": {"uv": [1, 0, 15, 15], "rotation": 90, "texture": "#0"},
|
||||
"up": {"uv": [0, 1, 2, 16], "rotation": 180, "texture": "#0"},
|
||||
"down": {"uv": [14, 1, 16, 16], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Side",
|
||||
"from": [4, 1, 0],
|
||||
"to": [12, 15, 2],
|
||||
"faces": {
|
||||
"north": {"uv": [1, 4, 15, 12], "rotation": 90, "texture": "#0"},
|
||||
"east": {"uv": [1, 11, 15, 13], "rotation": 90, "texture": "#0"},
|
||||
"south": {"uv": [1, 4, 15, 12], "rotation": 270, "texture": "#0"},
|
||||
"west": {"uv": [1, 3, 15, 5], "rotation": 90, "texture": "#0"},
|
||||
"up": {"uv": [0, 4, 2, 12], "rotation": 270, "texture": "#0"},
|
||||
"down": {"uv": [14, 4, 16, 12], "rotation": 270, "texture": "#0"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"_comment": "Vertical belts cannot have casings at the moment",
|
||||
"textures": {},
|
||||
"elements": []
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"_comment": "Vertical belts cannot have casings at the moment",
|
||||
"textures": {},
|
||||
"elements": []
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"_comment": "Vertical belts cannot have casings at the moment",
|
||||
"textures": {},
|
||||
"elements": []
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"_comment": "Vertical belts cannot have casings at the moment",
|
||||
"textures": {},
|
||||
"elements": []
|
||||
}
|
Loading…
Reference in a new issue