修复json错误,添加codec
This commit is contained in:
parent
52b723c77b
commit
42c242dfe8
3 changed files with 11 additions and 8 deletions
|
@ -28,6 +28,7 @@ import net.minecraft.world.level.block.*;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityTicker;
|
import net.minecraft.world.level.block.entity.BlockEntityTicker;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||||
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.block.state.StateDefinition;
|
import net.minecraft.world.level.block.state.StateDefinition;
|
||||||
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
||||||
|
@ -48,10 +49,13 @@ public class ContainerBlock extends BaseEntityBlock {
|
||||||
public static final BooleanProperty OPENED = BooleanProperty.create("opened");
|
public static final BooleanProperty OPENED = BooleanProperty.create("opened");
|
||||||
|
|
||||||
public ContainerBlock() {
|
public ContainerBlock() {
|
||||||
super(Properties.of().sound(SoundType.METAL).strength(3.0f).noOcclusion().requiresCorrectToolForDrops());
|
this(Properties.of().sound(SoundType.METAL).strength(3.0f).noOcclusion().requiresCorrectToolForDrops());
|
||||||
this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(OPENED, false));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ContainerBlock(BlockBehaviour.Properties properties) {
|
||||||
|
super(properties);
|
||||||
|
this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(OPENED, false));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
|
@ -188,10 +192,9 @@ public class ContainerBlock extends BaseEntityBlock {
|
||||||
return state.getValue(OPENED) ? box(1, 0, 1, 15, 14, 15) : box(0, 0, 0, 16, 15, 16);
|
return state.getValue(OPENED) ? box(1, 0, 1, 15, 14, 15) : box(0, 0, 0, 16, 15, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO codec
|
|
||||||
@Override
|
@Override
|
||||||
protected @NotNull MapCodec<? extends BaseEntityBlock> codec() {
|
protected MapCodec<? extends BaseEntityBlock> codec() {
|
||||||
return null;
|
return simpleCodec(ContainerBlock::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class ModBlocks {
|
||||||
() -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.METAL).strength(5f, 6f).requiresCorrectToolForDrops()));
|
() -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.METAL).strength(5f, 6f).requiresCorrectToolForDrops()));
|
||||||
public static final DeferredHolder<Block, Block> CEMENTED_CARBIDE_BLOCK = REGISTRY.register("cemented_carbide_block",
|
public static final DeferredHolder<Block, Block> CEMENTED_CARBIDE_BLOCK = REGISTRY.register("cemented_carbide_block",
|
||||||
() -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.METAL).strength(5f, 6f).requiresCorrectToolForDrops()));
|
() -> new Block(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.METAL).strength(5f, 6f).requiresCorrectToolForDrops()));
|
||||||
public static final DeferredHolder<Block, Block> CONTAINER = REGISTRY.register("container", ContainerBlock::new);
|
public static final DeferredHolder<Block, Block> CONTAINER = REGISTRY.register("container", () -> new ContainerBlock());
|
||||||
public static final DeferredHolder<Block, Block> SMALL_CONTAINER = REGISTRY.register("small_container", () -> new SmallContainerBlock());
|
public static final DeferredHolder<Block, Block> SMALL_CONTAINER = REGISTRY.register("small_container", () -> new SmallContainerBlock());
|
||||||
public static final DeferredHolder<Block, Block> CHARGING_STATION = REGISTRY.register("charging_station", ChargingStationBlock::new);
|
public static final DeferredHolder<Block, Block> CHARGING_STATION = REGISTRY.register("charging_station", ChargingStationBlock::new);
|
||||||
public static final DeferredHolder<Block, Block> CREATIVE_CHARGING_STATION = REGISTRY.register("creative_charging_station", () -> new CreativeChargingStationBlock());
|
public static final DeferredHolder<Block, Block> CREATIVE_CHARGING_STATION = REGISTRY.register("creative_charging_station", () -> new CreativeChargingStationBlock());
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"name": "SUPERBWARFARE_LEGENDARY",
|
"name": "SUPERBWARFARE_LEGENDARY",
|
||||||
"constructor": "(ILjava/lang/String;Lnet/minecraft/ChatFormatting;)V",
|
"constructor": "(ILjava/lang/String;Lnet/minecraft/ChatFormatting;)V",
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"class": "com/atsuishio/superbwarfare/init/ModEnumExtends",
|
"class": "com/atsuishio/superbwarfare/init/ModEnumExtensions",
|
||||||
"field": "SUPERBWARFARE_LEGENDARY"
|
"field": "SUPERBWARFARE_LEGENDARY"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
"name": "SUPERBWARFARE_LUNGE_MINE_POSE",
|
"name": "SUPERBWARFARE_LUNGE_MINE_POSE",
|
||||||
"constructor": "(ZLnet/neoforged/neoforge/client/IArmPoseTransformer;)V",
|
"constructor": "(ZLnet/neoforged/neoforge/client/IArmPoseTransformer;)V",
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"class": "com/atsuishio/superbwarfare/init/ModEnumExtends",
|
"class": "com/atsuishio/superbwarfare/init/ModEnumExtensions",
|
||||||
"field": "SUPERBWARFARE_LUNGE_MINE_POSE"
|
"field": "SUPERBWARFARE_LUNGE_MINE_POSE"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue