style upgrade

This commit is contained in:
Chipperfluff 2025-12-18 23:57:19 +01:00
parent baa7f4f810
commit dbaf8a6c0f
31 changed files with 430 additions and 555 deletions

View File

@ -1,47 +1,41 @@
package net.Chipperfluff.chipi;
import net.Chipperfluff.chipi.advancement.ModCriteria;
import net.Chipperfluff.chipi.block.ChipperPortalBlock;
import net.Chipperfluff.chipi.block.ModBlocks;
import net.Chipperfluff.chipi.command.ChpCommand;
import net.Chipperfluff.chipi.effect.ChipiBlessingEvents;
import net.Chipperfluff.chipi.effect.ChipiHungerHandler;
import net.Chipperfluff.chipi.effect.ModEffects;
import net.Chipperfluff.chipi.entity.ModEntities;
import net.Chipperfluff.chipi.entity.custom.MepEntity;
import net.Chipperfluff.chipi.item.ModItemGroups;
import net.Chipperfluff.chipi.item.ModItems;
import net.Chipperfluff.chipi.world.gen.ChipiDungeonGenerator;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerWorldEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.minecraft.server.world.ServerWorld;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerWorldEvents;
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.structure.StructurePlacementData;
import net.minecraft.structure.StructureTemplate;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.world.GameRules;
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.world.gen.GenerationStep;
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry;
import net.Chipperfluff.chipi.effect.ModEffects;
import net.Chipperfluff.chipi.effect.ChipiBlessingEvents;
import net.Chipperfluff.chipi.effect.ChipiHungerHandler;
import net.Chipperfluff.chipi.item.ModItems;
import net.Chipperfluff.chipi.block.ModBlocks;
import net.Chipperfluff.chipi.entity.ModEntities;
import net.Chipperfluff.chipi.item.ModItemGroups;
import net.Chipperfluff.chipi.advancement.ModCriteria;
import net.Chipperfluff.chipi.world.gen.ChipiDungeonGenerator;
import net.Chipperfluff.chipi.block.ChipperPortalBlock;
import net.Chipperfluff.chipi.command.ChpCommand;
import net.Chipperfluff.chipi.entity.custom.MepEntity;
public class ChipiMod implements ModInitializer {
public static final String MOD_ID = "chipi";
private static final Identifier CHIPI_DIM =
new Identifier("chipi", "chipi_dimension");
private static final Identifier CHIPI_DIM = new Identifier("chipi", "chipi_dimension");
private static final Identifier SPAWN_STRUCTURE =
new Identifier("chipi", "spawn");
private static final Identifier SPAWN_STRUCTURE = new Identifier("chipi", "spawn");
@Override
public void onInitialize() {
@ -55,27 +49,19 @@ public class ChipiMod implements ModInitializer {
ChipiBlessingEvents.register();
ChipiHungerHandler.register();
FabricDefaultAttributeRegistry.register(
ModEntities.MEP,
MepEntity.createMepAttributes()
);
FabricDefaultAttributeRegistry.register(ModEntities.MEP, MepEntity.createMepAttributes());
BiomeModifications.addFeature(
BiomeSelectors.foundInOverworld(),
GenerationStep.Feature.UNDERGROUND_ORES,
RegistryKey.of(
RegistryKeys.PLACED_FEATURE,
new Identifier("chipi", "chipper_ore")
)
);
RegistryKeys.PLACED_FEATURE, new Identifier("chipi", "chipper_ore")));
CommandRegistrationCallback.EVENT.register(
(dispatcher, registryAccess, environment) ->
ChpCommand.register(dispatcher)
);
(dispatcher, registryAccess, environment) -> ChpCommand.register(dispatcher));
ServerTickEvents.END_WORLD_TICK.register(world -> {
ServerTickEvents.END_WORLD_TICK.register(
world -> {
if (!world.getRegistryKey().getValue().equals(CHIPI_DIM)) return;
for (PlayerEntity player : world.getPlayers()) {
@ -85,25 +71,24 @@ public class ChipiMod implements ModInitializer {
}
});
ServerWorldEvents.LOAD.register((server, world) -> {
ServerWorldEvents.LOAD.register(
(server, world) -> {
if (!world.getRegistryKey().getValue().equals(CHIPI_DIM)) return;
world.setTimeOfDay(18000);
world.getGameRules()
.get(GameRules.DO_DAYLIGHT_CYCLE)
.set(false, server);
world.getGameRules().get(GameRules.DO_DAYLIGHT_CYCLE).set(false, server);
SpawnPlacedState state = world.getPersistentStateManager()
SpawnPlacedState state =
world.getPersistentStateManager()
.getOrCreate(
SpawnPlacedState::fromNbt,
SpawnPlacedState::new,
"chipi_spawn"
);
"chipi_spawn");
if (state.placed) return;
StructureTemplate spawnTemplate = world
.getStructureTemplateManager()
StructureTemplate spawnTemplate =
world.getStructureTemplateManager()
.getTemplate(SPAWN_STRUCTURE)
.orElse(null);
@ -120,8 +105,7 @@ public class ChipiMod implements ModInitializer {
spawnCenter,
new StructurePlacementData(),
world.getRandom(),
2
);
2);
world.setSpawnPos(spawnCenter.up(), 0.0f);

View File

@ -1,6 +1,7 @@
package net.Chipperfluff.chipi.advancement;
import com.google.gson.JsonObject;
import net.minecraft.advancement.criterion.AbstractCriterion;
import net.minecraft.advancement.criterion.AbstractCriterionConditions;
import net.minecraft.predicate.entity.AdvancementEntityPredicateDeserializer;
@ -8,11 +9,9 @@ import net.minecraft.predicate.entity.LootContextPredicate;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
public class PortalActivatedTrigger
extends AbstractCriterion<PortalActivatedTrigger.Conditions> {
public class PortalActivatedTrigger extends AbstractCriterion<PortalActivatedTrigger.Conditions> {
public static final Identifier ID =
new Identifier("chipi", "portal_activated");
public static final Identifier ID = new Identifier("chipi", "portal_activated");
@Override
public Identifier getId() {
@ -20,11 +19,7 @@ public class PortalActivatedTrigger
}
@Override
public Conditions conditionsFromJson(
JsonObject json,
LootContextPredicate player,
AdvancementEntityPredicateDeserializer deserializer
) {
public Conditions conditionsFromJson(JsonObject json, LootContextPredicate player, AdvancementEntityPredicateDeserializer deserializer) {
return new Conditions(player);
}

View File

@ -1,19 +1,17 @@
package net.Chipperfluff.chipi.advancement;
import com.google.gson.JsonObject;
import net.minecraft.advancement.criterion.AbstractCriterion;
import net.minecraft.advancement.criterion.AbstractCriterionConditions;
import net.minecraft.predicate.entity.AdvancementEntityPredicateDeserializer;
import net.minecraft.predicate.entity.LootContextPredicate;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import net.minecraft.world.BlockView;
public class PortalDestroyedTrigger
extends AbstractCriterion<PortalDestroyedTrigger.Conditions> {
public class PortalDestroyedTrigger extends AbstractCriterion<PortalDestroyedTrigger.Conditions> {
public static final Identifier ID =
new Identifier("chipi", "portal_destroyed");
public static final Identifier ID = new Identifier("chipi", "portal_destroyed");
@Override
public Identifier getId() {
@ -21,11 +19,7 @@ public class PortalDestroyedTrigger
}
@Override
public Conditions conditionsFromJson(
JsonObject json,
LootContextPredicate player,
AdvancementEntityPredicateDeserializer deserializer
) {
public Conditions conditionsFromJson(JsonObject json, LootContextPredicate player, AdvancementEntityPredicateDeserializer deserializer) {
return new Conditions(player);
}

View File

@ -1,6 +1,7 @@
package net.Chipperfluff.chipi.advancement;
import com.google.gson.JsonObject;
import net.minecraft.advancement.criterion.AbstractCriterion;
import net.minecraft.advancement.criterion.AbstractCriterionConditions;
import net.minecraft.predicate.entity.AdvancementEntityPredicateDeserializer;
@ -8,11 +9,9 @@ import net.minecraft.predicate.entity.LootContextPredicate;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
public class VoidConsumedFireTrigger
extends AbstractCriterion<VoidConsumedFireTrigger.Conditions> {
public class VoidConsumedFireTrigger extends AbstractCriterion<VoidConsumedFireTrigger.Conditions> {
public static final Identifier ID =
new Identifier("chipi", "void_consumed_fire");
public static final Identifier ID = new Identifier("chipi", "void_consumed_fire");
@Override
public Identifier getId() {
@ -20,11 +19,7 @@ public class VoidConsumedFireTrigger
}
@Override
protected Conditions conditionsFromJson(
JsonObject json,
LootContextPredicate player,
AdvancementEntityPredicateDeserializer deserializer
) {
protected Conditions conditionsFromJson(JsonObject json, LootContextPredicate player, AdvancementEntityPredicateDeserializer deserializer) {
return new Conditions(player);
}

View File

@ -1,6 +1,7 @@
package net.Chipperfluff.chipi.advancement;
import com.google.gson.JsonObject;
import net.minecraft.advancement.criterion.AbstractCriterion;
import net.minecraft.advancement.criterion.AbstractCriterionConditions;
import net.minecraft.predicate.entity.AdvancementEntityPredicateDeserializer;
@ -8,11 +9,9 @@ import net.minecraft.predicate.entity.LootContextPredicate;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
public class VoidConsumedTrigger
extends AbstractCriterion<VoidConsumedTrigger.Conditions> {
public class VoidConsumedTrigger extends AbstractCriterion<VoidConsumedTrigger.Conditions> {
public static final Identifier ID =
new Identifier("chipi", "void_consumed");
public static final Identifier ID = new Identifier("chipi", "void_consumed");
@Override
public Identifier getId() {
@ -20,11 +19,7 @@ public class VoidConsumedTrigger
}
@Override
protected Conditions conditionsFromJson(
JsonObject json,
LootContextPredicate player,
AdvancementEntityPredicateDeserializer deserializer
) {
protected Conditions conditionsFromJson(JsonObject json, LootContextPredicate player, AdvancementEntityPredicateDeserializer deserializer) {
return new Conditions(player);
}

View File

@ -1,14 +1,13 @@
package net.Chipperfluff.chipi.block;
import net.Chipperfluff.chipi.advancement.ModCriteria;
import net.minecraft.block.BlockState;
import net.minecraft.block.PillarBlock;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.Chipperfluff.chipi.advancement.ModCriteria;
public class ChipperFrameBlock extends PillarBlock {
@ -18,12 +17,7 @@ public class ChipperFrameBlock extends PillarBlock {
@Override
public void onPlaced(
World world,
BlockPos pos,
BlockState state,
LivingEntity placer,
ItemStack stack
) {
World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) {
if (!world.isClient) {
ChipperPortalShape.tryCreate(world, pos);
}
@ -31,19 +25,12 @@ public class ChipperFrameBlock extends PillarBlock {
@Override
public void onStateReplaced(
BlockState state,
World world,
BlockPos pos,
BlockState newState,
boolean moved
) {
BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) {
if (!world.isClient && state.getBlock() != newState.getBlock()) {
ChipperPortalShape.destroyNearby(world, pos);
if (world.getClosestPlayer(
pos.getX(), pos.getY(), pos.getZ(),
10, false
) instanceof ServerPlayerEntity serverPlayer) {
if (world.getClosestPlayer(pos.getX(), pos.getY(), pos.getZ(), 10, false)
instanceof ServerPlayerEntity serverPlayer) {
ModCriteria.PORTAL_DESTROYED.trigger(serverPlayer);
}
}

View File

@ -1,7 +1,5 @@
package net.Chipperfluff.chipi.block;
import java.util.EnumSet;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
@ -18,6 +16,8 @@ import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import java.util.EnumSet;
public class ChipperPortalBlock extends Block {
private static final BlockPos DEFAULT_SPAWN = new BlockPos(5, 90, 6);
@ -30,21 +30,12 @@ public class ChipperPortalBlock extends Block {
// Walk-through portal
@Override
public VoxelShape getCollisionShape(
BlockState state,
BlockView world,
BlockPos pos,
ShapeContext context
) {
BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return VoxelShapes.empty();
}
@Override
public void onEntityCollision(
BlockState state,
World world,
BlockPos pos,
Entity entity
) {
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) {
if (world.isClient) return;
if (!(entity instanceof PlayerEntity player)) return;
@ -56,14 +47,8 @@ public class ChipperPortalBlock extends Block {
@Override
public float calcBlockBreakingDelta(
BlockState state,
PlayerEntity player,
BlockView world,
BlockPos pos
) {
return player.isCreative()
? super.calcBlockBreakingDelta(state, player, world, pos)
: 0.0F;
BlockState state, PlayerEntity player, BlockView world, BlockPos pos) {
return player.isCreative() ? super.calcBlockBreakingDelta(state, player, world, pos) : 0.0F;
}
public static void teleportToChipiSpawn(ServerWorld targetWorld, PlayerEntity player) {
@ -76,8 +61,7 @@ public class ChipperPortalBlock extends Block {
spawn.getZ() + 0.5,
EnumSet.noneOf(PositionFlag.class),
player.getYaw(),
player.getPitch()
);
player.getPitch());
}
public static BlockPos resolveSafeSpawn(ServerWorld targetWorld) {

View File

@ -1,11 +1,11 @@
package net.Chipperfluff.chipi.block;
import net.Chipperfluff.chipi.advancement.ModCriteria;
import net.minecraft.block.BlockState;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import net.Chipperfluff.chipi.advancement.ModCriteria;
public class ChipperPortalShape {
@ -22,18 +22,14 @@ public class ChipperPortalShape {
public static boolean tryCreate(World world, BlockPos placedPos) {
if (!(world instanceof ServerWorld serverWorld)) return false;
for (Direction.Axis axis : new Direction.Axis[]{Direction.Axis.X, Direction.Axis.Z}) {
for (Direction.Axis axis : new Direction.Axis[] {Direction.Axis.X, Direction.Axis.Z}) {
ChipperPortalShape shape = new ChipperPortalShape(world, placedPos, axis);
if (shape.isValid()) {
shape.placePortal();
if (serverWorld.getClosestPlayer(
placedPos.getX(),
placedPos.getY(),
placedPos.getZ(),
10,
false
) instanceof net.minecraft.server.network.ServerPlayerEntity serverPlayer) {
placedPos.getX(), placedPos.getY(), placedPos.getZ(), 10, false)
instanceof net.minecraft.server.network.ServerPlayerEntity serverPlayer) {
ModCriteria.PORTAL_ACTIVATED.trigger(serverPlayer);
}
@ -44,7 +40,6 @@ public class ChipperPortalShape {
return false;
}
private boolean isValid() {
BlockPos base = findBottomLeft();
if (base == null) return false;
@ -79,9 +74,7 @@ public class ChipperPortalShape {
}
private BlockPos offset(BlockPos pos, int x, int y) {
return axis == Direction.Axis.X
? pos.add(0, y, x)
: pos.add(x, y, 0);
return axis == Direction.Axis.X ? pos.add(0, y, x) : pos.add(x, y, 0);
}
private void placePortal() {
@ -91,10 +84,7 @@ public class ChipperPortalShape {
for (int x = 1; x <= 2; x++) {
for (int y = 1; y <= 3; y++) {
world.setBlockState(
offset(base, x, y),
ModBlocks.CHIPPER_PORTAL.getDefaultState(),
3
);
offset(base, x, y), ModBlocks.CHIPPER_PORTAL.getDefaultState(), 3);
}
}
}

View File

@ -1,19 +1,20 @@
package net.Chipperfluff.chipi.block;
import net.minecraft.block.Block;
import net.Chipperfluff.chipi.ChipiMod;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.block.MapColor;
import net.minecraft.block.piston.PistonBehavior;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.Chipperfluff.chipi.ChipiMod;
import net.minecraft.block.piston.PistonBehavior;
public class ModBlocks {
public static final Block VOID_BLOCK = Registry.register(
public static final Block VOID_BLOCK =
Registry.register(
Registries.BLOCK,
new Identifier(ChipiMod.MOD_ID, "void_block"),
new VoidBlock(
@ -21,48 +22,36 @@ public class ModBlocks {
.strength(-1.0F, 3600000.0F)
.mapColor(MapColor.BLACK)
.dropsNothing()
.pistonBehavior(PistonBehavior.BLOCK)
)
);
.pistonBehavior(PistonBehavior.BLOCK)));
public static final Block CHIPPER_FRAME = Registry.register(
public static final Block CHIPPER_FRAME =
Registry.register(
Registries.BLOCK,
new Identifier(ChipiMod.MOD_ID, "chipper_frame"),
new ChipperFrameBlock(
FabricBlockSettings.create()
.strength(3.0f)
.requiresTool()
)
);
FabricBlockSettings.create().strength(3.0f).requiresTool()));
public static final Block CHIPPER_PORTAL = Registry.register(
public static final Block CHIPPER_PORTAL =
Registry.register(
Registries.BLOCK,
new Identifier(ChipiMod.MOD_ID, "chipper_portal"),
new ChipperPortalBlock(
FabricBlockSettings.create()
.noCollision()
.luminance(3)
.strength(-1.0f)
)
);
.strength(-1.0f)));
public static final Block CHIPPER_ORE = Registry.register(
public static final Block CHIPPER_ORE =
Registry.register(
Registries.BLOCK,
new Identifier(ChipiMod.MOD_ID, "chipper_ore"),
new Block(AbstractBlock.Settings
.copy(Blocks.IRON_ORE)
.requiresTool()
)
);
new Block(AbstractBlock.Settings.copy(Blocks.IRON_ORE).requiresTool()));
public static final Block CHIPPER_ALLOY_BLOCK = Registry.register(
public static final Block CHIPPER_ALLOY_BLOCK =
Registry.register(
Registries.BLOCK,
new Identifier(ChipiMod.MOD_ID, "chipper_alloy_block"),
new Block(AbstractBlock.Settings
.copy(Blocks.IRON_BLOCK)
.requiresTool()
)
);
new Block(AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).requiresTool()));
public static void register() {}
}

View File

@ -1,21 +1,21 @@
package net.Chipperfluff.chipi.block;
import net.Chipperfluff.chipi.advancement.ModCriteria;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.damage.DamageType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.Chipperfluff.chipi.advancement.ModCriteria;
import net.minecraft.server.network.ServerPlayerEntity;
public class VoidBlock extends Block {
@ -41,19 +41,15 @@ public class VoidBlock extends Block {
boolean burning = living.isOnFire();
Identifier damageId = burning
Identifier damageId =
burning
? new Identifier("chipi", "void_block_fire")
: new Identifier("chipi", "void_block");
RegistryEntry<DamageType> damageType = world
.getRegistryManager()
RegistryEntry<DamageType> damageType =
world.getRegistryManager()
.get(RegistryKeys.DAMAGE_TYPE)
.entryOf(
RegistryKey.of(
RegistryKeys.DAMAGE_TYPE,
damageId
)
);
.entryOf(RegistryKey.of(RegistryKeys.DAMAGE_TYPE, damageId));
DamageSource source = new DamageSource(damageType);
@ -70,22 +66,12 @@ public class VoidBlock extends Block {
}
@Override
public void onEntityCollision(
BlockState state,
World world,
BlockPos pos,
Entity entity
) {
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) {
voidKill(world, entity);
}
@Override
public void onSteppedOn(
World world,
BlockPos pos,
BlockState state,
Entity entity
) {
public void onSteppedOn(World world, BlockPos pos, BlockState state, Entity entity) {
voidKill(world, entity);
}
}

View File

@ -12,9 +12,7 @@ public class ChipiClient implements ClientModInitializer {
public void onInitializeClient() {
BlockRenderLayerMap.INSTANCE.putBlock(
ModBlocks.CHIPPER_PORTAL,
RenderLayer.getTranslucent()
);
ModBlocks.CHIPPER_PORTAL, RenderLayer.getTranslucent());
ModEntityRenderers.register();
}

View File

@ -14,9 +14,7 @@ public class MepRenderer extends BipedEntityRenderer<MepEntity, BipedEntityModel
new Identifier(ChipiMod.MOD_ID, "textures/entity/mep.png");
public MepRenderer(EntityRendererFactory.Context ctx) {
super(ctx,
new BipedEntityModel<>(ctx.getPart(EntityModelLayers.PLAYER)),
0.5f);
super(ctx, new BipedEntityModel<>(ctx.getPart(EntityModelLayers.PLAYER)), 0.5f);
}
@Override

View File

@ -6,9 +6,6 @@ import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
public class ModEntityRenderers {
public static void register() {
EntityRendererRegistry.register(
ModEntities.MEP,
MepRenderer::new
);
EntityRendererRegistry.register(ModEntities.MEP, MepRenderer::new);
}
}

View File

@ -6,7 +6,6 @@ import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.context.CommandContext;
import net.Chipperfluff.chipi.world.gen.struct.ChipiStructures;
import net.minecraft.command.CommandSource;
import net.minecraft.command.argument.BlockPosArgumentType;
import net.minecraft.server.command.CommandManager;
@ -21,32 +20,37 @@ public class ChpCommand {
dispatcher.register(
CommandManager.literal("chp")
.then(CommandManager.argument("name", StringArgumentType.word())
.then(
CommandManager.argument("name", StringArgumentType.word())
// autocomplete structure names
.suggests((ctx, builder) ->
.suggests(
(ctx, builder) ->
CommandSource.suggestMatching(
ChipiStructures.getNames(),
builder
)
)
.then(CommandManager.argument("pos", BlockPosArgumentType.blockPos())
builder))
.then(
CommandManager.argument(
"pos",
BlockPosArgumentType.blockPos())
// default: no marker
.executes(ctx -> execute(ctx, false))
// optional marker flag
.then(CommandManager.argument("marker", BoolArgumentType.bool())
.executes(ctx ->
execute(ctx, BoolArgumentType.getBool(ctx, "marker"))
)
)
)
)
);
.then(
CommandManager.argument(
"marker",
BoolArgumentType
.bool())
.executes(
ctx ->
execute(
ctx,
BoolArgumentType
.getBool(
ctx,
"marker")))))));
}
private static int execute(
CommandContext<ServerCommandSource> ctx,
boolean marker
) {
private static int execute(CommandContext<ServerCommandSource> ctx, boolean marker) {
ServerCommandSource source = ctx.getSource();
ServerWorld world = source.getWorld();
@ -64,12 +68,12 @@ public class ChpCommand {
structure.placeCommand(world, pos, marker);
source.sendFeedback(
() -> Text.literal(
"Placed structure '" + name +
(marker ? "' with structure block" : "'")
),
false
);
() ->
Text.literal(
"Placed structure '"
+ name
+ (marker ? "' with structure block" : "'")),
false);
return 1;
}

View File

@ -3,7 +3,6 @@ package net.Chipperfluff.chipi.effect;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectCategory;
import net.minecraft.entity.player.PlayerEntity;
public class ChipiBlessingEffect extends StatusEffect {

View File

@ -21,7 +21,6 @@ public class ChipiBlessingEvents {
}
public static boolean cancelFallDamage(ServerPlayerEntity player, DamageSource source) {
return source.isOf(DamageTypes.FALL)
&& player.hasStatusEffect(ModEffects.CHIPI_BLESSING);
return source.isOf(DamageTypes.FALL) && player.hasStatusEffect(ModEffects.CHIPI_BLESSING);
}
}

View File

@ -1,21 +1,19 @@
package net.Chipperfluff.chipi.effect;
import net.Chipperfluff.chipi.ChipiMod;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
import net.Chipperfluff.chipi.ChipiMod;
public class ModEffects {
public static final StatusEffect CHIPI_BLESSING =
new ChipiBlessingEffect();
public static final StatusEffect CHIPI_BLESSING = new ChipiBlessingEffect();
public static void register() {
Registry.register(
Registries.STATUS_EFFECT,
new Identifier(ChipiMod.MOD_ID, "chipi_blessing"),
CHIPI_BLESSING
);
CHIPI_BLESSING);
}
}

View File

@ -11,14 +11,14 @@ import net.minecraft.util.Identifier;
public class ModEntities {
public static final EntityType<MepEntity> MEP = Registry.register(
public static final EntityType<MepEntity> MEP =
Registry.register(
Registries.ENTITY_TYPE,
new Identifier(ChipiMod.MOD_ID, "mep"),
FabricEntityTypeBuilder.createMob()
.entityFactory(MepEntity::new)
.dimensions(EntityDimensions.fixed(0.6f, 1.95f))
.build()
);
.build());
public static void register() {
// called from mod init

View File

@ -36,13 +36,15 @@ public class MepEntity extends PathAwareEntity {
this.goalSelector.add(4, new LookAtEntityGoal(this, PlayerEntity.class, 8.0F));
this.goalSelector.add(5, new LookAroundGoal(this));
this.targetSelector.add(1, new ActiveTargetGoal<>(
this.targetSelector.add(
1,
new ActiveTargetGoal<>(
this,
PlayerEntity.class,
true,
target -> target instanceof PlayerEntity player
&& (angryAtPlayer || !isPlayerProtected(player))
));
target ->
target instanceof PlayerEntity player
&& (angryAtPlayer || !isPlayerProtected(player))));
}
public static DefaultAttributeContainer.Builder createMepAttributes() {
@ -88,7 +90,6 @@ public class MepEntity extends PathAwareEntity {
return false;
}
return state.getBlock() instanceof StairsBlock
|| state.getBlock() instanceof SlabBlock;
return state.getBlock() instanceof StairsBlock || state.getBlock() instanceof SlabBlock;
}
}

View File

@ -4,9 +4,6 @@ import net.minecraft.item.FoodComponent;
public class ModFoodComponents {
public static final FoodComponent NUT = new FoodComponent.Builder()
.hunger(4)
.saturationModifier(0.3f)
.snack()
.build();
public static final FoodComponent NUT =
new FoodComponent.Builder().hunger(4).saturationModifier(0.3f).snack().build();
}

View File

@ -1,5 +1,7 @@
package net.Chipperfluff.chipi.item;
import net.Chipperfluff.chipi.ChipiMod;
import net.Chipperfluff.chipi.block.ModBlocks;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
@ -7,19 +9,18 @@ import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.Chipperfluff.chipi.ChipiMod;
import net.Chipperfluff.chipi.block.ModBlocks;
import net.Chipperfluff.chipi.item.ModItems;
public class ModItemGroups {
public static final ItemGroup CHIPI_GROUP = Registry.register(
public static final ItemGroup CHIPI_GROUP =
Registry.register(
Registries.ITEM_GROUP,
new Identifier(ChipiMod.MOD_ID, "chipi"),
FabricItemGroup.builder()
.displayName(Text.translatable("itemGroup.chipi.chipi"))
.icon(() -> new ItemStack(ModBlocks.VOID_BLOCK.asItem()))
.entries((context, entries) -> {
.entries(
(context, entries) -> {
// Blocks
entries.add(ModBlocks.VOID_BLOCK);
@ -41,8 +42,7 @@ public class ModItemGroups {
entries.add(ModItems.CHIPPER_LEGGINGS);
entries.add(ModItems.CHIPPER_BOOTS);
})
.build()
);
.build());
public static void register() {
// force class load

View File

@ -1,115 +1,118 @@
package net.Chipperfluff.chipi.item;
import net.Chipperfluff.chipi.ChipiMod;
import net.Chipperfluff.chipi.block.ModBlocks;
import net.Chipperfluff.chipi.entity.ModEntities;
import net.Chipperfluff.chipi.item.armor.ChipperArmorMaterial;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.SpawnEggItem;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.Chipperfluff.chipi.ChipiMod;
import net.Chipperfluff.chipi.block.ModBlocks;
import net.minecraft.item.SpawnEggItem;
import net.Chipperfluff.chipi.entity.ModEntities;
import net.minecraft.item.ArmorItem;
import net.Chipperfluff.chipi.item.armor.ChipperArmorMaterial;
public class ModItems {
// ===== BLOCK ITEMS =====
public static final Item VOID_BLOCK = Registry.register(
public static final Item VOID_BLOCK =
Registry.register(
Registries.ITEM,
new Identifier(ChipiMod.MOD_ID, "void_block"),
new BlockItem(ModBlocks.VOID_BLOCK, new FabricItemSettings())
);
new BlockItem(ModBlocks.VOID_BLOCK, new FabricItemSettings()));
public static final Item CHIPPER_FRAME = Registry.register(
public static final Item CHIPPER_FRAME =
Registry.register(
Registries.ITEM,
new Identifier(ChipiMod.MOD_ID, "chipper_frame"),
new BlockItem(ModBlocks.CHIPPER_FRAME, new FabricItemSettings())
);
new BlockItem(ModBlocks.CHIPPER_FRAME, new FabricItemSettings()));
public static final Item CHIPPER_PORTAL = Registry.register(
public static final Item CHIPPER_PORTAL =
Registry.register(
Registries.ITEM,
new Identifier(ChipiMod.MOD_ID, "chipper_portal"),
new BlockItem(ModBlocks.CHIPPER_PORTAL, new FabricItemSettings())
);
new BlockItem(ModBlocks.CHIPPER_PORTAL, new FabricItemSettings()));
public static final Item CHIPPER_ORE = Registry.register(
public static final Item CHIPPER_ORE =
Registry.register(
Registries.ITEM,
new Identifier(ChipiMod.MOD_ID, "chipper_ore"),
new BlockItem(ModBlocks.CHIPPER_ORE, new FabricItemSettings())
);
new BlockItem(ModBlocks.CHIPPER_ORE, new FabricItemSettings()));
public static final Item CHIPPER_ALLOY_BLOCK = Registry.register(
public static final Item CHIPPER_ALLOY_BLOCK =
Registry.register(
Registries.ITEM,
new Identifier(ChipiMod.MOD_ID, "chipper_alloy_block"),
new BlockItem(ModBlocks.CHIPPER_ALLOY_BLOCK, new FabricItemSettings())
);
new BlockItem(ModBlocks.CHIPPER_ALLOY_BLOCK, new FabricItemSettings()));
public static final Item MEP_SPAWN_EGG = Registry.register(
public static final Item MEP_SPAWN_EGG =
Registry.register(
Registries.ITEM,
new Identifier(ChipiMod.MOD_ID, "mep_spawn_egg"),
new SpawnEggItem(
ModEntities.MEP,
0x1E3A5F,
0x6BB6FF,
new Item.Settings()
)
);
new SpawnEggItem(ModEntities.MEP, 0x1E3A5F, 0x6BB6FF, new Item.Settings()));
// ===== NORMAL ITEMS =====
public static final Item NUT = Registry.register(
public static final Item NUT =
Registry.register(
Registries.ITEM,
new Identifier(ChipiMod.MOD_ID, "nut"),
new Item(new FabricItemSettings()
.food(ModFoodComponents.NUT)
)
);
new Item(new FabricItemSettings().food(ModFoodComponents.NUT)));
public static final Item RAW_CHIPPER_ORE = Registry.register(
public static final Item RAW_CHIPPER_ORE =
Registry.register(
Registries.ITEM,
new Identifier(ChipiMod.MOD_ID, "raw_chipper_ore"),
new Item(new FabricItemSettings())
);
new Item(new FabricItemSettings()));
public static final Item CHIPPER_INGOT = Registry.register(
public static final Item CHIPPER_INGOT =
Registry.register(
Registries.ITEM,
new Identifier(ChipiMod.MOD_ID, "chipper_ingot"),
new Item(new FabricItemSettings())
);
new Item(new FabricItemSettings()));
public static final Item CHIPPER_ALLOY = Registry.register(
public static final Item CHIPPER_ALLOY =
Registry.register(
Registries.ITEM,
new Identifier(ChipiMod.MOD_ID, "chipper_alloy"),
new Item(new FabricItemSettings())
);
new Item(new FabricItemSettings()));
public static final Item CHIPPER_HELMET = Registry.register(
public static final Item CHIPPER_HELMET =
Registry.register(
Registries.ITEM,
new Identifier("chipi", "chipper_helmet"),
new ArmorItem(ChipperArmorMaterial.INSTANCE, ArmorItem.Type.HELMET, new Item.Settings())
);
new ArmorItem(
ChipperArmorMaterial.INSTANCE,
ArmorItem.Type.HELMET,
new Item.Settings()));
public static final Item CHIPPER_CHESTPLATE = Registry.register(
public static final Item CHIPPER_CHESTPLATE =
Registry.register(
Registries.ITEM,
new Identifier("chipi", "chipper_chestplate"),
new ArmorItem(ChipperArmorMaterial.INSTANCE, ArmorItem.Type.CHESTPLATE, new Item.Settings())
);
new ArmorItem(
ChipperArmorMaterial.INSTANCE,
ArmorItem.Type.CHESTPLATE,
new Item.Settings()));
public static final Item CHIPPER_LEGGINGS = Registry.register(
public static final Item CHIPPER_LEGGINGS =
Registry.register(
Registries.ITEM,
new Identifier("chipi", "chipper_leggings"),
new ArmorItem(ChipperArmorMaterial.INSTANCE, ArmorItem.Type.LEGGINGS, new Item.Settings())
);
new ArmorItem(
ChipperArmorMaterial.INSTANCE,
ArmorItem.Type.LEGGINGS,
new Item.Settings()));
public static final Item CHIPPER_BOOTS = Registry.register(
public static final Item CHIPPER_BOOTS =
Registry.register(
Registries.ITEM,
new Identifier("chipi", "chipper_boots"),
new ArmorItem(ChipperArmorMaterial.INSTANCE, ArmorItem.Type.BOOTS, new Item.Settings())
);
new ArmorItem(
ChipperArmorMaterial.INSTANCE,
ArmorItem.Type.BOOTS,
new Item.Settings()));
public static void register() {}
}

View File

@ -14,15 +14,15 @@ public class ChipperArmorMaterial implements ArmorMaterial {
public static final ChipperArmorMaterial INSTANCE = new ChipperArmorMaterial();
private static final Map<ArmorItem.Type, Integer> PROTECTION = Util.make(
private static final Map<ArmorItem.Type, Integer> PROTECTION =
Util.make(
new EnumMap<>(ArmorItem.Type.class),
map -> {
map.put(ArmorItem.Type.HELMET, 2);
map.put(ArmorItem.Type.CHESTPLATE, 5);
map.put(ArmorItem.Type.LEGGINGS, 4);
map.put(ArmorItem.Type.BOOTS, 2);
}
);
});
@Override
public int getDurability(ArmorItem.Type type) {

View File

@ -1,6 +1,5 @@
package net.Chipperfluff.chipi.world.gen;
import net.Chipperfluff.chipi.world.gen.DungeonContext;
import net.Chipperfluff.chipi.world.gen.struct.CorridorEWStructure;
import net.Chipperfluff.chipi.world.gen.struct.CorridorNSStructure;
import net.Chipperfluff.chipi.world.gen.struct.RoomBaseStructure;
@ -23,11 +22,15 @@ public class ChipiDungeonGenerator {
// Corridors are 10 long; they should overwrite 1 block into each room (-1 on both ends).
private static final int CORRIDOR_LENGTH = 10;
// Center-to-center step so corridors start 1 block inside the north room and end 1 block inside the south room.
private static final int STEP_Z = ROOM_EXTENT_SOUTH + CORRIDOR_LENGTH + ROOM_EXTENT_NORTH - 1; // 25
private static final int STEP_X = ROOM_EXTENT_EAST + CORRIDOR_LENGTH + ROOM_EXTENT_WEST - 1; // 25
// Center-to-center step so corridors start 1 block inside the north room and end 1 block inside
// the south room.
private static final int STEP_Z =
ROOM_EXTENT_SOUTH + CORRIDOR_LENGTH + ROOM_EXTENT_NORTH - 1; // 25
private static final int STEP_X =
ROOM_EXTENT_EAST + CORRIDOR_LENGTH + ROOM_EXTENT_WEST - 1; // 25
private static final int ROWS_SOUTH = 40; // rows of rooms south of spawn (spawn room itself is already placed)
private static final int ROWS_SOUTH =
40; // rows of rooms south of spawn (spawn room itself is already placed)
private static final int COLS_EW = 40; // columns across X (split roughly evenly around center)
private ChipiDungeonGenerator() {}
@ -37,7 +40,8 @@ public class ChipiDungeonGenerator {
// Spawn is already placed. Fixed anchors (not relative to portal):
// first corridor origin, then the first generated room center is south of spawn.
BlockPos firstCorridorAnchor = new BlockPos(5, CORRIDOR_Y, 11);
BlockPos firstGeneratedRoomCenter = new BlockPos(5, ROOM_Y, 24); // explicit first floor anchor
BlockPos firstGeneratedRoomCenter =
new BlockPos(5, ROOM_Y, 24); // explicit first floor anchor
// First room/corridor use direct instances as requested.
RoomBaseStructure firstRoom = WorldMaster.getDefaultRoom();
@ -56,50 +60,46 @@ public class ChipiDungeonGenerator {
// Place rooms strictly southward (Z never decreases), across X in both directions.
for (int row = 0; row < ROWS_SOUTH; row++) {
for (int col = minCol; col <= maxCol; col++) {
int gridX = col; // grid 0,0 is the first generated room; -X -> negative gridX, +X -> positive gridX
int gridX =
col; // grid 0,0 is the first generated room; -X -> negative gridX, +X ->
// positive gridX
int gridY = row; // gridY increases southward only
BlockPos center = new BlockPos(
BlockPos center =
new BlockPos(
firstGeneratedRoomCenter.getX() + (col * STEP_X),
ROOM_Y,
firstGeneratedRoomCenter.getZ() + (row * STEP_Z)
);
firstGeneratedRoomCenter.getZ() + (row * STEP_Z));
RoomBaseStructure room = WorldMaster.resolveRoom(
ctx(gridX, gridY, center, null)
);
RoomBaseStructure room = WorldMaster.resolveRoom(ctx(gridX, gridY, center, null));
room.placeAt(world, center);
WorldMaster.afterPlaceRoom(
ctx(gridX, gridY, center, room)
);
WorldMaster.afterPlaceRoom(ctx(gridX, gridY, center, room));
}
}
// Connect each room to the next one south with a corridor at fixed Y (no northward connections).
// Connect each room to the next one south with a corridor at fixed Y (no northward
// connections).
for (int row = 0; row < ROWS_SOUTH - 1; row++) {
for (int col = minCol; col <= maxCol; col++) {
int gridX = col;
int gridY = row;
BlockPos currentCenter = new BlockPos(
BlockPos currentCenter =
new BlockPos(
firstGeneratedRoomCenter.getX() + (col * STEP_X),
ROOM_Y,
firstGeneratedRoomCenter.getZ() + (row * STEP_Z)
);
firstGeneratedRoomCenter.getZ() + (row * STEP_Z));
BlockPos anchorSouth = new BlockPos(
BlockPos anchorSouth =
new BlockPos(
currentCenter.getX(),
CORRIDOR_Y,
currentCenter.getZ() + ROOM_EXTENT_SOUTH
);
currentCenter.getZ() + ROOM_EXTENT_SOUTH);
CorridorNSStructure corridorNS = WorldMaster.resolveCorridorNS(
ctx(gridX, gridY, anchorSouth, null)
);
CorridorNSStructure corridorNS =
WorldMaster.resolveCorridorNS(ctx(gridX, gridY, anchorSouth, null));
corridorNS.placeAt(world, anchorSouth);
WorldMaster.afterPlaceCorridorNS(
ctx(gridX, gridY, anchorSouth, corridorNS)
);
WorldMaster.afterPlaceCorridorNS(ctx(gridX, gridY, anchorSouth, corridorNS));
}
}
@ -109,25 +109,22 @@ public class ChipiDungeonGenerator {
int gridX = col;
int gridY = row;
BlockPos currentCenter = new BlockPos(
BlockPos currentCenter =
new BlockPos(
firstGeneratedRoomCenter.getX() + (col * STEP_X),
ROOM_Y,
firstGeneratedRoomCenter.getZ() + (row * STEP_Z)
);
firstGeneratedRoomCenter.getZ() + (row * STEP_Z));
BlockPos anchorEast = new BlockPos(
BlockPos anchorEast =
new BlockPos(
currentCenter.getX() + ROOM_EXTENT_EAST,
CORRIDOR_Y,
currentCenter.getZ()
);
currentCenter.getZ());
CorridorEWStructure corridorEW = WorldMaster.resolveCorridorEW(
ctx(gridX, gridY, anchorEast, null)
);
CorridorEWStructure corridorEW =
WorldMaster.resolveCorridorEW(ctx(gridX, gridY, anchorEast, null));
corridorEW.placeAt(world, anchorEast);
WorldMaster.afterPlaceCorridorEW(
ctx(gridX, gridY, anchorEast, corridorEW)
);
WorldMaster.afterPlaceCorridorEW(ctx(gridX, gridY, anchorEast, corridorEW));
}
}
@ -139,10 +136,18 @@ public class ChipiDungeonGenerator {
runInChipi(world, "fill 7 87 15 3 91 16 minecraft:air");
runInChipi(world, "setblock 4 88 15 minecraft:deepslate_tile_stairs[facing=west,waterlogged=true]");
runInChipi(world, "setblock 4 88 16 minecraft:deepslate_tile_stairs[facing=west,waterlogged=true]");
runInChipi(world, "setblock 6 88 15 minecraft:deepslate_tile_stairs[facing=east,waterlogged=true]");
runInChipi(world, "setblock 6 88 16 minecraft:deepslate_tile_stairs[facing=east,waterlogged=true]");
runInChipi(
world,
"setblock 4 88 15 minecraft:deepslate_tile_stairs[facing=west,waterlogged=true]");
runInChipi(
world,
"setblock 4 88 16 minecraft:deepslate_tile_stairs[facing=west,waterlogged=true]");
runInChipi(
world,
"setblock 6 88 15 minecraft:deepslate_tile_stairs[facing=east,waterlogged=true]");
runInChipi(
world,
"setblock 6 88 16 minecraft:deepslate_tile_stairs[facing=east,waterlogged=true]");
runInChipi(world, "fill 7 88 15 7 91 16 minecraft:deepslate_tiles");
runInChipi(world, "fill 3 88 16 3 91 15 minecraft:deepslate_tiles");
@ -156,8 +161,8 @@ public class ChipiDungeonGenerator {
runInChipi(world, "fill 5 91 16 5 91 15 minecraft:deepslate_tiles");
}
private static void fillBox(ServerWorld world, int x1, int y1, int z1,
int x2, int y2, int z2, BlockState state) {
private static void fillBox(
ServerWorld world, int x1, int y1, int z1, int x2, int y2, int z2, BlockState state) {
int minX = Math.min(x1, x2);
int maxX = Math.max(x1, x2);
int minY = Math.min(y1, y2);
@ -179,11 +184,11 @@ public class ChipiDungeonGenerator {
.getCommandManager()
.executeWithPrefix(
world.getServer().getCommandSource(),
"execute in chipi:chipi_dimension run " + command
);
"execute in chipi:chipi_dimension run " + command);
}
private static DungeonContext ctx(int gridX, int gridY, BlockPos origin, ChipiStructure structure) {
private static DungeonContext ctx(
int gridX, int gridY, BlockPos origin, ChipiStructure structure) {
return DungeonContext.of(gridX, gridY, origin, structure);
}
}

View File

@ -18,6 +18,7 @@ public abstract class ChipiStructure {
/** Offset from STRUCTURE BLOCK → actual structure origin */
protected final int deltaX;
protected final int deltaY;
protected final int deltaZ;
@ -30,8 +31,7 @@ public abstract class ChipiStructure {
/** REAL size from NBT */
public BlockPos getSize(ServerWorld world) {
Optional<StructureTemplate> opt =
world.getStructureTemplateManager().getTemplate(id);
Optional<StructureTemplate> opt = world.getStructureTemplateManager().getTemplate(id);
if (opt.isEmpty()) return BlockPos.ORIGIN;
@ -41,28 +41,18 @@ public abstract class ChipiStructure {
/** Pure structure placement */
public void placeAt(ServerWorld world, BlockPos centerPos) {
Optional<StructureTemplate> opt =
world.getStructureTemplateManager().getTemplate(id);
Optional<StructureTemplate> opt = world.getStructureTemplateManager().getTemplate(id);
if (opt.isEmpty()) {
System.out.println("[CHIPI] Missing structure: " + id);
return;
}
BlockPos origin = centerPos.add(
new BlockPos(deltaX, deltaY, deltaZ)
);
BlockPos origin = centerPos.add(new BlockPos(deltaX, deltaY, deltaZ));
StructureTemplate template = opt.get();
template.place(
world,
origin,
origin,
new StructurePlacementData(),
world.getRandom(),
2
);
template.place(world, origin, origin, new StructurePlacementData(), world.getRandom(), 2);
}
/** Command placement (structure + optional marker) */
@ -70,9 +60,7 @@ public abstract class ChipiStructure {
placeAt(world, placePos);
BlockPos origin = placePos.add(
new BlockPos(deltaX, deltaY, deltaZ)
);
BlockPos origin = placePos.add(new BlockPos(deltaX, deltaY, deltaZ));
if (!marker) return;

View File

@ -1,7 +1,6 @@
package net.Chipperfluff.chipi.world.gen;
import net.minecraft.util.math.BlockPos;
import net.Chipperfluff.chipi.world.gen.ChipiStructure;
public final class DungeonContext {
public static final DungeonContext EMPTY = new DungeonContext();
@ -13,14 +12,16 @@ public final class DungeonContext {
private DungeonContext() {}
private DungeonContext(Integer grid_x, Integer grid_y, BlockPos structure_origin, ChipiStructure structure) {
private DungeonContext(
Integer grid_x, Integer grid_y, BlockPos structure_origin, ChipiStructure structure) {
this.grid_x = grid_x;
this.grid_y = grid_y;
this.structure_origin = structure_origin;
this.structure = structure;
}
public static DungeonContext of(Integer grid_x, Integer grid_y, BlockPos structure_origin, ChipiStructure structure) {
public static DungeonContext of(
Integer grid_x, Integer grid_y, BlockPos structure_origin, ChipiStructure structure) {
return new DungeonContext(grid_x, grid_y, structure_origin, structure);
}

View File

@ -1,6 +1,7 @@
package net.Chipperfluff.chipi.world.gen.struct;
import net.Chipperfluff.chipi.world.gen.ChipiStructure; // <-- THIS WAS MISSING
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@ -20,7 +21,6 @@ public class ChipiStructures {
return REGISTRY.keySet();
}
public static ChipiStructure get(String name) {
return REGISTRY.get(name);
}

View File

@ -1,10 +1,7 @@
package net.Chipperfluff.chipi.world.gen.struct;
import net.Chipperfluff.chipi.world.gen.ChipiStructure;
import net.minecraft.structure.StructureTemplate;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
public class CorridorEWStructure extends ChipiStructure {

View File

@ -1,10 +1,7 @@
package net.Chipperfluff.chipi.world.gen.struct;
import net.Chipperfluff.chipi.world.gen.ChipiStructure;
import net.minecraft.structure.StructureTemplate;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
public class CorridorNSStructure extends ChipiStructure {

View File

@ -1,10 +1,7 @@
package net.Chipperfluff.chipi.world.gen.struct;
import net.Chipperfluff.chipi.world.gen.ChipiStructure;
import net.minecraft.structure.StructureTemplate;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
public class RoomBaseStructure extends ChipiStructure {

View File

@ -1,10 +1,7 @@
package net.Chipperfluff.chipi.world.gen.struct;
import net.Chipperfluff.chipi.world.gen.ChipiStructure;
import net.minecraft.structure.StructureTemplate;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
public class SpawnStructure extends ChipiStructure {