fix casing blockstate of clutch and gearshift

This commit is contained in:
grimmauld 2020-08-20 17:02:36 +02:00
parent 7493da4543
commit 7faf29775d
7 changed files with 75 additions and 75 deletions

View file

@ -91,7 +91,7 @@ f63a5816d4bfe643aa098d03c3b54462dd06fe19 assets/create/blockstates/dolomite_cobb
f179202e59e449157f89efc37229b03bbfd391d7 assets/create/blockstates/dolomite_pillar.json f179202e59e449157f89efc37229b03bbfd391d7 assets/create/blockstates/dolomite_pillar.json
7b1c40891b07c8f3238537625d9e25c8627e7333 assets/create/blockstates/encased_belt.json 7b1c40891b07c8f3238537625d9e25c8627e7333 assets/create/blockstates/encased_belt.json
7b2b836649e729feafa60972bf95e3afb2143131 assets/create/blockstates/encased_fan.json 7b2b836649e729feafa60972bf95e3afb2143131 assets/create/blockstates/encased_fan.json
db1777f0eff1eb6987b569aee513656ae889ae75 assets/create/blockstates/encased_shaft.json e157d7f67b08493b71d7ffea8d622f4a64dbc155 assets/create/blockstates/encased_shaft.json
1442ff1a0e404f99263ba99d734da1dfed03d4e3 assets/create/blockstates/extractor.json 1442ff1a0e404f99263ba99d734da1dfed03d4e3 assets/create/blockstates/extractor.json
a774e815376a67e2a2de44e39af0a1a0b4406932 assets/create/blockstates/fancy_andesite_bricks.json a774e815376a67e2a2de44e39af0a1a0b4406932 assets/create/blockstates/fancy_andesite_bricks.json
180be26a75834cf9cdb881f969f77906e91cc36a assets/create/blockstates/fancy_andesite_bricks_slab.json 180be26a75834cf9cdb881f969f77906e91cc36a assets/create/blockstates/fancy_andesite_bricks_slab.json
@ -129,7 +129,7 @@ de8a40b7daf1497d5aecee47a43b3e0b1d030b00 assets/create/blockstates/fancy_scoria_
fc9ac0a7e7191b93516719455a17177fa6524ecc assets/create/blockstates/fancy_weathered_limestone_bricks_slab.json fc9ac0a7e7191b93516719455a17177fa6524ecc assets/create/blockstates/fancy_weathered_limestone_bricks_slab.json
b2a7c321b1795f20e7433f81a55ce4683de081b8 assets/create/blockstates/fancy_weathered_limestone_bricks_stairs.json b2a7c321b1795f20e7433f81a55ce4683de081b8 assets/create/blockstates/fancy_weathered_limestone_bricks_stairs.json
6372fe02ba0065acb0758121c45a15a1a8fdc5de assets/create/blockstates/fancy_weathered_limestone_bricks_wall.json 6372fe02ba0065acb0758121c45a15a1a8fdc5de assets/create/blockstates/fancy_weathered_limestone_bricks_wall.json
fe9169716dd21a81a3710a89f0a9b7ea4dcd4d51 assets/create/blockstates/fluid_pipe.json 3d97226b5e8d8f70ed08e45e78db1faf78d5e28b assets/create/blockstates/fluid_pipe.json
f0eaab18e16c4f3f65ebf3b55b08f0dc445720fe assets/create/blockstates/fluid_tank.json f0eaab18e16c4f3f65ebf3b55b08f0dc445720fe assets/create/blockstates/fluid_tank.json
e9da1794b6ece7f9aa8bcb43d42c23a55446133b assets/create/blockstates/flywheel.json e9da1794b6ece7f9aa8bcb43d42c23a55446133b assets/create/blockstates/flywheel.json
ac00d40e1ef50a37041c0481afa1a23a14dea78e assets/create/blockstates/framed_glass.json ac00d40e1ef50a37041c0481afa1a23a14dea78e assets/create/blockstates/framed_glass.json
@ -1121,7 +1121,6 @@ e974cd23a5456baef8b634f2d21fd8c3822931ab assets/create/models/item/dolomite_pill
3bbf9f6b33ef075fb2e1d20d58a6169e2e942314 assets/create/models/item/empty_schematic.json 3bbf9f6b33ef075fb2e1d20d58a6169e2e942314 assets/create/models/item/empty_schematic.json
f2d6b88c3174de01e16da555236727efc33b490c assets/create/models/item/encased_belt.json f2d6b88c3174de01e16da555236727efc33b490c assets/create/models/item/encased_belt.json
250bd0716cc1f04b03892ab74eb0b3a0f32a6158 assets/create/models/item/encased_fan.json 250bd0716cc1f04b03892ab74eb0b3a0f32a6158 assets/create/models/item/encased_fan.json
e0f9ad7e7d790e9e21a38fa57395fd3ff892359b assets/create/models/item/encased_shaft.json
68833e2a7836c73776551565783a1d175b715c66 assets/create/models/item/extendo_grip.json 68833e2a7836c73776551565783a1d175b715c66 assets/create/models/item/extendo_grip.json
956646df2a75ed651eabb403a3f9e1024538cd56 assets/create/models/item/extractor.json 956646df2a75ed651eabb403a3f9e1024538cd56 assets/create/models/item/extractor.json
efcbd30ad7a7658c02a3dc3de5fa0f21d7f49b54 assets/create/models/item/fancy_andesite_bricks.json efcbd30ad7a7658c02a3dc3de5fa0f21d7f49b54 assets/create/models/item/fancy_andesite_bricks.json
@ -1921,7 +1920,7 @@ d5fc5b3dc612cd748117e9d8b0ecda76e73f4514 data/create/loot_tables/blocks/dolomite
6121c99e6e037dda9022af3a414aee444467ac1b data/create/loot_tables/blocks/dolomite_pillar.json 6121c99e6e037dda9022af3a414aee444467ac1b data/create/loot_tables/blocks/dolomite_pillar.json
503a93787537b46f462d32b0382c3396f42bb1f6 data/create/loot_tables/blocks/encased_belt.json 503a93787537b46f462d32b0382c3396f42bb1f6 data/create/loot_tables/blocks/encased_belt.json
9055d82b983b673e1638d17b712b9fcd1f5a52e6 data/create/loot_tables/blocks/encased_fan.json 9055d82b983b673e1638d17b712b9fcd1f5a52e6 data/create/loot_tables/blocks/encased_fan.json
b3849bece65e13128fdeb033b156cf6615bc72f8 data/create/loot_tables/blocks/encased_shaft.json b127cb6920e6d7d9c8b2402cb186402a9a8dd3fc data/create/loot_tables/blocks/encased_shaft.json
5a47c1535c866184b4ffca65763f5676f319e0aa data/create/loot_tables/blocks/extractor.json 5a47c1535c866184b4ffca65763f5676f319e0aa data/create/loot_tables/blocks/extractor.json
ddfc4764a6039d771e03af815ac4493da80d2e6b data/create/loot_tables/blocks/fancy_andesite_bricks.json ddfc4764a6039d771e03af815ac4493da80d2e6b data/create/loot_tables/blocks/fancy_andesite_bricks.json
31f2e6932505c68b28e92221a37144f69161c376 data/create/loot_tables/blocks/fancy_andesite_bricks_slab.json 31f2e6932505c68b28e92221a37144f69161c376 data/create/loot_tables/blocks/fancy_andesite_bricks_slab.json

