Prvni verze

This commit is contained in:
bv
2026-09-01 20:29:31 +02:00
commit cffd3e4a76
114 changed files with 5138 additions and 0 deletions
@@ -0,0 +1,33 @@
package com.titanicmc.titanic.registry;
import com.titanicmc.titanic.TitanicMod;
import com.titanicmc.titanic.blockentity.BoilerBlockEntity;
import com.titanicmc.titanic.blockentity.HelmBlockEntity;
import com.titanicmc.titanic.blockentity.LiftingFrameBlockEntity;
import com.titanicmc.titanic.blockentity.RepairPanelBlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
public class ModBlockEntities {
public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITIES =
DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, TitanicMod.MODID);
public static final RegistryObject<BlockEntityType<LiftingFrameBlockEntity>> LIFTING_FRAME =
BLOCK_ENTITIES.register("lifting_frame", () -> BlockEntityType.Builder.of(
LiftingFrameBlockEntity::new, ModBlocks.LIFTING_FRAME.get()).build(null));
public static final RegistryObject<BlockEntityType<RepairPanelBlockEntity>> REPAIR_PANEL =
BLOCK_ENTITIES.register("repair_panel", () -> BlockEntityType.Builder.of(
RepairPanelBlockEntity::new, ModBlocks.REPAIR_PANEL.get()).build(null));
public static final RegistryObject<BlockEntityType<HelmBlockEntity>> HELM =
BLOCK_ENTITIES.register("helm", () -> BlockEntityType.Builder.of(
HelmBlockEntity::new, ModBlocks.HELM.get()).build(null));
public static final RegistryObject<BlockEntityType<BoilerBlockEntity>> BOILER =
BLOCK_ENTITIES.register("boiler", () -> BlockEntityType.Builder.of(
BoilerBlockEntity::new, ModBlocks.BOILER.get()).build(null));
}
@@ -0,0 +1,23 @@
package com.titanicmc.titanic.registry;
import com.titanicmc.titanic.TitanicMod;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.level.block.Block;
public class ModBlockTags {
private ModBlockTags() {
}
/**
* Every block that can legitimately be part of a generated Titanic wreck/ship: the hull
* plating itself plus all the furniture/fixture blocks {@link com.titanicmc.titanic.worldgen.WreckFeature}
* places inside it. Used to bound {@link com.titanicmc.titanic.ship.ShipUtil#collectConnectedBlocks}
* so a flood fill starting on the wreck can never spill out into the surrounding seafloor
* terrain the wreck happens to be resting on/against.
*/
public static final TagKey<Block> SHIP_BLOCKS = TagKey.create(Registries.BLOCK,
new ResourceLocation(TitanicMod.MODID, "ship_blocks"));
}
@@ -0,0 +1,105 @@
package com.titanicmc.titanic.registry;
import com.titanicmc.titanic.TitanicMod;
import com.titanicmc.titanic.block.BoilerBlock;
import com.titanicmc.titanic.block.ChairBlock;
import com.titanicmc.titanic.block.CrankshaftBlock;
import com.titanicmc.titanic.block.HelmBlock;
import com.titanicmc.titanic.block.HelmSocketBlock;
import com.titanicmc.titanic.block.LiftingFrameBlock;
import com.titanicmc.titanic.block.RepairPanelBlock;
import com.titanicmc.titanic.block.WinchBlock;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.MapColor;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
public class ModBlocks {
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, TitanicMod.MODID);
/** Rusted, holed hull plating - generated by the wreck, converted to {@link #SHIP_HULL} on repair. */
public static final RegistryObject<Block> DAMAGED_HULL = BLOCKS.register("damaged_hull",
() -> new Block(BlockBehaviour.Properties.of()
.mapColor(MapColor.COLOR_BROWN)
.strength(4.0f, 20.0f)
.sound(SoundType.NETHERITE_BLOCK)
.requiresCorrectToolForDrops()));
/** Freshly patched hull plating - what {@link #DAMAGED_HULL} becomes once repaired. */
public static final RegistryObject<Block> SHIP_HULL = BLOCKS.register("ship_hull",
() -> new Block(BlockBehaviour.Properties.of()
.mapColor(MapColor.METAL)
.strength(5.0f, 20.0f)
.sound(SoundType.METAL)
.requiresCorrectToolForDrops()));
/** A shattered porthole - generated by the wreck, converted to a glass pane on repair. */
public static final RegistryObject<Block> BROKEN_PORTHOLE = BLOCKS.register("broken_porthole",
() -> new Block(BlockBehaviour.Properties.of()
.mapColor(MapColor.COLOR_LIGHT_GRAY)
.strength(1.0f)
.sound(SoundType.GLASS)
.noOcclusion()));
/** Marks where the real helm will be installed once repairs finish. World-gen only. */
public static final RegistryObject<Block> HELM_SOCKET = BLOCKS.register("helm_socket",
() -> new HelmSocketBlock(BlockBehaviour.Properties.of()
.mapColor(MapColor.WOOD)
.strength(3.0f)
.sound(SoundType.WOOD)
.noOcclusion()));
/** The real, working ship's wheel. */
public static final RegistryObject<Block> HELM = BLOCKS.register("helm",
() -> new HelmBlock(BlockBehaviour.Properties.of()
.mapColor(MapColor.WOOD)
.strength(3.5f)
.sound(SoundType.WOOD)
.noOcclusion()));
public static final RegistryObject<Block> LIFTING_FRAME = BLOCKS.register("lifting_frame",
() -> new LiftingFrameBlock(BlockBehaviour.Properties.of()
.mapColor(MapColor.METAL)
.strength(5.0f)
.sound(SoundType.METAL)
.noOcclusion()));
public static final RegistryObject<Block> WINCH = BLOCKS.register("winch",
() -> new WinchBlock(BlockBehaviour.Properties.of()
.mapColor(MapColor.METAL)
.strength(5.0f)
.sound(SoundType.METAL)));
public static final RegistryObject<Block> REPAIR_PANEL = BLOCKS.register("repair_panel",
() -> new RepairPanelBlock(BlockBehaviour.Properties.of()
.mapColor(MapColor.COLOR_LIGHT_BLUE)
.strength(4.0f)
.sound(SoundType.METAL)
.lightLevel(state -> 6)));
public static final RegistryObject<Block> BOILER = BLOCKS.register("boiler",
() -> new BoilerBlock(BlockBehaviour.Properties.of()
.mapColor(MapColor.COLOR_BLACK)
.strength(6.0f, 20.0f)
.sound(SoundType.METAL)
.lightLevel(state -> 3)
.requiresCorrectToolForDrops()));
public static final RegistryObject<Block> CRANKSHAFT = BLOCKS.register("crankshaft",
() -> new CrankshaftBlock(BlockBehaviour.Properties.of()
.mapColor(MapColor.METAL)
.strength(6.0f, 20.0f)
.sound(SoundType.METAL)
.requiresCorrectToolForDrops()));
public static final RegistryObject<Block> CHAIR = BLOCKS.register("chair",
() -> new ChairBlock(BlockBehaviour.Properties.of()
.mapColor(MapColor.WOOD)
.strength(2.5f)
.sound(SoundType.WOOD)
.noOcclusion()));
}
@@ -0,0 +1,33 @@
package com.titanicmc.titanic.registry;
import com.titanicmc.titanic.TitanicMod;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;
public class ModCreativeTabs {
public static final DeferredRegister<CreativeModeTab> TABS =
DeferredRegister.create(Registries.CREATIVE_MODE_TAB, TitanicMod.MODID);
public static final RegistryObject<CreativeModeTab> TITANIC_TAB = TABS.register("titanic",
() -> CreativeModeTab.builder()
.title(Component.translatable("itemGroup.titanic"))
.icon(() -> ModItems.HELM.get().getDefaultInstance())
.displayItems((parameters, output) -> {
output.accept(ModItems.STEEL_INGOT.get());
output.accept(ModItems.STEEL_CABLE.get());
output.accept(ModItems.SHIPS_WHEEL_PART.get());
output.accept(ModItems.SHIP_HULL.get());
output.accept(ModItems.LIFTING_FRAME.get());
output.accept(ModItems.WINCH.get());
output.accept(ModItems.REPAIR_PANEL.get());
output.accept(ModItems.BOILER.get());
output.accept(ModItems.CRANKSHAFT.get());
output.accept(ModItems.CHAIR.get());
output.accept(ModItems.HELM.get());
})
.build());
}
@@ -0,0 +1,23 @@
package com.titanicmc.titanic.registry;
import com.titanicmc.titanic.TitanicMod;
import com.titanicmc.titanic.entity.SeatEntity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
public class ModEntities {
public static final DeferredRegister<EntityType<?>> ENTITIES =
DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, TitanicMod.MODID);
public static final RegistryObject<EntityType<SeatEntity>> SEAT = ENTITIES.register("seat",
() -> EntityType.Builder.<SeatEntity>of(SeatEntity::new, MobCategory.MISC)
.sized(0.1f, 0.1f)
.noSummon()
.noSave()
.clientTrackingRange(6)
.build("seat"));
}
@@ -0,0 +1,19 @@
package com.titanicmc.titanic.registry;
import com.mojang.serialization.Codec;
import com.titanicmc.titanic.TitanicMod;
import com.titanicmc.titanic.worldgen.WreckFeature;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
public class ModFeatures {
public static final DeferredRegister<Feature<?>> FEATURES =
DeferredRegister.create(ForgeRegistries.FEATURES, TitanicMod.MODID);
public static final RegistryObject<Feature<NoneFeatureConfiguration>> WRECK =
FEATURES.register("wreck", () -> new WreckFeature(NoneFeatureConfiguration.CODEC));
}
@@ -0,0 +1,48 @@
package com.titanicmc.titanic.registry;
import com.titanicmc.titanic.TitanicMod;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
public class ModItems {
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, TitanicMod.MODID);
/** Smelted from iron; used to craft steel cables and hull-repair adjacent recipes. */
public static final RegistryObject<Item> STEEL_INGOT = ITEMS.register("steel_ingot",
() -> new Item(new Item.Properties()));
/**
* Threaded through a Lifting Frame's four eyes and then joined to a Winch to raise the wreck.
* Consumed on use.
*/
public static final RegistryObject<Item> STEEL_CABLE = ITEMS.register("steel_cable",
() -> new Item(new Item.Properties()));
/**
* The final part delivered to the Repair Panel. Consuming it slots a real,
* controllable helm into the wreck's bridge and finishes the repair.
*/
public static final RegistryObject<Item> SHIPS_WHEEL_PART = ITEMS.register("ships_wheel",
() -> new Item(new Item.Properties()));
public static final RegistryObject<Item> SHIP_HULL = ITEMS.register("ship_hull",
() -> new BlockItem(ModBlocks.SHIP_HULL.get(), new Item.Properties()));
public static final RegistryObject<Item> LIFTING_FRAME = ITEMS.register("lifting_frame",
() -> new BlockItem(ModBlocks.LIFTING_FRAME.get(), new Item.Properties()));
public static final RegistryObject<Item> WINCH = ITEMS.register("winch",
() -> new BlockItem(ModBlocks.WINCH.get(), new Item.Properties()));
public static final RegistryObject<Item> REPAIR_PANEL = ITEMS.register("repair_panel",
() -> new BlockItem(ModBlocks.REPAIR_PANEL.get(), new Item.Properties()));
public static final RegistryObject<Item> BOILER = ITEMS.register("boiler",
() -> new BlockItem(ModBlocks.BOILER.get(), new Item.Properties()));
public static final RegistryObject<Item> CRANKSHAFT = ITEMS.register("crankshaft",
() -> new BlockItem(ModBlocks.CRANKSHAFT.get(), new Item.Properties()));
public static final RegistryObject<Item> CHAIR = ITEMS.register("chair",
() -> new BlockItem(ModBlocks.CHAIR.get(), new Item.Properties()));
public static final RegistryObject<Item> HELM = ITEMS.register("helm",
() -> new BlockItem(ModBlocks.HELM.get(), new Item.Properties()));
}