mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-29 08:27:03 +01:00
Tilted belts
- Mechanical belts can now connect vertical shafts together
This commit is contained in:
parent
8ddf3fabba
commit
1907e69c35
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
|
82bd82270aff7d51e9239680ef4dd7b5c899ceb0 assets\create\blockstates\andesite_cobblestone_wall.json
|
||||||
398922758a6219544e5b85c91c9cf8a543b437e5 assets\create\blockstates\andesite_pillar.json
|
398922758a6219544e5b85c91c9cf8a543b437e5 assets\create\blockstates\andesite_pillar.json
|
||||||
f9fa6aa530eb0891a74eadfbebc663172a57147a assets\create\blockstates\basin.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
|
9bbc9a2dc2428175ae0cadf7537ed6815e3e241d assets\create\blockstates\belt_funnel.json
|
||||||
40d10934934ea142d71fc6ce598b1455c3ad47b4 assets\create\blockstates\belt_observer.json
|
40d10934934ea142d71fc6ce598b1455c3ad47b4 assets\create\blockstates\belt_observer.json
|
||||||
4325605fbdea60d5f54286c309c825bebcd74b95 assets\create\blockstates\belt_tunnel.json
|
4325605fbdea60d5f54286c309c825bebcd74b95 assets\create\blockstates\belt_tunnel.json
|
||||||
|
|
|
@ -511,6 +511,142 @@
|
||||||
"model": "create:block/belt_casing/vertical_pulley",
|
"model": "create:block/belt_casing/vertical_pulley",
|
||||||
"x": 90,
|
"x": 90,
|
||||||
"y": 270
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -387,6 +387,21 @@ public class AllBlocks {
|
||||||
.blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), AssetLookup.standardModel(ctx, prov)))
|
.blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), AssetLookup.standardModel(ctx, prov)))
|
||||||
.simpleItem()
|
.simpleItem()
|
||||||
.register();
|
.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)
|
public static final BlockEntry<GaugeBlock> SPEEDOMETER = REGISTRATE.block("speedometer", GaugeBlock::speed)
|
||||||
.initialProperties(SharedProperties::wooden)
|
.initialProperties(SharedProperties::wooden)
|
||||||
|
@ -665,11 +680,40 @@ public class AllBlocks {
|
||||||
.transform(customItemModel())
|
.transform(customItemModel())
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
|
|
||||||
// Logistics
|
// Logistics
|
||||||
|
|
||||||
static {
|
static {
|
||||||
REGISTRATE.startSection(AllSections.LOGISTICS);
|
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 =
|
public static final BlockEntry<RedstoneContactBlock> REDSTONE_CONTACT =
|
||||||
REGISTRATE.block("redstone_contact", RedstoneContactBlock::new)
|
REGISTRATE.block("redstone_contact", RedstoneContactBlock::new)
|
||||||
|
@ -715,47 +759,6 @@ public class AllBlocks {
|
||||||
.transform(BuilderTransformers.crate("creative"))
|
.transform(BuilderTransformers.crate("creative"))
|
||||||
.register();
|
.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 =
|
public static final BlockEntry<BeltObserverBlock> BELT_OBSERVER =
|
||||||
REGISTRATE.block("belt_observer", BeltObserverBlock::new)
|
REGISTRATE.block("belt_observer", BeltObserverBlock::new)
|
||||||
.initialProperties(SharedProperties::stone)
|
.initialProperties(SharedProperties::stone)
|
||||||
|
@ -777,20 +780,18 @@ public class AllBlocks {
|
||||||
.item()
|
.item()
|
||||||
.transform(customItemModel())
|
.transform(customItemModel())
|
||||||
.register();
|
.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)
|
.initialProperties(SharedProperties::softMetal)
|
||||||
.blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p)))
|
.transform(StressConfigDefaults.setImpact(4.0))
|
||||||
.transform(StressConfigDefaults.setImpact(8.0))
|
.properties(p -> p.nonOpaque())
|
||||||
.item(ArmItem::new)
|
.blockstate((c, p) -> p.getVariantBuilder(c.get())
|
||||||
.transform(customItemModel())
|
.forAllStates(s -> ConfiguredModel.builder()
|
||||||
.register();
|
.modelFile(AssetLookup.partialBaseModel(c, p))
|
||||||
|
.rotationY(s.get(PackagerBlock.HORIZONTAL_AXIS) == Axis.X ? 90 : 0)
|
||||||
public static final BlockEntry<DepotBlock> DEPOT = REGISTRATE.block("depot", DepotBlock::new)
|
.build()))
|
||||||
.initialProperties(SharedProperties::stone)
|
|
||||||
.blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p)))
|
|
||||||
.item()
|
.item()
|
||||||
.transform(customItemModel("_", "block"))
|
.transform(customItemModel())
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final BlockEntry<ExtractorBlock> EXTRACTOR = REGISTRATE.block("extractor", ExtractorBlock::new)
|
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) {
|
if (state.get(BlockStateProperties.BELL_ATTACHMENT) == BellAttachment.DOUBLE_WALL) {
|
||||||
state = state.with(BlockStateProperties.BELL_ATTACHMENT, BellAttachment.SINGLE_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);
|
return state.rotate(rotation);
|
||||||
}
|
}
|
||||||
|
@ -111,12 +112,12 @@ public class StructureTransform {
|
||||||
|
|
||||||
boolean b = state.get(FACE) == AttachFace.CEILING;
|
boolean b = state.get(FACE) == AttachFace.CEILING;
|
||||||
state = state.with(HORIZONTAL_FACING, b ? forcedAxis : forcedAxis.getOpposite());
|
state = state.with(HORIZONTAL_FACING, b ? forcedAxis : forcedAxis.getOpposite());
|
||||||
|
|
||||||
if (stateFace != AttachFace.WALL) {
|
if (stateFace != AttachFace.WALL) {
|
||||||
state = state.with(FACE, AttachFace.WALL);
|
state = state.with(FACE, AttachFace.WALL);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stateFacing.getAxisDirection() == AxisDirection.POSITIVE) {
|
if (stateFacing.getAxisDirection() == AxisDirection.POSITIVE) {
|
||||||
state = state.with(FACE, AttachFace.FLOOR);
|
state = state.with(FACE, AttachFace.FLOOR);
|
||||||
continue;
|
continue;
|
||||||
|
@ -127,62 +128,14 @@ public class StructureTransform {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean halfTurn = rotation == Rotation.CLOCKWISE_180;
|
||||||
if (block instanceof StairsBlock) {
|
if (block instanceof StairsBlock) {
|
||||||
if (state.get(StairsBlock.FACING).getAxis() != rotationAxis) {
|
state = transformStairs(state, halfTurn);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AllBlocks.BELT.has(state)) {
|
if (AllBlocks.BELT.has(state)) {
|
||||||
if (state.get(BeltBlock.HORIZONTAL_FACING).getAxis() != rotationAxis) {
|
state = transformBelt(state, halfTurn);
|
||||||
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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,7 +150,7 @@ public class StructureTransform {
|
||||||
} else if (state.has(AXIS)) {
|
} else if (state.has(AXIS)) {
|
||||||
state = state.with(AXIS, transformAxis(state.get(AXIS)));
|
state = state.with(AXIS, transformAxis(state.get(AXIS)));
|
||||||
|
|
||||||
} else if (rotation == Rotation.CLOCKWISE_180) {
|
} else if (halfTurn) {
|
||||||
|
|
||||||
if (state.has(FACING)) {
|
if (state.has(FACING)) {
|
||||||
Direction stateFacing = state.get(FACING);
|
Direction stateFacing = state.get(FACING);
|
||||||
|
@ -213,14 +166,111 @@ public class StructureTransform {
|
||||||
|
|
||||||
state = state.rotate(rotation);
|
state = state.rotate(rotation);
|
||||||
if (state.has(SlabBlock.TYPE) && state.get(SlabBlock.TYPE) != SlabType.DOUBLE)
|
if (state.has(SlabBlock.TYPE) && state.get(SlabBlock.TYPE) != SlabType.DOUBLE)
|
||||||
state = state
|
state = state.with(SlabBlock.TYPE,
|
||||||
.with(SlabBlock.TYPE,
|
state.get(SlabBlock.TYPE) == SlabType.BOTTOM ? SlabType.TOP : SlabType.BOTTOM);
|
||||||
state.get(SlabBlock.TYPE) == SlabType.BOTTOM ? SlabType.TOP : SlabType.BOTTOM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return state;
|
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) {
|
public Axis transformAxis(Axis axisIn) {
|
||||||
Direction facing = Direction.getFacingFromAxis(AxisDirection.POSITIVE, axisIn);
|
Direction facing = Direction.getFacingFromAxis(AxisDirection.POSITIVE, axisIn);
|
||||||
facing = transformFacing(facing);
|
facing = transformFacing(facing);
|
||||||
|
|
|
@ -99,6 +99,8 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Axis getRotationAxis(BlockState state) {
|
public Axis getRotationAxis(BlockState state) {
|
||||||
|
if (state.get(SLOPE) == Slope.SIDEWAYS)
|
||||||
|
return Axis.Y;
|
||||||
return state.get(HORIZONTAL_FACING)
|
return state.get(HORIZONTAL_FACING)
|
||||||
.rotateY()
|
.rotateY()
|
||||||
.getAxis();
|
.getAxis();
|
||||||
|
@ -162,7 +164,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity entityIn) {
|
public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity entityIn) {
|
||||||
if (state.get(SLOPE) == Slope.VERTICAL)
|
if (!canTransport(state))
|
||||||
return;
|
return;
|
||||||
if (entityIn instanceof PlayerEntity) {
|
if (entityIn instanceof PlayerEntity) {
|
||||||
PlayerEntity player = (PlayerEntity) entityIn;
|
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
|
@Override
|
||||||
public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) {
|
public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) {
|
||||||
updateNeighbouringTunnel(worldIn, pos, state);
|
updateNeighbouringTunnel(worldIn, pos, state);
|
||||||
|
@ -273,6 +282,8 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
||||||
return ActionResultType.PASS;
|
return ActionResultType.PASS;
|
||||||
if (state.get(SLOPE) == Slope.VERTICAL)
|
if (state.get(SLOPE) == Slope.VERTICAL)
|
||||||
return ActionResultType.PASS;
|
return ActionResultType.PASS;
|
||||||
|
if (state.get(SLOPE) == Slope.SIDEWAYS)
|
||||||
|
return ActionResultType.PASS;
|
||||||
if (!player.isCreative())
|
if (!player.isCreative())
|
||||||
heldItem.shrink(1);
|
heldItem.shrink(1);
|
||||||
worldIn.setBlockState(pos, state.with(CASING, true), 2);
|
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);
|
world.setBlockState(beltPos, currentState.with(CASING, false), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (te.isController() && isVertical)
|
if (te.isController() && !canTransport(currentState))
|
||||||
te.getInventory()
|
te.getInventory()
|
||||||
.ejectAll();
|
.ejectAll();
|
||||||
} else {
|
} else {
|
||||||
|
@ -531,7 +542,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Slope implements IStringSerializable {
|
public enum Slope implements IStringSerializable {
|
||||||
HORIZONTAL, UPWARD, DOWNWARD, VERTICAL;
|
HORIZONTAL, UPWARD, DOWNWARD, VERTICAL, SIDEWAYS;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
@ -580,7 +591,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
||||||
if (slope == Slope.VERTICAL)
|
if (slope == Slope.VERTICAL)
|
||||||
return pos.up(direction.getAxisDirection() == AxisDirection.POSITIVE ? offset : -offset);
|
return pos.up(direction.getAxisDirection() == AxisDirection.POSITIVE ? offset : -offset);
|
||||||
pos = pos.offset(direction, 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.up(slope == Slope.UPWARD ? offset : -offset);
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,10 @@ public class BeltGenerator extends SpecialBlockStateGen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getXRotation(BlockState state) {
|
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
|
@Override
|
||||||
|
@ -41,13 +44,14 @@ public class BeltGenerator extends SpecialBlockStateGen {
|
||||||
boolean diagonal = slope == Slope.UPWARD || slope == Slope.DOWNWARD;
|
boolean diagonal = slope == Slope.UPWARD || slope == Slope.DOWNWARD;
|
||||||
boolean vertical = slope == Slope.VERTICAL;
|
boolean vertical = slope == Slope.VERTICAL;
|
||||||
boolean pulley = part == Part.PULLEY;
|
boolean pulley = part == Part.PULLEY;
|
||||||
|
boolean sideways = slope == Slope.SIDEWAYS;
|
||||||
boolean negative = direction.getAxisDirection() == AxisDirection.NEGATIVE;
|
boolean negative = direction.getAxisDirection() == AxisDirection.NEGATIVE;
|
||||||
|
|
||||||
if (!casing && pulley)
|
if (!casing && pulley)
|
||||||
part = Part.MIDDLE;
|
part = Part.MIDDLE;
|
||||||
|
|
||||||
if ((!casing && vertical && negative || casing && diagonal && negative != (direction.getAxis() == Axis.X))
|
if ((!casing && vertical && negative || casing && diagonal && negative != (direction.getAxis() == Axis.X)
|
||||||
&& part != Part.MIDDLE && !pulley)
|
|| !casing && sideways && negative) && part != Part.MIDDLE && !pulley)
|
||||||
part = part == Part.END ? Part.START : Part.END;
|
part = part == Part.END ? Part.START : Part.END;
|
||||||
|
|
||||||
if (!casing && vertical)
|
if (!casing && vertical)
|
||||||
|
|
|
@ -41,10 +41,10 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
||||||
public BeltRenderer(TileEntityRendererDispatcher dispatcher) {
|
public BeltRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||||
super(dispatcher);
|
super(dispatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderSafe(BeltTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
protected void renderSafe(BeltTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||||
int light, int overlay) {
|
int light, int overlay) {
|
||||||
|
|
||||||
BlockState blockState = te.getBlockState();
|
BlockState blockState = te.getBlockState();
|
||||||
if (!AllBlocks.BELT.has(blockState))
|
if (!AllBlocks.BELT.has(blockState))
|
||||||
|
@ -59,9 +59,11 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
||||||
// UV shift
|
// UV shift
|
||||||
float speed = te.getSpeed();
|
float speed = te.getSpeed();
|
||||||
if (speed != 0) {
|
if (speed != 0) {
|
||||||
float time =
|
float time = AnimationTickHolder.getRenderTick() * blockState.get(HORIZONTAL_FACING)
|
||||||
AnimationTickHolder.getRenderTick() * blockState.get(HORIZONTAL_FACING).getAxisDirection().getOffset();
|
.getAxisDirection()
|
||||||
if (renderedState.get(BeltBlock.HORIZONTAL_FACING).getAxis() == Axis.X)
|
.getOffset();
|
||||||
|
Direction facing = renderedState.get(BeltBlock.HORIZONTAL_FACING);
|
||||||
|
if (facing.getAxis() == Axis.X && renderedState.get(BeltBlock.SLOPE) != Slope.SIDEWAYS)
|
||||||
speed = -speed;
|
speed = -speed;
|
||||||
int textureIndex = (int) ((speed * time / 36) % 16);
|
int textureIndex = (int) ((speed * time / 36) % 16);
|
||||||
if (textureIndex < 0)
|
if (textureIndex < 0)
|
||||||
|
@ -71,30 +73,41 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
||||||
} else {
|
} else {
|
||||||
beltBuffer.dontShiftUV();
|
beltBuffer.dontShiftUV();
|
||||||
}
|
}
|
||||||
|
|
||||||
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
|
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
|
||||||
|
|
||||||
int packedLightmapCoords = WorldRenderer.getLightmapCoordinates(te.getWorld(), blockState, te.getPos());
|
int packedLightmapCoords = WorldRenderer.getLightmapCoordinates(te.getWorld(), blockState, te.getPos());
|
||||||
beltBuffer.light(packedLightmapCoords).renderInto(ms, vb);
|
beltBuffer.light(packedLightmapCoords)
|
||||||
|
.renderInto(ms, vb);
|
||||||
|
|
||||||
if (te.hasPulley()) {
|
if (te.hasPulley()) {
|
||||||
// TODO 1.15 find a way to cache this model matrix computation
|
// TODO 1.15 find a way to cache this model matrix computation
|
||||||
MatrixStack modelTransform = new MatrixStack();
|
MatrixStack modelTransform = new MatrixStack();
|
||||||
Direction dir = blockState.get(BeltBlock.HORIZONTAL_FACING);
|
Direction dir = blockState.get(BeltBlock.HORIZONTAL_FACING)
|
||||||
modelTransform.translate(0.5, 0.5, 0.5);
|
.rotateY();
|
||||||
modelTransform.multiply(Vector3f.POSITIVE_Y.getRadialQuaternion((float) (dir.getAxis() == Axis.X ? 0 : Math.PI / 2)));
|
if (blockState.get(BeltBlock.SLOPE) == Slope.SIDEWAYS)
|
||||||
modelTransform.multiply(Vector3f.POSITIVE_X.getRadialQuaternion((float) (Math.PI / 2)));
|
dir = Direction.UP;
|
||||||
modelTransform.translate(-0.5, -0.5, -0.5);
|
MatrixStacker msr = MatrixStacker.of(modelTransform);
|
||||||
SuperByteBuffer superBuffer = CreateClient.bufferCache.renderDirectionalPartial(AllBlockPartials.BELT_PULLEY, blockState, dir, 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)
|
KineticTileEntityRenderer.standardKineticRotationTransform(superBuffer, te, light)
|
||||||
.renderInto(ms, vb);
|
.renderInto(ms, vb);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderItems(te, partialTicks, ms, buffer, light, overlay);
|
renderItems(te, partialTicks, ms, buffer, light, overlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void renderItems(BeltTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
protected void renderItems(BeltTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||||
int light, int overlay) {
|
int light, int overlay) {
|
||||||
if (!te.isController())
|
if (!te.isController())
|
||||||
return;
|
return;
|
||||||
if (te.beltLength == 0)
|
if (te.beltLength == 0)
|
||||||
|
@ -102,16 +115,22 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
||||||
|
|
||||||
ms.push();
|
ms.push();
|
||||||
|
|
||||||
Vec3i directionVec = te.getBeltFacing().getDirectionVec();
|
Vec3i directionVec = te.getBeltFacing()
|
||||||
Vec3d beltStartOffset = new Vec3d(directionVec).scale(-.5).add(.5, 13 / 16f + .125f, .5);
|
.getDirectionVec();
|
||||||
|
Vec3d beltStartOffset = new Vec3d(directionVec).scale(-.5)
|
||||||
|
.add(.5, 13 / 16f + .125f, .5);
|
||||||
ms.translate(beltStartOffset.x, beltStartOffset.y, beltStartOffset.z);
|
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;
|
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();
|
ms.push();
|
||||||
MatrixStacker.of(ms).nudge(transported.angle);
|
MatrixStacker.of(ms)
|
||||||
|
.nudge(transported.angle);
|
||||||
float offset = MathHelper.lerp(partialTicks, transported.prevBeltPosition, transported.beltPosition);
|
float offset = MathHelper.lerp(partialTicks, transported.prevBeltPosition, transported.beltPosition);
|
||||||
float sideOffset = MathHelper.lerp(partialTicks, transported.prevSideOffset, transported.sideOffset);
|
float sideOffset = MathHelper.lerp(partialTicks, transported.prevSideOffset, transported.sideOffset);
|
||||||
float verticalMovement = verticality;
|
float verticalMovement = verticality;
|
||||||
|
@ -124,25 +143,31 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
||||||
if (offset < .5)
|
if (offset < .5)
|
||||||
verticalMovement = 0;
|
verticalMovement = 0;
|
||||||
verticalMovement = verticalMovement * (Math.min(offset, te.beltLength - .5f) - .5f);
|
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 onSlope = slope != Slope.HORIZONTAL && MathHelper.clamp(offset, .5f, te.beltLength - .5f) == offset;
|
||||||
boolean tiltForward =
|
boolean tiltForward = (slope == Slope.DOWNWARD ^ te.getBeltFacing()
|
||||||
(slope == Slope.DOWNWARD ^ te.getBeltFacing().getAxisDirection() == AxisDirection.POSITIVE) == (te
|
.getAxisDirection() == AxisDirection.POSITIVE) == (te.getBeltFacing()
|
||||||
.getBeltFacing().getAxis() == Axis.Z);
|
.getAxis() == Axis.Z);
|
||||||
float slopeAngle = onSlope ? tiltForward ? -45 : 45 : 0;
|
float slopeAngle = onSlope ? tiltForward ? -45 : 45 : 0;
|
||||||
|
|
||||||
ms.translate(offsetVec.x, offsetVec.y, offsetVec.z);
|
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)
|
if (!alongX)
|
||||||
sideOffset *= -1;
|
sideOffset *= -1;
|
||||||
ms.translate(alongX ? sideOffset : 0, 0, alongX ? 0 : sideOffset);
|
ms.translate(alongX ? sideOffset : 0, 0, alongX ? 0 : sideOffset);
|
||||||
|
|
||||||
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
|
ItemRenderer itemRenderer = Minecraft.getInstance()
|
||||||
boolean blockItem = itemRenderer.getItemModelWithOverrides(transported.stack, te.getWorld(), null).isGui3d();
|
.getItemRenderer();
|
||||||
|
boolean blockItem = itemRenderer.getItemModelWithOverrides(transported.stack, te.getWorld(), null)
|
||||||
|
.isGui3d();
|
||||||
if (Minecraft.getInstance().gameSettings.fancyGraphics) {
|
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(alongX ? sideOffset : 0, .39, alongX ? 0 : sideOffset));
|
.add(offsetVec)
|
||||||
|
.add(alongX ? sideOffset : 0, .39, alongX ? 0 : sideOffset));
|
||||||
ShadowRenderHelper.renderShadow(ms, buffer, shadowPos, .75f, blockItem ? .2f : .2f);
|
ShadowRenderHelper.renderShadow(ms, buffer, shadowPos, .75f, blockItem ? .2f : .2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,7 +206,8 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BlockState getBeltState(KineticTileEntity te) {
|
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
|
private static final VoxelShape
|
||||||
SLOPE_DESC_PART = makeSlopePart(false),
|
SLOPE_DESC_PART = makeSlopePart(false),
|
||||||
SLOPE_ASC_PART = makeSlopePart(true),
|
SLOPE_ASC_PART = makeSlopePart(true),
|
||||||
|
SIDEWAYS_FULL_PART = makeSidewaysFull(),
|
||||||
|
SIDEWAYS_END_PART = makeSidewaysEnding(),
|
||||||
FLAT_FULL_PART = makeFlatFull(),
|
FLAT_FULL_PART = makeFlatFull(),
|
||||||
FLAT_END_PART = makeFlatEnding();
|
FLAT_END_PART = makeFlatEnding();
|
||||||
|
|
||||||
|
@ -84,11 +86,19 @@ public class BeltShapes {
|
||||||
VERTICAL_FULL = VerticalBeltShaper.make(FLAT_FULL_PART),
|
VERTICAL_FULL = VerticalBeltShaper.make(FLAT_FULL_PART),
|
||||||
VERTICAL_END = VerticalBeltShaper.make(compose(FLAT_END_PART, 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));
|
VERTICAL_START = VerticalBeltShaper.make(compose(FLAT_FULL_PART, FLAT_END_PART));
|
||||||
|
|
||||||
//Flat Shapes
|
//Flat Shapes
|
||||||
private static final VoxelShaper
|
private static final VoxelShaper
|
||||||
FLAT_FULL = VoxelShaper.forHorizontalAxis(FLAT_FULL_PART, Axis.Z),
|
FLAT_FULL = VoxelShaper.forHorizontalAxis(FLAT_FULL_PART, Axis.Z),
|
||||||
FLAT_END = VoxelShaper.forHorizontal(compose(FLAT_END_PART, FLAT_FULL_PART), Direction.SOUTH),
|
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);
|
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
|
//Sloped Shapes
|
||||||
private static final VoxelShaper
|
private static final VoxelShaper
|
||||||
SLOPE_DESC = VoxelShaper.forHorizontal(SLOPE_DESC_PART, Direction.SOUTH),
|
SLOPE_DESC = VoxelShaper.forHorizontal(SLOPE_DESC_PART, Direction.SOUTH),
|
||||||
|
@ -129,14 +139,25 @@ public class BeltShapes {
|
||||||
|
|
||||||
private static VoxelShape makeFlatEnding(){
|
private static VoxelShape makeFlatEnding(){
|
||||||
return VoxelShapes.or(
|
return VoxelShapes.or(
|
||||||
makeCuboidShape(1,4,0,15,12,16),
|
makeCuboidShape(1,4,0,15,12,16),
|
||||||
makeCuboidShape(1,3,1,15,13,15)
|
makeCuboidShape(1,3,1,15,13,15)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static VoxelShape makeFlatFull(){
|
private static VoxelShape makeFlatFull(){
|
||||||
return makeCuboidShape(1,3,0,15,13,16);
|
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) {
|
public static VoxelShape getShape(BlockState state) {
|
||||||
if (cache.containsKey(state))
|
if (cache.containsKey(state))
|
||||||
|
@ -175,6 +196,14 @@ public class BeltShapes {
|
||||||
//flat ending
|
//flat ending
|
||||||
return (part == Part.START ? FLAT_START : FLAT_END).get(facing);
|
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
|
//slope
|
||||||
if (part == Part.MIDDLE || part == Part.PULLEY)
|
if (part == Part.MIDDLE || part == Part.PULLEY)
|
||||||
|
|
|
@ -50,23 +50,27 @@ public class BeltConnectorHandler {
|
||||||
|
|
||||||
BlockPos first = NBTUtil.readBlockPos(tag.getCompound("FirstPulley"));
|
BlockPos first = NBTUtil.readBlockPos(tag.getCompound("FirstPulley"));
|
||||||
|
|
||||||
if (!world.getBlockState(first).has(BlockStateProperties.AXIS))
|
if (!world.getBlockState(first)
|
||||||
|
.has(BlockStateProperties.AXIS))
|
||||||
continue;
|
continue;
|
||||||
Axis axis = world.getBlockState(first).get(BlockStateProperties.AXIS);
|
Axis axis = world.getBlockState(first)
|
||||||
|
.get(BlockStateProperties.AXIS);
|
||||||
|
|
||||||
RayTraceResult rayTrace = Minecraft.getInstance().objectMouseOver;
|
RayTraceResult rayTrace = Minecraft.getInstance().objectMouseOver;
|
||||||
if (rayTrace == null || !(rayTrace instanceof BlockRayTraceResult)) {
|
if (rayTrace == null || !(rayTrace instanceof BlockRayTraceResult)) {
|
||||||
if (r.nextInt(50) == 0) {
|
if (r.nextInt(50) == 0) {
|
||||||
world.addParticle(new RedstoneParticleData(.3f, .9f, .5f, 1),
|
world.addParticle(new RedstoneParticleData(.3f, .9f, .5f, 1),
|
||||||
first.getX() + .5f + randomOffset(.25f), first.getY() + .5f + randomOffset(.25f),
|
first.getX() + .5f + randomOffset(.25f), first.getY() + .5f + randomOffset(.25f),
|
||||||
first.getZ() + .5f + randomOffset(.25f), 0, 0, 0);
|
first.getZ() + .5f + randomOffset(.25f), 0, 0, 0);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockPos selected = ((BlockRayTraceResult) rayTrace).getPos();
|
BlockPos selected = ((BlockRayTraceResult) rayTrace).getPos();
|
||||||
|
|
||||||
if (world.getBlockState(selected).getMaterial().isReplaceable())
|
if (world.getBlockState(selected)
|
||||||
|
.getMaterial()
|
||||||
|
.isReplaceable())
|
||||||
return;
|
return;
|
||||||
if (!ShaftBlock.isShaft(world.getBlockState(selected)))
|
if (!ShaftBlock.isShaft(world.getBlockState(selected)))
|
||||||
selected = selected.offset(((BlockRayTraceResult) rayTrace).getFace());
|
selected = selected.offset(((BlockRayTraceResult) rayTrace).getFace());
|
||||||
|
@ -79,7 +83,8 @@ public class BeltConnectorHandler {
|
||||||
Vec3d start = new Vec3d(first);
|
Vec3d start = new Vec3d(first);
|
||||||
Vec3d end = new Vec3d(selected);
|
Vec3d end = new Vec3d(selected);
|
||||||
Vec3d actualDiff = end.subtract(start);
|
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);
|
Vec3d diff = end.subtract(start);
|
||||||
|
|
||||||
double x = Math.abs(diff.x);
|
double x = Math.abs(diff.x);
|
||||||
|
@ -96,6 +101,8 @@ public class BeltConnectorHandler {
|
||||||
for (int k = -1; k <= 1; k++) {
|
for (int k = -1; k <= 1; k++) {
|
||||||
if (axis.getCoordinate(i, j, k) != 0)
|
if (axis.getCoordinate(i, j, k) != 0)
|
||||||
continue;
|
continue;
|
||||||
|
if (axis == Axis.Y && i != 0 && k != 0)
|
||||||
|
continue;
|
||||||
if (i == 0 && j == 0 && k == 0)
|
if (i == 0 && j == 0 && k == 0)
|
||||||
continue;
|
continue;
|
||||||
validDiffs.add(new Vec3d(i, j, k));
|
validDiffs.add(new Vec3d(i, j, k));
|
||||||
|
@ -110,15 +117,17 @@ public class BeltConnectorHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
step = validDiffs.get(closestIndex);
|
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));
|
step = new Vec3d(Math.signum(step.x), Math.signum(step.y), Math.signum(step.z));
|
||||||
for (float f = 0; f < length; f += .0625f) {
|
for (float f = 0; f < length; f += .0625f) {
|
||||||
Vec3d position = start.add(step.scale(f));
|
Vec3d position = start.add(step.scale(f));
|
||||||
if (r.nextInt(10) == 0) {
|
if (r.nextInt(10) == 0) {
|
||||||
world.addParticle(new RedstoneParticleData(canConnect ? .3f : .9f, canConnect ? .9f : .3f, .5f, 1),
|
world.addParticle(new RedstoneParticleData(canConnect ? .3f : .9f, canConnect ? .9f : .3f, .5f, 1),
|
||||||
position.x + .5f, position.y + .5f, position.z + .5f, 0, 0, 0);
|
position.x + .5f, position.y + .5f, position.z + .5f, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@ package com.simibubi.create.content.contraptions.relays.belt.item;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.Create;
|
import com.simibubi.create.Create;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
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.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
public class BeltConnectorItem extends BlockItem {
|
public class BeltConnectorItem extends BlockItem {
|
||||||
|
|
||||||
public BeltConnectorItem(Properties properties) {
|
public BeltConnectorItem(Properties properties) {
|
||||||
|
@ -75,7 +75,7 @@ public class BeltConnectorItem extends BlockItem {
|
||||||
// Remove first if no longer existant or valid
|
// Remove first if no longer existant or valid
|
||||||
if (tag.contains("FirstPulley")) {
|
if (tag.contains("FirstPulley")) {
|
||||||
firstPulley = NBTUtil.readBlockPos(tag.getCompound("FirstPulley"));
|
firstPulley = NBTUtil.readBlockPos(tag.getCompound("FirstPulley"));
|
||||||
if (!validateAxis(world, firstPulley)) {
|
if (!validateAxis(world, firstPulley) || !firstPulley.withinDistance(pos, maxLength() * 2)) {
|
||||||
tag.remove("FirstPulley");
|
tag.remove("FirstPulley");
|
||||||
context.getItem()
|
context.getItem()
|
||||||
.setTag(tag);
|
.setTag(tag);
|
||||||
|
@ -131,9 +131,12 @@ public class BeltConnectorItem extends BlockItem {
|
||||||
|
|
||||||
for (BlockPos pos : beltsToCreate) {
|
for (BlockPos pos : beltsToCreate) {
|
||||||
BeltBlock.Part part = pos.equals(start) ? Part.START : pos.equals(end) ? Part.END : Part.MIDDLE;
|
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)
|
if (part == Part.MIDDLE && pulley)
|
||||||
part = Part.PULLEY;
|
part = Part.PULLEY;
|
||||||
|
if (pulley && shaftState.get(ShaftBlock.AXIS) == Axis.Y)
|
||||||
|
slope = Slope.SIDEWAYS;
|
||||||
world.setBlockState(pos, beltBlock.with(BeltBlock.SLOPE, slope)
|
world.setBlockState(pos, beltBlock.with(BeltBlock.SLOPE, slope)
|
||||||
.with(BeltBlock.PART, part)
|
.with(BeltBlock.PART, part)
|
||||||
.with(BeltBlock.HORIZONTAL_FACING, facing), 3);
|
.with(BeltBlock.HORIZONTAL_FACING, facing), 3);
|
||||||
|
@ -193,11 +196,11 @@ public class BeltConnectorItem extends BlockItem {
|
||||||
return false;
|
return false;
|
||||||
if (!world.isAreaLoaded(second, 1))
|
if (!world.isAreaLoaded(second, 1))
|
||||||
return false;
|
return false;
|
||||||
if (!second.withinDistance(first, AllConfigs.SERVER.kinetics.maxBeltLength.get()))
|
if (!second.withinDistance(first, maxLength()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
BlockPos diff = second.subtract(first);
|
BlockPos diff = second.subtract(first);
|
||||||
Axis axis = world.getBlockState(first)
|
Axis shaftAxis = world.getBlockState(first)
|
||||||
.get(BlockStateProperties.AXIS);
|
.get(BlockStateProperties.AXIS);
|
||||||
|
|
||||||
int x = diff.getX();
|
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)
|
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);
|
+ ((Math.abs(z) == Math.abs(x)) ? 1 : 0);
|
||||||
|
|
||||||
if (axis.getCoordinate(x, y, z) != 0)
|
if (shaftAxis.getCoordinate(x, y, z) != 0)
|
||||||
return false;
|
return false;
|
||||||
if (sames != 1)
|
if (sames != 1)
|
||||||
return false;
|
return false;
|
||||||
if (axis != world.getBlockState(second)
|
if (shaftAxis != world.getBlockState(second)
|
||||||
.get(BlockStateProperties.AXIS))
|
.get(BlockStateProperties.AXIS))
|
||||||
return false;
|
return false;
|
||||||
|
if (shaftAxis == Axis.Y && x != 0 && z != 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
TileEntity tileEntity = world.getTileEntity(first);
|
TileEntity tileEntity = world.getTileEntity(first);
|
||||||
TileEntity tileEntity2 = world.getTileEntity(second);
|
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 =
|
for (BlockPos currentPos = first.add(step); !currentPos.equals(second) && limit-- > 0; currentPos =
|
||||||
currentPos.add(step)) {
|
currentPos.add(step)) {
|
||||||
BlockState blockState = world.getBlockState(currentPos);
|
BlockState blockState = world.getBlockState(currentPos);
|
||||||
if (ShaftBlock.isShaft(blockState) && blockState.get(ShaftBlock.AXIS) == axis)
|
if (ShaftBlock.isShaft(blockState) && blockState.get(ShaftBlock.AXIS) == shaftAxis)
|
||||||
continue;
|
continue;
|
||||||
if (!blockState.getMaterial()
|
if (!blockState.getMaterial()
|
||||||
.isReplaceable())
|
.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) {
|
public static boolean validateAxis(World world, BlockPos pos) {
|
||||||
if (!world.isAreaLoaded(pos, 1))
|
if (!world.isAreaLoaded(pos, 1))
|
||||||
return false;
|
return false;
|
||||||
if (!ShaftBlock.isShaft(world.getBlockState(pos)))
|
if (!ShaftBlock.isShaft(world.getBlockState(pos)))
|
||||||
return false;
|
return false;
|
||||||
if (world.getBlockState(pos)
|
|
||||||
.get(BlockStateProperties.AXIS) == Axis.Y)
|
|
||||||
return false;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class BeltFunnelBlock extends HorizontalInteractionFunnelBlock {
|
||||||
return true;
|
return true;
|
||||||
if (!(stateBelow.getBlock() instanceof BeltBlock))
|
if (!(stateBelow.getBlock() instanceof BeltBlock))
|
||||||
return false;
|
return false;
|
||||||
if (stateBelow.get(BeltBlock.SLOPE) == Slope.VERTICAL)
|
if (!BeltBlock.canTransport(stateBelow))
|
||||||
return false;
|
return false;
|
||||||
if (stateBelow.get(BeltBlock.HORIZONTAL_FACING)
|
if (stateBelow.get(BeltBlock.HORIZONTAL_FACING)
|
||||||
.getAxis() != state.get(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