View file

@ -13,19 +13,6 @@
"x": 90, "x": 90,
"y": 180 "y": 180
}, },
"axis=x,casing=copper": {
"model": "create:block/encased_shaft/copper",
"x": 90,
"y": 90
},
"axis=y,casing=copper": {
"model": "create:block/encased_shaft/copper"
},
"axis=z,casing=copper": {
"model": "create:block/encased_shaft/copper",
"x": 90,
"y": 180
},
"axis=x,casing=brass": { "axis=x,casing=brass": {
"model": "create:block/encased_shaft/brass", "model": "create:block/encased_shaft/brass",
"x": 90, "x": 90,

View file

@ -303,8 +303,8 @@
{ {
"when": { "when": {
"west": "false", "west": "false",
"east": "true",
"down": "false", "down": "false",
"east": "true",
"up": "true" "up": "true"
}, },
"apply": { "apply": {
@ -314,8 +314,8 @@
{ {
"when": { "when": {
"west": "true", "west": "true",
"east": "false",
"down": "false", "down": "false",
"east": "false",
"up": "true" "up": "true"
}, },
"apply": { "apply": {
@ -325,8 +325,8 @@
{ {
"when": { "when": {
"west": "false", "west": "false",
"east": "true",
"down": "true", "down": "true",
"east": "true",
"up": "false" "up": "false"
}, },
"apply": { "apply": {
@ -336,8 +336,8 @@
{ {
"when": { "when": {
"west": "true", "west": "true",
"east": "false",
"down": "true", "down": "true",
"east": "false",
"up": "false" "up": "false"
}, },
"apply": { "apply": {
@ -347,8 +347,8 @@
{ {
"when": { "when": {
"west": "false", "west": "false",
"east": "false",
"down": "true", "down": "true",
"east": "false",
"up": "true" "up": "true"
}, },
"apply": { "apply": {
@ -358,8 +358,8 @@
{ {
"when": { "when": {
"west": "false", "west": "false",
"east": "false",
"down": "false", "down": "false",
"east": "false",
"up": "true" "up": "true"
}, },
"apply": { "apply": {
@ -369,8 +369,8 @@
{ {
"when": { "when": {
"west": "false", "west": "false",
"east": "false",
"down": "true", "down": "true",
"east": "false",
"up": "false" "up": "false"
}, },
"apply": { "apply": {
@ -380,8 +380,8 @@
{ {
"when": { "when": {
"west": "true", "west": "true",
"east": "true",
"down": "false", "down": "false",
"east": "true",
"up": "false" "up": "false"
}, },
"apply": { "apply": {
@ -391,8 +391,8 @@
{ {
"when": { "when": {
"west": "false", "west": "false",
"east": "true",
"down": "false", "down": "false",
"east": "true",
"up": "false" "up": "false"
}, },
"apply": { "apply": {
@ -402,8 +402,8 @@
{ {
"when": { "when": {
"west": "true", "west": "true",
"east": "false",
"down": "false", "down": "false",
"east": "false",
"up": "false" "up": "false"
}, },
"apply": { "apply": {
@ -413,8 +413,8 @@
{ {
"when": { "when": {
"west": "false", "west": "false",
"east": "false",
"down": "false", "down": "false",
"east": "false",
"up": "false" "up": "false"
}, },
"apply": { "apply": {

View file

@ -226,8 +226,6 @@ public class AllBlocks {
//.blockstate(BlockStateGen.axisBlockProvider(true)) //.blockstate(BlockStateGen.axisBlockProvider(true))
.blockstate((c, p) -> axisBlock(c, p, blockState -> p.models().getExistingFile(p.modLoc("block/encased_shaft/" + blockState.get(EncasedShaftBlock.CASING).getName())))) .blockstate((c, p) -> axisBlock(c, p, blockState -> p.models().getExistingFile(p.modLoc("block/encased_shaft/" + blockState.get(EncasedShaftBlock.CASING).getName()))))
.loot((p, b) -> p.registerDropping(b, SHAFT.get())) .loot((p, b) -> p.registerDropping(b, SHAFT.get()))
//.item()
//.transform(customItemModel())
.register(); .register();
public static final BlockEntry<GearboxBlock> GEARBOX = REGISTRATE.block("gearbox", GearboxBlock::new) public static final BlockEntry<GearboxBlock> GEARBOX = REGISTRATE.block("gearbox", GearboxBlock::new)

View file

@ -0,0 +1,58 @@
package com.simibubi.create.content.contraptions.relays.encased;
import com.simibubi.create.content.contraptions.base.RotatedPillarKineticBlock;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.material.PushReaction;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.state.StateContainer;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorldReader;
import javax.annotation.Nullable;
@MethodsReturnNonnullByDefault
public abstract class AbstractEncasedShaftBlock extends RotatedPillarKineticBlock {
public AbstractEncasedShaftBlock(Properties properties) {
super(properties);
}
@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder);
}
@Override
public boolean shouldCheckWeakPower(BlockState state, IWorldReader world, BlockPos pos, Direction side) {
return false;
}
@Override
@SuppressWarnings("deprecation")
public PushReaction getPushReaction(@Nullable BlockState state) {
return PushReaction.PUSH_ONLY;
}
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
if (context.getPlayer() != null && context.getPlayer()
.isSneaking())
return super.getStateForPlacement(context);
Direction.Axis preferredAxis = getPreferredAxis(context);
return this.getDefaultState()
.with(AXIS, preferredAxis == null ? context.getNearestLookingDirection()
.getAxis() : preferredAxis);
}
@Override
public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) {
return face.getAxis() == state.get(AXIS);
}
@Override
public Direction.Axis getRotationAxis(BlockState state) {
return state.get(AXIS);
}
}

View file

@ -4,15 +4,12 @@ import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllTileEntities; import com.simibubi.create.AllTileEntities;
import com.simibubi.create.content.contraptions.base.CasingBlock; import com.simibubi.create.content.contraptions.base.CasingBlock;
import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.KineticTileEntity;
import com.simibubi.create.content.contraptions.base.RotatedPillarKineticBlock;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import com.tterrag.registrate.util.entry.BlockEntry; import com.tterrag.registrate.util.entry.BlockEntry;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.material.PushReaction;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext; import net.minecraft.item.ItemUseContext;
import net.minecraft.state.EnumProperty; import net.minecraft.state.EnumProperty;
@ -20,15 +17,12 @@ import net.minecraft.state.IProperty;
import net.minecraft.state.StateContainer; import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType; import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
public class EncasedShaftBlock extends RotatedPillarKineticBlock { public class EncasedShaftBlock extends AbstractEncasedShaftBlock {
public static final IProperty<Casing> CASING = EnumProperty.create("casing", Casing.class); public static final IProperty<Casing> CASING = EnumProperty.create("casing", Casing.class);
@ -48,42 +42,11 @@ public class EncasedShaftBlock extends RotatedPillarKineticBlock {
return new ItemStack(state.get(CASING).getCasingEntry().get().asItem()); return new ItemStack(state.get(CASING).getCasingEntry().get().asItem());
} }
@Override
public boolean shouldCheckWeakPower(BlockState state, IWorldReader world, BlockPos pos, Direction side) {
return false;
}
@Override @Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) { public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return AllTileEntities.ENCASED_SHAFT.create(); return AllTileEntities.ENCASED_SHAFT.create();
} }
@Override
public PushReaction getPushReaction(BlockState state) {
return PushReaction.PUSH_ONLY;
}
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
if (context.getPlayer() != null && context.getPlayer()
.isSneaking())
return super.getStateForPlacement(context);
Axis preferredAxis = getPreferredAxis(context);
return this.getDefaultState()
.with(AXIS, preferredAxis == null ? context.getNearestLookingDirection()
.getAxis() : preferredAxis);
}
@Override
public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) {
return face.getAxis() == state.get(AXIS);
}
@Override
public Axis getRotationAxis(BlockState state) {
return state.get(AXIS);
}
@Override @Override
public ActionResultType onSneakWrenched(BlockState state, ItemUseContext context) { public ActionResultType onSneakWrenched(BlockState state, ItemUseContext context) {
if (context.getWorld().isRemote) if (context.getWorld().isRemote)

View file

@ -23,7 +23,7 @@ import net.minecraft.world.TickPriority;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld; import net.minecraft.world.server.ServerWorld;
public class GearshiftBlock extends EncasedShaftBlock implements ITE<GearshiftTileEntity> { public class GearshiftBlock extends AbstractEncasedShaftBlock implements ITE<GearshiftTileEntity> {
public static final BooleanProperty POWERED = BlockStateProperties.POWERED; public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
@ -46,7 +46,7 @@ public class GearshiftBlock extends EncasedShaftBlock implements ITE<GearshiftTi
@Override @Override
public BlockState getStateForPlacement(BlockItemUseContext context) { public BlockState getStateForPlacement(BlockItemUseContext context) {
return super.getStateForPlacement(context).with(POWERED, return super.getStateForPlacement(context).with(POWERED,
Boolean.valueOf(context.getWorld().isBlockPowered(context.getPos()))); context.getWorld().isBlockPowered(context.getPos()));
} }
@Override @Override
@ -62,10 +62,6 @@ public class GearshiftBlock extends EncasedShaftBlock implements ITE<GearshiftTi
} }
} }
public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) {
return super.hasShaftTowards(world, pos, state, face);
}
@Override @Override
public Class<GearshiftTileEntity> getTileEntityClass() { public Class<GearshiftTileEntity> getTileEntityClass() {
return GearshiftTileEntity.class; return GearshiftTileEntity.class;
@ -90,5 +86,4 @@ public class GearshiftBlock extends EncasedShaftBlock implements ITE<GearshiftTi
KineticTileEntity kte = (KineticTileEntity) te; KineticTileEntity kte = (KineticTileEntity) te;
RotationPropagator.handleAdded(worldIn, pos, kte); RotationPropagator.handleAdded(worldIn, pos, kte);
} }
} }