Skip to content

Commit

Permalink
feat(netherite chest)
Browse files Browse the repository at this point in the history
Fixes #45
  • Loading branch information
4nner committed Jun 16, 2023
1 parent 8eefe2e commit 08b2679
Show file tree
Hide file tree
Showing 18 changed files with 108 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/main/java/anner/ironchest/blocks/ChestTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import net.minecraft.util.math.BlockPos;

public enum ChestTypes {
NETHERITE(108, 12, new Identifier(IronChests.MOD_ID, "model/obsidian_chest")),
NETHERITE(126, 14, new Identifier(IronChests.MOD_ID, "model/netherite_chest")),
OBSIDIAN(108, 12, new Identifier(IronChests.MOD_ID, "model/obsidian_chest")),
CRYSTAL(108, 12, new Identifier(IronChests.MOD_ID, "model/crystal_chest")),
DIAMOND(108, 12, new Identifier(IronChests.MOD_ID, "model/diamond_chest")),
Expand Down Expand Up @@ -51,6 +51,7 @@ public static Block get(ChestTypes type) {
case EMERALD -> ModBlocks.EMERALD_CHEST;
case CRYSTAL -> ModBlocks.CRYSTAL_CHEST;
case OBSIDIAN -> ModBlocks.OBSIDIAN_CHEST;
case NETHERITE -> ModBlocks.NETHERITE_CHEST;
case CHRISTMAS -> ModBlocks.CHRISTMAS_CHEST;
default -> Blocks.CHEST;
};
Expand All @@ -66,6 +67,7 @@ public ChestBlockEntity makeEntity(BlockPos pos, BlockState state) {
case EMERALD -> ModBlockEntityType.EMERALD_CHEST.instantiate(pos, state);
case CRYSTAL -> ModBlockEntityType.CRYSTAL_CHEST.instantiate(pos, state);
case OBSIDIAN -> ModBlockEntityType.OBSIDIAN_CHEST.instantiate(pos, state);
case NETHERITE -> ModBlockEntityType.NETHERITE_CHEST.instantiate(pos, state);
case CHRISTMAS -> ModBlockEntityType.CHRISTMAS_CHEST.instantiate(pos, state);
default -> new ChestBlockEntity(pos, state);
};
Expand All @@ -80,6 +82,7 @@ public ScreenHandlerType<ChestScreenHandler> getScreenHandlerType() {
case EMERALD -> ModScreenHandlerType.EMERALD_CHEST;
case CRYSTAL -> ModScreenHandlerType.CRYSTAL_CHEST;
case OBSIDIAN -> ModScreenHandlerType.OBSIDIAN_CHEST;
case NETHERITE -> ModScreenHandlerType.NETHERITE_CHEST;
default -> ModScreenHandlerType.CHRISTMAS_CHEST;
};
}
Expand All @@ -93,6 +96,7 @@ public BlockEntityType<? extends ChestBlockEntity> getBlockEntityType() {
case EMERALD -> ModBlockEntityType.EMERALD_CHEST;
case CRYSTAL -> ModBlockEntityType.CRYSTAL_CHEST;
case OBSIDIAN -> ModBlockEntityType.OBSIDIAN_CHEST;
case NETHERITE -> ModBlockEntityType.NETHERITE_CHEST;
case CHRISTMAS -> ModBlockEntityType.CHRISTMAS_CHEST;
default -> BlockEntityType.CHEST;
};
Expand Down Expand Up @@ -124,6 +128,11 @@ public FabricBlockSettings setting() {
.resistance(1200.0F)
.sounds(BlockSoundGroup.STONE)
.requiresTool();
case NETHERITE -> FabricBlockSettings.create()
.hardness(50.0F)
.resistance(1200.0F)
.sounds(BlockSoundGroup.COPPER)
.requiresTool();
case WOOD, CHRISTMAS -> FabricBlockSettings.create()
.hardness(3.0F)
.resistance(3.0F)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package anner.ironchest.blocks.blockentities;

import anner.ironchest.blocks.ChestTypes;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;

public class NetheriteChestEntity extends GenericChestEntity {
public NetheriteChestEntity(BlockPos pos, BlockState state) {
super(ChestTypes.NETHERITE, pos, state);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public static void registerBlockEntityRenderer() {
BlockEntityRendererFactories.register(ModBlockEntityType.EMERALD_CHEST, ChestEntityRenderer::new);
BlockEntityRendererFactories.register(ModBlockEntityType.CRYSTAL_CHEST, ChestEntityRenderer::new);
BlockEntityRendererFactories.register(ModBlockEntityType.OBSIDIAN_CHEST, ChestEntityRenderer::new);
BlockEntityRendererFactories.register(ModBlockEntityType.NETHERITE_CHEST, ChestEntityRenderer::new);
BlockEntityRendererFactories.register(ModBlockEntityType.CHRISTMAS_CHEST, ChestEntityRenderer::new);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class ModBlockEntityType {
public static final BlockEntityType<EmeraldChestEntity> EMERALD_CHEST = FabricBlockEntityTypeBuilder.create(EmeraldChestEntity::new, ModBlocks.EMERALD_CHEST).build(null);
public static final BlockEntityType<CrystalChestEntity> CRYSTAL_CHEST = FabricBlockEntityTypeBuilder.create(CrystalChestEntity::new, ModBlocks.CRYSTAL_CHEST).build(null);
public static final BlockEntityType<ObsidianChestEntity> OBSIDIAN_CHEST = FabricBlockEntityTypeBuilder.create(ObsidianChestEntity::new, ModBlocks.OBSIDIAN_CHEST).build(null);
public static final BlockEntityType<NetheriteChestEntity> NETHERITE_CHEST = FabricBlockEntityTypeBuilder.create(NetheriteChestEntity::new, ModBlocks.NETHERITE_CHEST).build(null);
public static final BlockEntityType<ChristmasChestEntity> CHRISTMAS_CHEST = FabricBlockEntityTypeBuilder.create(ChristmasChestEntity::new, ModBlocks.CHRISTMAS_CHEST).build(null);

public static void registerBlockEntities() {
Expand All @@ -31,6 +32,7 @@ public static void registerBlockEntities() {
Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(IronChests.MOD_ID, "emerald_chest"), EMERALD_CHEST);
Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(IronChests.MOD_ID, "crystal_chest"), CRYSTAL_CHEST);
Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(IronChests.MOD_ID, "obsidian_chest"), OBSIDIAN_CHEST);
Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(IronChests.MOD_ID, "netherite_chest"), NETHERITE_CHEST);
Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(IronChests.MOD_ID, "christmas_chest"), CHRISTMAS_CHEST);
}
}
2 changes: 2 additions & 0 deletions src/main/java/anner/ironchest/registry/ModBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class ModBlocks {
public static final Block EMERALD_CHEST = new GenericChestBlock(ChestTypes.EMERALD.setting(), ChestTypes.EMERALD);
public static final Block CRYSTAL_CHEST = new CrystalChestBlock();
public static final Block OBSIDIAN_CHEST = new GenericChestBlock(ChestTypes.OBSIDIAN.setting(), ChestTypes.OBSIDIAN);
public static final Block NETHERITE_CHEST = new GenericChestBlock(ChestTypes.NETHERITE.setting(), ChestTypes.NETHERITE);
public static final Block CHRISTMAS_CHEST = new GenericChestBlock(ChestTypes.CHRISTMAS.setting(), ChestTypes.CHRISTMAS);

public static void registerBlocks() {
Expand All @@ -27,6 +28,7 @@ public static void registerBlocks() {
Registry.register(Registries.BLOCK, new Identifier(IronChests.MOD_ID, "emerald_chest"), EMERALD_CHEST);
Registry.register(Registries.BLOCK, new Identifier(IronChests.MOD_ID, "crystal_chest"), CRYSTAL_CHEST);
Registry.register(Registries.BLOCK, new Identifier(IronChests.MOD_ID, "obsidian_chest"), OBSIDIAN_CHEST);
Registry.register(Registries.BLOCK, new Identifier(IronChests.MOD_ID, "netherite_chest"), NETHERITE_CHEST);
Registry.register(Registries.BLOCK, new Identifier(IronChests.MOD_ID, "christmas_chest"), CHRISTMAS_CHEST);
}
}
3 changes: 3 additions & 0 deletions src/main/java/anner/ironchest/registry/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public class ModItems {
public static final BlockItem EMERALD_CHEST = new BlockItem(ModBlocks.EMERALD_CHEST, new Item.Settings());
public static final BlockItem CRYSTAL_CHEST = new BlockItem(ModBlocks.CRYSTAL_CHEST, new Item.Settings());
public static final BlockItem OBSIDIAN_CHEST = new BlockItem(ModBlocks.OBSIDIAN_CHEST, new Item.Settings());
public static final BlockItem NETHERITE_CHEST = new BlockItem(ModBlocks.NETHERITE_CHEST, new Item.Settings());
public static final BlockItem CHRISTMAS_CHEST = new BlockItem(ModBlocks.CHRISTMAS_CHEST, new Item.Settings());

public static void registerItems() {
Expand Down Expand Up @@ -101,6 +102,7 @@ public static void registerItems() {
Registry.register(Registries.ITEM, new Identifier(IronChests.MOD_ID, "emerald_chest"), EMERALD_CHEST);
Registry.register(Registries.ITEM, new Identifier(IronChests.MOD_ID, "crystal_chest"), CRYSTAL_CHEST);
Registry.register(Registries.ITEM, new Identifier(IronChests.MOD_ID, "obsidian_chest"), OBSIDIAN_CHEST);
Registry.register(Registries.ITEM, new Identifier(IronChests.MOD_ID, "netherite_chest"), NETHERITE_CHEST);
Registry.register(Registries.ITEM, new Identifier(IronChests.MOD_ID, "christmas_chest"), CHRISTMAS_CHEST);

ItemGroupEvents.modifyEntriesEvent(IronChests.TAB).register(entries -> {
Expand All @@ -111,6 +113,7 @@ public static void registerItems() {
entries.add(EMERALD_CHEST);
entries.add(CRYSTAL_CHEST);
entries.add(OBSIDIAN_CHEST);
entries.add(NETHERITE_CHEST);
entries.add(CHRISTMAS_CHEST);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class ModScreenHandlerType {
public static ScreenHandlerType<ChestScreenHandler> EMERALD_CHEST;
public static ScreenHandlerType<ChestScreenHandler> CRYSTAL_CHEST;
public static ScreenHandlerType<ChestScreenHandler> OBSIDIAN_CHEST;
public static ScreenHandlerType<ChestScreenHandler> NETHERITE_CHEST;
public static ScreenHandlerType<ChestScreenHandler> CHRISTMAS_CHEST;


Expand All @@ -27,6 +28,7 @@ public static void registerScreenHandlers() {
EMERALD_CHEST = ScreenHandlerRegistry.registerSimple(new Identifier(IronChests.MOD_ID, "emerald_chest"), (syncId, inventory) -> new ChestScreenHandler(EMERALD_CHEST, ChestTypes.EMERALD, syncId, inventory, ScreenHandlerContext.EMPTY));
CRYSTAL_CHEST = ScreenHandlerRegistry.registerSimple(new Identifier(IronChests.MOD_ID, "crystal_chest"), (syncId, inventory) -> new ChestScreenHandler(CRYSTAL_CHEST, ChestTypes.CRYSTAL, syncId, inventory, ScreenHandlerContext.EMPTY));
OBSIDIAN_CHEST = ScreenHandlerRegistry.registerSimple(new Identifier(IronChests.MOD_ID, "obsidian_chest"), (syncId, inventory) -> new ChestScreenHandler(OBSIDIAN_CHEST, ChestTypes.OBSIDIAN, syncId, inventory, ScreenHandlerContext.EMPTY));
NETHERITE_CHEST = ScreenHandlerRegistry.registerSimple(new Identifier(IronChests.MOD_ID, "netherite_chest"), (syncId, inventory) -> new ChestScreenHandler(NETHERITE_CHEST, ChestTypes.NETHERITE, syncId, inventory, ScreenHandlerContext.EMPTY));
CHRISTMAS_CHEST = ScreenHandlerRegistry.registerSimple(new Identifier(IronChests.MOD_ID, "christmas_chest"), (syncId, inventory) -> new ChestScreenHandler(CHRISTMAS_CHEST, ChestTypes.CHRISTMAS, syncId, inventory, ScreenHandlerContext.EMPTY));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public static void registerScreenHandlers() {
ScreenRegistry.<ChestScreenHandler, CottonInventoryScreen<ChestScreenHandler>>register(ModScreenHandlerType.EMERALD_CHEST, (desc, inventory, title) -> new CottonInventoryScreen<>(desc, inventory.player, title));
ScreenRegistry.<ChestScreenHandler, CottonInventoryScreen<ChestScreenHandler>>register(ModScreenHandlerType.CRYSTAL_CHEST, (desc, inventory, title) -> new CottonInventoryScreen<>(desc, inventory.player, title));
ScreenRegistry.<ChestScreenHandler, CottonInventoryScreen<ChestScreenHandler>>register(ModScreenHandlerType.OBSIDIAN_CHEST, (desc, inventory, title) -> new CottonInventoryScreen<>(desc, inventory.player, title));
ScreenRegistry.<ChestScreenHandler, CottonInventoryScreen<ChestScreenHandler>>register(ModScreenHandlerType.NETHERITE_CHEST, (desc, inventory, title) -> new CottonInventoryScreen<>(desc, inventory.player, title));
ScreenRegistry.<ChestScreenHandler, CottonInventoryScreen<ChestScreenHandler>>register(ModScreenHandlerType.CHRISTMAS_CHEST, (desc, inventory, title) -> new CottonInventoryScreen<>(desc, inventory.player, title));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"variants": {
"facing=north": {
"model": "ironchest:block/netherite_chest"
},
"facing=east": {
"model": "ironchest:block/netherite_chest",
"y": 90
},
"facing=south": {
"model": "ironchest:block/netherite_chest",
"y": 180
},
"facing=west": {
"model": "ironchest:block/netherite_chest",
"y": 270
}
}
}
1 change: 1 addition & 0 deletions src/main/resources/assets/ironchest/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"block.ironchest.emerald_chest": "Emerald Chest",
"block.ironchest.crystal_chest": "Crystal Chest",
"block.ironchest.obsidian_chest": "Obsidian Chest",
"block.ironchest.netherite_chest": "Netherite Chest",
"block.ironchest.christmas_chest": "Christmas Chest",
"itemGroup.ironchest.general": "Iron Chests"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parent": "ironchest:block/chest_template",
"textures": {
"0": "ironchest:model/netherite_chest",
"particle": "minecraft:block/netherite"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "ironchest:block/netherite_chest"
}
1 change: 1 addition & 0 deletions src/main/resources/assets/minecraft/atlases/blocks.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
{ "type": "single", "resource": "ironchest:model/emerald_chest" },
{ "type": "single", "resource": "ironchest:model/crystal_chest" },
{ "type": "single", "resource": "ironchest:model/obsidian_chest" },
{ "type": "single", "resource": "ironchest:model/netherite_chest" },
{ "type": "single", "resource": "minecraft:entity/chest/christmas" }
]
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/minecraft/atlases/chests.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
{ "type": "single", "resource": "ironchest:model/emerald_chest" },
{ "type": "single", "resource": "ironchest:model/crystal_chest" },
{ "type": "single", "resource": "ironchest:model/obsidian_chest" },
{ "type": "single", "resource": "ironchest:model/netherite_chest" },
{ "type": "single", "resource": "minecraft:entity/chest/christmas" }
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"bonus_rolls": 0,
"entries": [
{
"type": "minecraft:item",
"name": "ironchest:netherite_chest",
"functions": [
{
"function": "minecraft:copy_name",
"source": "block_entity"
}
]
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}
15 changes: 15 additions & 0 deletions src/main/resources/data/ironchest/recipes/netherite_chest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"type": "minecraft:smithing_transform",
"base": {
"item": "ironchest:diamond_chest"
},
"addition": {
"item": "minecraft:netherite_ingot"
},
"result": {
"item": "ironchest:netherite_chest"
},
"template": {
"item": "minecraft:netherite_upgrade_smithing_template"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"ironchest:diamond_chest",
"ironchest:emerald_chest",
"ironchest:obsidian_chest",
"ironchest:netherite_chest",
"ironchest:crystal_chest"
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"replace": false,
"values": [
"ironchest:obsidian_chest"
"ironchest:obsidian_chest",
"ironchest:netherite_chest"
]
}

0 comments on commit 08b2679

Please sign in to comment.