From c27e68c16a193bdd4a0154a4e4efadfe404bbdb9 Mon Sep 17 00:00:00 2001 From: craisinlord Date: Sun, 13 Sep 2026 12:57:36 -0500 Subject: [PATCH] First pass computer prototype --- .../antarchy/config/AntarchySettings.java | 6 +- .../antarchy/content/AntarchyObjects.java | 26 +++ .../antarchy/content/block/ComputerBlock.java | 100 +++++++++ .../block/entity/ComputerBlockEntity.java | 176 ++++++++++++++++ .../content/client/AntarchyClientHooks.java | 21 ++ .../content/client/model/ComputerModel.java | 27 +++ .../client/renderer/ComputerRenderer.java | 11 + .../content/client/screen/ComputerScreen.java | 146 ++++++++++++++ .../content/creative/CreativeTabContents.java | 8 + .../content/entity/royal/KingEntity.java | 28 ++- .../content/entity/royal/QueenEntity.java | 14 ++ .../content/entity/royal/RoyalBossEntity.java | 14 +- .../content/guide/ComputerGuideData.java | 166 +++++++++++++++ .../antarchy/content/item/FloppyDiskItem.java | 39 ++++ .../elythia/KingsTreeGridFeature.java | 4 +- .../animations/computer.animation.json | 43 ++++ .../assets/antarchy/blockstates/computer.json | 7 + .../assets/antarchy/geo/computer.geo.json | 189 ++++++++++++++++++ .../resources/assets/antarchy/lang/en_us.json | 26 +++ .../antarchy/models/block/computer.json | 6 + .../assets/antarchy/models/item/computer.json | 3 + .../antarchy/models/item/floppy_disk.json | 6 + .../antarchy/computer/disk/chronosphere.json | 5 + .../disk/high_fructose_corn_syrup.json | 5 + .../antarchy/computer/disk/introduction.json | 5 + .../computer/disk/toreterror_arena.json | 5 + .../antarchy/computer/entry/chronosphere.json | 8 + .../entry/high_fructose_corn_syrup.json | 7 + .../antarchy/computer/entry/introduction.json | 7 + .../computer/entry/toreterror_arena.json | 9 + .../loot_table/chests/computer_prototype.json | 23 +++ .../data/antarchy/recipe/computer.json | 14 ++ .../antarchy/fabric/AntarchyFabric.java | 14 ++ .../fabric/AntarchyFabricContent.java | 4 + .../fabric/client/AntarchyFabricClient.java | 19 +- .../client/AntarchyFabricClientBootstrap.java | 4 + .../fabric/registry/AntarchyFabricBlocks.java | 12 ++ .../fabric/registry/AntarchyFabricItems.java | 2 + .../fabric/registry/AntarchyFabricMisc.java | 7 + .../antarchy/neoforge/AntarchyMobsConfig.java | 6 +- .../antarchy/neoforge/AntarchyNeoforge.java | 4 + .../client/AntarchyNeoForgeClient.java | 5 + .../registry/AntarchyNeoForgeEvents.java | 1 + .../registry/AntarchyNeoforgeBlocks.java | 12 ++ .../registry/AntarchyNeoforgeItems.java | 3 + .../registry/AntarchyNeoforgeMisc.java | 6 + 46 files changed, 1242 insertions(+), 11 deletions(-) create mode 100644 common-1.21.1/src/main/java/com/craisinlord/antarchy/content/block/ComputerBlock.java create mode 100644 common-1.21.1/src/main/java/com/craisinlord/antarchy/content/block/entity/ComputerBlockEntity.java create mode 100644 common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/AntarchyClientHooks.java create mode 100644 common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/model/ComputerModel.java create mode 100644 common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/renderer/ComputerRenderer.java create mode 100644 common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/screen/ComputerScreen.java create mode 100644 common-1.21.1/src/main/java/com/craisinlord/antarchy/content/guide/ComputerGuideData.java create mode 100644 common-1.21.1/src/main/java/com/craisinlord/antarchy/content/item/FloppyDiskItem.java create mode 100644 common-1.21.1/src/main/resources/assets/antarchy/animations/computer.animation.json create mode 100644 common-1.21.1/src/main/resources/assets/antarchy/blockstates/computer.json create mode 100644 common-1.21.1/src/main/resources/assets/antarchy/geo/computer.geo.json create mode 100644 common-1.21.1/src/main/resources/assets/antarchy/models/block/computer.json create mode 100644 common-1.21.1/src/main/resources/assets/antarchy/models/item/computer.json create mode 100644 common-1.21.1/src/main/resources/assets/antarchy/models/item/floppy_disk.json create mode 100644 common-1.21.1/src/main/resources/data/antarchy/computer/disk/chronosphere.json create mode 100644 common-1.21.1/src/main/resources/data/antarchy/computer/disk/high_fructose_corn_syrup.json create mode 100644 common-1.21.1/src/main/resources/data/antarchy/computer/disk/introduction.json create mode 100644 common-1.21.1/src/main/resources/data/antarchy/computer/disk/toreterror_arena.json create mode 100644 common-1.21.1/src/main/resources/data/antarchy/computer/entry/chronosphere.json create mode 100644 common-1.21.1/src/main/resources/data/antarchy/computer/entry/high_fructose_corn_syrup.json create mode 100644 common-1.21.1/src/main/resources/data/antarchy/computer/entry/introduction.json create mode 100644 common-1.21.1/src/main/resources/data/antarchy/computer/entry/toreterror_arena.json create mode 100644 common-1.21.1/src/main/resources/data/antarchy/loot_table/chests/computer_prototype.json create mode 100644 common-1.21.1/src/main/resources/data/antarchy/recipe/computer.json diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/config/AntarchySettings.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/config/AntarchySettings.java index 02c978f5..a24bd81b 100644 --- a/common-1.21.1/src/main/java/com/craisinlord/antarchy/config/AntarchySettings.java +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/config/AntarchySettings.java @@ -545,9 +545,9 @@ public final class AntarchySettings { private static double manticoreHealth = 40.0D; private static double manticoreAttackDamage = 7.0D; private static int manticoreStingPoisonTicks = 100; - private static int queenManticoreCap = 15; - private static int queenManticoreSummonCooldownTicks = 600; - private static int queenManticoreSummonCount = 3; + private static int queenManticoreCap = 6; + private static int queenManticoreSummonCooldownTicks = 800; + private static int queenManticoreSummonCount = 2; private static double queenManticoreSummonRange = 24.0D; private static double queenBeamDamage = 45.0D; private static double queenBeamRange = 100.0D; diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/AntarchyObjects.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/AntarchyObjects.java index 0421ada6..fa96587a 100644 --- a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/AntarchyObjects.java +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/AntarchyObjects.java @@ -206,6 +206,16 @@ public final class AntarchyObjects { public static Supplier> GLIMMER_VARIANT_COMPONENT = (Supplier>) UNBOUND; @SuppressWarnings("unchecked") + public static Supplier> FLOPPY_DISK_COMPONENT = + (Supplier>) UNBOUND; + @SuppressWarnings("unchecked") + public static Supplier FLOPPY_DISK = (Supplier) UNBOUND; + @SuppressWarnings("unchecked") + public static Supplier COMPUTER = (Supplier) UNBOUND; + @SuppressWarnings("unchecked") + public static Supplier> COMPUTER_BLOCK_ENTITY = + (Supplier>) UNBOUND; + @SuppressWarnings("unchecked") public static Supplier> DORRIE_INVENTORY_MENU = (Supplier>) UNBOUND; @SuppressWarnings("unchecked") public static Supplier> ROYAL_JUDGMENT_MENU = (Supplier>) UNBOUND; @@ -897,6 +907,22 @@ public final class AntarchyObjects { GLIMMER_VARIANT_COMPONENT = supplier; } + public static void setFloppyDiskComponent(Supplier> supplier) { + FLOPPY_DISK_COMPONENT = supplier; + } + + public static void setFloppyDisk(Supplier supplier) { + FLOPPY_DISK = supplier; + } + + public static void setComputer(Supplier supplier) { + COMPUTER = supplier; + } + + public static void setComputerBlockEntity(Supplier> supplier) { + COMPUTER_BLOCK_ENTITY = supplier; + } + public static void setDorrieInventoryMenu(Supplier> supplier) { DORRIE_INVENTORY_MENU = supplier; } diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/block/ComputerBlock.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/block/ComputerBlock.java new file mode 100644 index 00000000..a976cd6f --- /dev/null +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/block/ComputerBlock.java @@ -0,0 +1,100 @@ +package com.craisinlord.antarchy.content.block; + +import com.craisinlord.antarchy.content.AntarchyObjects; +import com.craisinlord.antarchy.content.block.entity.ComputerBlockEntity; +import com.craisinlord.antarchy.content.client.AntarchyClientHooks; +import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +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.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; + +public final class ComputerBlock extends BaseEntityBlock { + public static final MapCodec CODEC = Block.simpleCodec(ComputerBlock::new); + private static final VoxelShape SHAPE = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D); + + public ComputerBlock(BlockBehaviour.Properties properties) { + super(properties); + } + + @Override + public MapCodec codec() { + return CODEC; + } + + @Override + protected RenderShape getRenderShape(BlockState state) { + return RenderShape.ENTITYBLOCK_ANIMATED; + } + + @Override + protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { + return SHAPE; + } + + @Override + protected void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean movedByPiston) { + if (!state.is(newState.getBlock()) && level.getBlockEntity(pos) instanceof ComputerBlockEntity computer) { + computer.dropDisks(level, pos); + } + super.onRemove(state, level, pos, newState, movedByPiston); + } + + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new ComputerBlockEntity(pos, state, AntarchyObjects.COMPUTER_BLOCK_ENTITY); + } + + @Override + public BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType blockEntityType) { + return createTickerHelper(blockEntityType, AntarchyObjects.COMPUTER_BLOCK_ENTITY.get(), ComputerBlockEntity::tick); + } + + @Override + protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, + InteractionHand hand, BlockHitResult hitResult) { + if (level.getBlockEntity(pos) instanceof ComputerBlockEntity computer) { + if (level.isClientSide) { + if (stack.is(AntarchyObjects.FLOPPY_DISK.get())) { + return ItemInteractionResult.SUCCESS; + } + } else if (computer.insert(stack, player)) { + return ItemInteractionResult.CONSUME; + } + } + return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + } + + @Override + protected net.minecraft.world.InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, + BlockHitResult hitResult) { + if (level.getBlockEntity(pos) instanceof ComputerBlockEntity computer) { + if (player.isShiftKeyDown()) { + if (computer.ejectOne(player)) { + return net.minecraft.world.InteractionResult.SUCCESS; + } + return net.minecraft.world.InteractionResult.PASS; + } + computer.activate(); + if (level.isClientSide) { + AntarchyClientHooks.openComputer(pos); + } + return net.minecraft.world.InteractionResult.SUCCESS; + } + return net.minecraft.world.InteractionResult.PASS; + } +} diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/block/entity/ComputerBlockEntity.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/block/entity/ComputerBlockEntity.java new file mode 100644 index 00000000..66b77be3 --- /dev/null +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/block/entity/ComputerBlockEntity.java @@ -0,0 +1,176 @@ +package com.craisinlord.antarchy.content.block.entity; + +import com.craisinlord.antarchy.content.AntarchyObjects; +import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.StringTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.Containers; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; + +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import java.util.function.Supplier; +import software.bernie.geckolib.animatable.GeoBlockEntity; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.RawAnimation; +import software.bernie.geckolib.animation.PlayState; +import software.bernie.geckolib.util.GeckoLibUtil; + +public final class ComputerBlockEntity extends BlockEntity implements GeoBlockEntity { + private static final String DISKS_TAG = "Disks"; + private static final String ACTIVE_UNTIL_TAG = "ActiveUntil"; + private final Set diskIds = new LinkedHashSet<>(); + private final AnimatableInstanceCache animatableCache = GeckoLibUtil.createInstanceCache(this); + private static final RawAnimation ON = RawAnimation.begin().thenLoop("on_state"); + private static final RawAnimation OFF = RawAnimation.begin().thenLoop("off_state"); + private static final RawAnimation TURN_ON = RawAnimation.begin().thenPlay("turn_on"); + private static final RawAnimation TURN_OFF = RawAnimation.begin().thenPlay("turn_off"); + private long activeUntil; + private boolean lastActive; + + public ComputerBlockEntity(BlockPos pos, BlockState state, Supplier> type) { + super(type.get(), pos, state); + } + + public static void tick(Level level, BlockPos pos, BlockState state, ComputerBlockEntity computer) { + boolean active = computer.isActive(); + if (active != computer.lastActive) { + computer.lastActive = active; + computer.triggerAnim("transitions", active ? "turn_on" : "turn_off"); + } + if (!level.isClientSide && computer.activeUntil > 0L && level.getGameTime() >= computer.activeUntil && !level.hasNeighborSignal(pos)) { + computer.activeUntil = 0L; + computer.setChanged(); + level.sendBlockUpdated(pos, state, state, 3); + } + } + + public boolean insert(ItemStack stack, Player player) { + if (!stack.is(AntarchyObjects.FLOPPY_DISK.get())) { + return false; + } + ResourceLocation diskId = stack.get(AntarchyObjects.FLOPPY_DISK_COMPONENT.get()); + if (diskId == null || this.diskIds.contains(diskId)) { + stack.shrink(1); + activate(); + return true; + } + this.diskIds.add(diskId); + stack.shrink(1); + activate(); + setChanged(); + if (level != null) { + level.sendBlockUpdated(worldPosition, getBlockState(), getBlockState(), 3); + } + return true; + } + + public void activate() { + if (level != null && !level.isClientSide) { + activeUntil = Math.max(activeUntil, level.getGameTime() + 40L); + setChanged(); + level.sendBlockUpdated(worldPosition, getBlockState(), getBlockState(), 3); + } + } + + public boolean isActive() { + return level != null && (level.hasNeighborSignal(worldPosition) || level.getGameTime() < activeUntil); + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllers) { + controllers.add(new AnimationController<>(this, "state", state -> state.setAndContinue(isActive() ? ON : OFF))); + controllers.add(new AnimationController<>(this, "transitions", state -> PlayState.STOP) + .triggerableAnim("turn_on", TURN_ON) + .triggerableAnim("turn_off", TURN_OFF)); + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return animatableCache; + } + + public List diskIds() { + return List.copyOf(diskIds); + } + + public boolean ejectOne(Player player) { + if (level == null || level.isClientSide || diskIds.isEmpty()) { + return false; + } + ResourceLocation diskId = diskIds.iterator().next(); + diskIds.remove(diskId); + ItemStack disk = diskStack(diskId); + if (!player.addItem(disk)) { + player.drop(disk, false); + } + setChanged(); + level.sendBlockUpdated(worldPosition, getBlockState(), getBlockState(), 3); + return true; + } + + public void dropDisks(Level level, BlockPos pos) { + if (level.isClientSide) { + return; + } + for (ResourceLocation diskId : diskIds) { + Containers.dropItemStack(level, pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, diskStack(diskId)); + } + diskIds.clear(); + } + + private static ItemStack diskStack(ResourceLocation diskId) { + ItemStack stack = new ItemStack(AntarchyObjects.FLOPPY_DISK.get()); + stack.set(AntarchyObjects.FLOPPY_DISK_COMPONENT.get(), diskId); + return stack; + } + + @Override + protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.loadAdditional(tag, registries); + diskIds.clear(); + ListTag disks = tag.getList(DISKS_TAG, 8); + for (int index = 0; index < disks.size(); index++) { + try { + diskIds.add(ResourceLocation.parse(disks.getString(index))); + } catch (Exception ignored) { + } + } + activeUntil = tag.getLong(ACTIVE_UNTIL_TAG); + } + + @Override + protected void saveAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.saveAdditional(tag, registries); + ListTag disks = new ListTag(); + for (ResourceLocation diskId : diskIds) { + disks.add(StringTag.valueOf(diskId.toString())); + } + tag.put(DISKS_TAG, disks); + tag.putLong(ACTIVE_UNTIL_TAG, activeUntil); + } + + @Override + public CompoundTag getUpdateTag(HolderLookup.Provider registries) { + CompoundTag tag = new CompoundTag(); + saveAdditional(tag, registries); + return tag; + } + + @Override + public net.minecraft.network.protocol.Packet getUpdatePacket() { + return net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket.create(this); + } +} diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/AntarchyClientHooks.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/AntarchyClientHooks.java new file mode 100644 index 00000000..1b822b80 --- /dev/null +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/AntarchyClientHooks.java @@ -0,0 +1,21 @@ +package com.craisinlord.antarchy.content.client; + +import net.minecraft.core.BlockPos; + +import java.util.function.Consumer; + +public final class AntarchyClientHooks { + private static Consumer computerOpener = pos -> { + }; + + private AntarchyClientHooks() { + } + + public static void setComputerOpener(Consumer opener) { + computerOpener = opener; + } + + public static void openComputer(BlockPos pos) { + computerOpener.accept(pos); + } +} diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/model/ComputerModel.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/model/ComputerModel.java new file mode 100644 index 00000000..87bdb90b --- /dev/null +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/model/ComputerModel.java @@ -0,0 +1,27 @@ +package com.craisinlord.antarchy.content.client.model; + +import com.craisinlord.antarchy.Antarchy; +import com.craisinlord.antarchy.content.block.entity.ComputerBlockEntity; +import net.minecraft.resources.ResourceLocation; +import software.bernie.geckolib.model.GeoModel; + +public final class ComputerModel extends GeoModel { + private static final ResourceLocation MODEL = ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "geo/computer.geo.json"); + private static final ResourceLocation TEXTURE = ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "textures/block/computer/computer.png"); + private static final ResourceLocation ANIMATION = ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "animations/computer.animation.json"); + + @Override + public ResourceLocation getModelResource(ComputerBlockEntity animatable) { + return MODEL; + } + + @Override + public ResourceLocation getTextureResource(ComputerBlockEntity animatable) { + return TEXTURE; + } + + @Override + public ResourceLocation getAnimationResource(ComputerBlockEntity animatable) { + return ANIMATION; + } +} diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/renderer/ComputerRenderer.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/renderer/ComputerRenderer.java new file mode 100644 index 00000000..d1ffa3b0 --- /dev/null +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/renderer/ComputerRenderer.java @@ -0,0 +1,11 @@ +package com.craisinlord.antarchy.content.client.renderer; + +import com.craisinlord.antarchy.content.block.entity.ComputerBlockEntity; +import com.craisinlord.antarchy.content.client.model.ComputerModel; +import software.bernie.geckolib.renderer.GeoBlockRenderer; + +public final class ComputerRenderer extends GeoBlockRenderer { + public ComputerRenderer(net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider.Context context) { + super(new ComputerModel()); + } +} diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/screen/ComputerScreen.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/screen/ComputerScreen.java new file mode 100644 index 00000000..090ec3a4 --- /dev/null +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/screen/ComputerScreen.java @@ -0,0 +1,146 @@ +package com.craisinlord.antarchy.content.client.screen; + +import com.craisinlord.antarchy.content.AntarchyObjects; +import com.craisinlord.antarchy.content.block.entity.ComputerBlockEntity; +import com.craisinlord.antarchy.content.guide.ComputerGuideData; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.network.chat.Component; +import net.minecraft.util.FormattedCharSequence; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; + +import java.util.List; + +public final class ComputerScreen extends Screen { + private static final int WIDTH = 320; + private static final int HEIGHT = 210; + private static final String[] CATEGORIES = {"general", "elythia", "thoraxis", "cavaryn"}; + private static final int[] COLORS = {0xFF65FF65, 0xFF65FF65, 0xFFFF5A5A, 0xFFFFA044}; + private final ResourceLocation positionDimension; + private final net.minecraft.core.BlockPos position; + private int categoryIndex; + private int selectedIndex; + private List visibleEntries = List.of(); + + public ComputerScreen(net.minecraft.core.BlockPos position) { + super(Component.translatable("screen.antarchy.computer")); + this.position = position; + this.positionDimension = Minecraft.getInstance().level == null ? null : Minecraft.getInstance().level.dimension().location(); + } + + @Override + protected void init() { + refreshEntries(); + int left = (this.width - WIDTH) / 2; + int top = (this.height - HEIGHT) / 2; + for (int index = 0; index < CATEGORIES.length; index++) { + int buttonIndex = index; + addRenderableWidget(Button.builder(Component.translatable("guide.antarchy.category." + CATEGORIES[index]), button -> { + categoryIndex = buttonIndex; + selectedIndex = 0; + refreshEntries(); + }).bounds(left + 10 + index * 75, top + 10, 70, 20).build()); + } + } + + private void refreshEntries() { + if (Minecraft.getInstance().level != null && Minecraft.getInstance().level.getBlockEntity(position) instanceof ComputerBlockEntity computer) { + visibleEntries = ComputerGuideData.entriesFor(computer.diskIds()).stream() + .filter(entry -> entry.category().equals(CATEGORIES[categoryIndex])) + .toList(); + } else { + visibleEntries = List.of(); + } + if (selectedIndex >= visibleEntries.size()) { + selectedIndex = Math.max(0, visibleEntries.size() - 1); + } + } + + @Override + public void tick() { + refreshEntries(); + } + + @Override + public void render(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) { + int left = (this.width - WIDTH) / 2; + int top = (this.height - HEIGHT) / 2; + graphics.fill(0, 0, this.width, this.height, 0x99000000); + graphics.fill(left, top, left + WIDTH, top + HEIGHT, 0xFF071007); + graphics.fill(left + 4, top + 4, left + WIDTH - 4, top + HEIGHT - 4, 0xFF102010); + int accent = COLORS[categoryIndex]; + graphics.fill(left + 8, top + 34, left + WIDTH - 8, top + 36, accent); + graphics.drawString(this.font, Component.translatable("screen.antarchy.computer"), left + 12, top + 45, accent, false); + graphics.drawString(this.font, Component.literal(positionDimension == null ? "ARCHIVE OFFLINE" : "ARCHIVE ONLINE"), left + WIDTH - 105, top + 45, 0xFF65FF65, false); + graphics.fill(left + 10, top + 60, left + 112, top + HEIGHT - 12, 0xFF050805); + for (int index = 0; index < visibleEntries.size() && index < 6; index++) { + ComputerGuideData.Entry entry = visibleEntries.get(index); + int y = top + 68 + index * 20; + int color = index == selectedIndex ? accent : 0xFF65FF65; + if (index == selectedIndex) { + graphics.fill(left + 12, y - 2, left + 110, y + 14, 0xFF173817); + } + graphics.drawString(this.font, Component.literal("FILE_" + (index + 1)), left + 16, y, color, false); + if (isMouseOver(left + 12, y - 2, 98, 16, mouseX, mouseY)) { + graphics.renderTooltip(this.font, Component.translatable(entry.titleKey()), mouseX, mouseY); + } + } + if (visibleEntries.isEmpty()) { + graphics.drawString(this.font, Component.literal("NO DATA FOUND"), left + 22, top + 86, accent, false); + graphics.drawString(this.font, Component.literal("INSERT FLOPPY DISKS"), left + 16, top + 104, 0xFF65FF65, false); + } else { + renderEntry(graphics, visibleEntries.get(selectedIndex), left + 124, top + 62, accent); + } + super.render(graphics, mouseX, mouseY, partialTick); + } + + private void renderEntry(GuiGraphics graphics, ComputerGuideData.Entry entry, int x, int y, int accent) { + graphics.drawString(this.font, Component.translatable(entry.titleKey()), x, y, accent, false); + if (!entry.subtitleKey().isEmpty()) { + graphics.drawString(this.font, Component.translatable(entry.subtitleKey()), x, y + 16, 0xFF99FF99, false); + } + int line = y + 34; + for (String descriptionKey : entry.descriptionKeys()) { + for (FormattedCharSequence wrapped : this.font.split(Component.translatable(descriptionKey), 174)) { + graphics.drawString(this.font, wrapped, x, line, 0xFFB8FFB8, false); + line += 11; + if (line > y + 125) { + return; + } + } + line += 5; + } + if (entry.type().equals("item") && !entry.itemId().isEmpty()) { + try { + ItemStack stack = new ItemStack(net.minecraft.core.registries.BuiltInRegistries.ITEM.get(ResourceLocation.parse(entry.itemId()))); + graphics.renderItem(stack, x + 130, y + 122); + } catch (Exception ignored) { + } + } + } + + @Override + public boolean mouseClicked(double mouseX, double mouseY, int button) { + int left = (this.width - WIDTH) / 2; + int top = (this.height - HEIGHT) / 2; + for (int index = 0; index < visibleEntries.size() && index < 6; index++) { + if (isMouseOver(left + 12, top + 66 + index * 20, 98, 16, mouseX, mouseY)) { + selectedIndex = index; + return true; + } + } + return super.mouseClicked(mouseX, mouseY, button); + } + + private static boolean isMouseOver(int x, int y, int width, int height, double mouseX, double mouseY) { + return mouseX >= x && mouseX < x + width && mouseY >= y && mouseY < y + height; + } + + @Override + public boolean isPauseScreen() { + return false; + } +} diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/creative/CreativeTabContents.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/creative/CreativeTabContents.java index 590065e0..7042a97a 100644 --- a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/creative/CreativeTabContents.java +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/creative/CreativeTabContents.java @@ -1,5 +1,6 @@ package com.craisinlord.antarchy.content.creative; +import com.craisinlord.antarchy.content.AntarchyObjects; import com.craisinlord.antarchy.content.entity.glimmer.GlimmerVariant; import com.craisinlord.antarchy.content.item.GlimmerBottleItem; import com.craisinlord.antarchy.content.item.royal.RoyalGearHelper; @@ -394,6 +395,8 @@ public final class CreativeTabContents { entry("lucid_anchor", "tools_and_utilities"), entry("undertrial_spawner", "tools_and_utilities"), entry("undervault", "tools_and_utilities"), + entry("computer", "functional_blocks"), + entry("floppy_disk", "tools_and_utilities"), entry("undertrial_key", "tools_and_utilities"), entry("reverie_bottle", "tools_and_utilities"), entry("glimmer_bottle", "tools_and_utilities"), @@ -636,6 +639,11 @@ public final class CreativeTabContents { for (String potionPath : ANTARCHY_POTION_FAMILIES) { acceptPotionFamily(output, potionPath); } + for (String diskId : List.of("antarchy:introduction", "antarchy:chronosphere", "antarchy:toreterror_arena", "antarchy:high_fructose_corn_syrup")) { + ItemStack disk = new ItemStack(AntarchyObjects.FLOPPY_DISK.get()); + disk.set(AntarchyObjects.FLOPPY_DISK_COMPONENT.get(), ResourceLocation.parse(diskId)); + output.accept(disk); + } } public static boolean populateNeoForgeVanillaTab(ResourceKey tabKey, HolderLookup.Provider holders, diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/royal/KingEntity.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/royal/KingEntity.java index 5de49b4a..a5504795 100644 --- a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/royal/KingEntity.java +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/royal/KingEntity.java @@ -93,6 +93,10 @@ public class KingEntity extends RoyalBossEntity { private static final double TREE_RETURN_RELEASE_RADIUS = 144.0D; private static final double TREE_ORBIT_ANGLE_STEP = 0.014D; private static final int TREE_ORBIT_PATH_SAMPLES = 16; + private static final double KING_FOLLOW_RANGE = 192.0D; + private static final double COME_NO_CLOSER_RADIUS = 16.0D; + private static final int COME_NO_CLOSER_PARTICLE_INTERVAL = 4; + private static final int COME_NO_CLOSER_PARTICLE_COUNT = 40; @Nullable private Vec3 patrolCenter; @@ -147,7 +151,13 @@ public class KingEntity extends RoyalBossEntity { } public static AttributeSupplier.Builder createAttributes() { - return createBaseAttributes(AntarchySettings.kingHealth(), AntarchySettings.kingAttackDamage()); + return createBaseAttributes(AntarchySettings.kingHealth(), AntarchySettings.kingAttackDamage()) + .add(net.minecraft.world.entity.ai.attributes.Attributes.FOLLOW_RANGE, KING_FOLLOW_RANGE); + } + + @Override + protected int maxConcurrentHeadAttacks(Phase phase) { + return phase.maxConcurrentHeadAttacks(); } public void setTreePatrolHome(Vec3 center, double minimumY, double maximumY, double angle) { @@ -371,6 +381,7 @@ public class KingEntity extends RoyalBossEntity { if (this.level().isClientSide) { return; } + this.tickComeNoCloserIndicator(); this.tickRoyalPunishment(); this.tickPendingExileAnimation(); long gameTime = this.level().getGameTime(); @@ -426,6 +437,21 @@ public class KingEntity extends RoyalBossEntity { } } + private void tickComeNoCloserIndicator() { + if (!(this.activeDecree instanceof ComeNoCloserDecree) + || this.tickCount % COME_NO_CLOSER_PARTICLE_INTERVAL != 0 + || !(this.level() instanceof ServerLevel serverLevel)) { + return; + } + for (int index = 0; index < COME_NO_CLOSER_PARTICLE_COUNT; index++) { + double angle = (Math.PI * 2.0D * index) / COME_NO_CLOSER_PARTICLE_COUNT; + double x = this.getX() + Math.cos(angle) * COME_NO_CLOSER_RADIUS; + double z = this.getZ() + Math.sin(angle) * COME_NO_CLOSER_RADIUS; + serverLevel.sendParticles(ParticleTypes.END_ROD, x, this.getY() + 0.25D, z, + 1, 0.0D, 0.0D, 0.0D, 0.0D); + } + } + private void tickTreePatrol() { Vec3 center = this.treePatrolCenter; if (center == null) { diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/royal/QueenEntity.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/royal/QueenEntity.java index 9021b0c9..c10bf976 100644 --- a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/royal/QueenEntity.java +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/royal/QueenEntity.java @@ -67,6 +67,7 @@ public class QueenEntity extends RoyalBossEntity { private static final int ACCELERATION_COOLDOWN = 500; private static final int ACCELERATION_DURATION = 140; private static final int BLACK_HOLE_COOLDOWN = 340; + private static final double QUEEN_BITE_COOLDOWN_MULTIPLIER = 1.5D; private int manticoreSummonCooldownTicks; private int gravityStompCooldownTicks; @@ -111,6 +112,19 @@ public class QueenEntity extends RoyalBossEntity { return 1.55D; } + @Override + protected int maxConcurrentHeadAttacks(Phase phase) { + return switch (phase) { + case ONE, TWO -> 1; + case THREE -> 2; + }; + } + + @Override + protected int biteCooldownTicks(Phase phase) { + return Math.max(10, (int) Math.ceil(super.biteCooldownTicks(phase) * QUEEN_BITE_COOLDOWN_MULTIPLIER)); + } + protected void registerRoyalTargetGoals() { this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, KingEntity.class, true)); this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true)); diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/royal/RoyalBossEntity.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/royal/RoyalBossEntity.java index a5a56bfc..f7d2f576 100644 --- a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/royal/RoyalBossEntity.java +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/royal/RoyalBossEntity.java @@ -276,6 +276,16 @@ public abstract class RoyalBossEntity extends Monster implements GeoEntity, Mult return 1.3D; } + /** Allows a boss to tune its head-bite concurrency without changing the other royal boss. */ + protected int maxConcurrentHeadAttacks(Phase phase) { + return phase.maxConcurrentHeadAttacks(); + } + + /** Allows a boss to tune bite pacing without changing the other royal boss. */ + protected int biteCooldownTicks(Phase phase) { + return Math.max(10, Mth.floor(AntarchySettings.royalBossBiteCooldownTicks() * phase.cooldownScale())); + } + public String geoNameForRender() { return this.geoName(); } @@ -472,7 +482,7 @@ public abstract class RoyalBossEntity extends Monster implements GeoEntity, Mult } for (RoyalHead head : this.heads) { - if (activeHeadAttacks >= phase.maxConcurrentHeadAttacks()) { + if (activeHeadAttacks >= this.maxConcurrentHeadAttacks(phase)) { break; } if (!head.readyToAttack() || this.attackScheduler.laneBusy(this.headLane(head))) { @@ -810,7 +820,7 @@ public abstract class RoyalBossEntity extends Monster implements GeoEntity, Mult } private void startBite(RoyalHead head, Phase phase) { - int cooldown = Math.max(10, Mth.floor(AntarchySettings.royalBossBiteCooldownTicks() * phase.cooldownScale())); + int cooldown = this.biteCooldownTicks(phase); if (!this.beginRoyalAttack("bite_" + head.slot().name(), headLane(head), cooldown, BITE_HIT_TICK, 1, BITE_DURATION_TICKS - BITE_HIT_TICK, new RoyalAttackScheduler.Action() { diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/guide/ComputerGuideData.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/guide/ComputerGuideData.java new file mode 100644 index 00000000..3b5ba093 --- /dev/null +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/guide/ComputerGuideData.java @@ -0,0 +1,166 @@ +package com.craisinlord.antarchy.content.guide; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.packs.resources.ResourceManager; +import net.minecraft.server.packs.resources.SimplePreparableReloadListener; +import net.minecraft.util.profiling.ProfilerFiller; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +public final class ComputerGuideData extends SimplePreparableReloadListener { + private static final ComputerGuideData INSTANCE = new ComputerGuideData(); + private static volatile Map entries = Map.of(); + private static volatile Map disks = Map.of(); + + private ComputerGuideData() { + } + + public static ComputerGuideData instance() { + return INSTANCE; + } + + public static Entry entry(ResourceLocation id) { + return entries.get(id); + } + + public static Disk disk(ResourceLocation id) { + return disks.get(id); + } + + public static List entriesFor(List diskIds) { + Map result = new LinkedHashMap<>(); + for (ResourceLocation diskId : diskIds) { + Disk disk = disks.get(diskId); + if (disk == null) { + continue; + } + for (ResourceLocation entryId : disk.entries()) { + Entry entry = entries.get(entryId); + if (entry != null) { + result.putIfAbsent(entryId, entry); + } + } + } + return result.values().stream().sorted(Comparator.comparing(entry -> entry.titleKey().toString())).toList(); + } + + @Override + protected LoadedData prepare(ResourceManager resourceManager, ProfilerFiller profiler) { + Map loadedEntries = new HashMap<>(); + Map loadedDisks = new HashMap<>(); + for (Map.Entry resource : resourceManager.listResources("computer/entry", path -> path.getPath().endsWith(".json")).entrySet()) { + ResourceLocation id = resourceId(resource.getKey(), "computer/entry"); + try { + JsonElement json = JsonParser.parseReader(resource.getValue().openAsReader()); + parseEntry(id, json, loadedEntries); + } catch (Exception ignored) { + } + } + for (Map.Entry resource : resourceManager.listResources("computer/disk", path -> path.getPath().endsWith(".json")).entrySet()) { + ResourceLocation id = resourceId(resource.getKey(), "computer/disk"); + try { + JsonElement json = JsonParser.parseReader(resource.getValue().openAsReader()); + parseDisk(id, json, loadedDisks); + } catch (Exception ignored) { + } + } + return new LoadedData(Map.copyOf(loadedEntries), Map.copyOf(loadedDisks)); + } + + @Override + protected void apply(LoadedData data, ResourceManager resourceManager, ProfilerFiller profiler) { + entries = data.entries(); + disks = data.disks(); + } + + private static ResourceLocation resourceId(ResourceLocation path, String directory) { + String prefix = directory + "/"; + String value = path.getPath().startsWith(prefix) ? path.getPath().substring(prefix.length()) : path.getPath(); + if (value.endsWith(".json")) { + value = value.substring(0, value.length() - 5); + } + return ResourceLocation.fromNamespaceAndPath(path.getNamespace(), value); + } + + private static void parseEntry(ResourceLocation id, JsonElement element, Map target) { + if (!element.isJsonObject()) { + return; + } + JsonObject object = element.getAsJsonObject(); + String type = string(object, "type", "article"); + String category = string(object, "category", "general"); + String title = string(object, "title", "guide.antarchy.missing_title"); + String subtitle = string(object, "subtitle", ""); + List description = strings(object.get("description")); + String item = string(object, "item", ""); + String structure = string(object, "structure", ""); + String dimension = string(object, "dimension", ""); + target.put(id, new Entry(id, type, category, title, subtitle, description, item, structure, dimension)); + } + + private static void parseDisk(ResourceLocation id, JsonElement element, Map target) { + if (!element.isJsonObject()) { + return; + } + JsonObject object = element.getAsJsonObject(); + String category = string(object, "category", "general"); + String title = string(object, "title", "guide.antarchy.missing_disk_title"); + List entryIds = new ArrayList<>(); + JsonElement entriesElement = object.get("entries"); + if (entriesElement != null && entriesElement.isJsonArray()) { + for (JsonElement entry : entriesElement.getAsJsonArray()) { + if (entry.isJsonPrimitive() && entry.getAsJsonPrimitive().isString()) { + try { + entryIds.add(ResourceLocation.parse(entry.getAsString())); + } catch (Exception ignored) { + } + } + } + } + target.put(id, new Disk(id, category, title, List.copyOf(entryIds))); + } + + private static String string(JsonObject object, String key, String fallback) { + JsonElement element = object.get(key); + return element != null && element.isJsonPrimitive() ? element.getAsString() : fallback; + } + + private static List strings(JsonElement element) { + if (element == null) { + return List.of(); + } + if (element.isJsonPrimitive()) { + return List.of(element.getAsString()); + } + if (!element.isJsonArray()) { + return List.of(); + } + List values = new ArrayList<>(); + JsonArray array = element.getAsJsonArray(); + for (JsonElement value : array) { + if (value.isJsonPrimitive()) { + values.add(value.getAsString()); + } + } + return List.copyOf(values); + } + + public record Entry(ResourceLocation id, String type, String category, String titleKey, String subtitleKey, + List descriptionKeys, String itemId, String structureId, String dimensionId) { + } + + public record Disk(ResourceLocation id, String category, String titleKey, List entries) { + } + + record LoadedData(Map entries, Map disks) { + } +} diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/item/FloppyDiskItem.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/item/FloppyDiskItem.java new file mode 100644 index 00000000..6681675c --- /dev/null +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/item/FloppyDiskItem.java @@ -0,0 +1,39 @@ +package com.craisinlord.antarchy.content.item; + +import com.craisinlord.antarchy.content.AntarchyObjects; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; + +import java.util.List; + +public final class FloppyDiskItem extends Item { + public FloppyDiskItem(Properties properties) { + super(properties.stacksTo(1)); + } + + @Override + public Component getName(ItemStack stack) { + ResourceLocation id = stack.get(AntarchyObjects.FLOPPY_DISK_COMPONENT.get()); + if (id != null) { + var disk = com.craisinlord.antarchy.content.guide.ComputerGuideData.disk(id); + if (disk != null) { + return Component.translatable(disk.titleKey()); + } + } + return Component.translatable("item.antarchy.floppy_disk"); + } + + @Override + public void appendHoverText(ItemStack stack, TooltipContext context, List tooltip, TooltipFlag flag) { + ResourceLocation id = stack.get(AntarchyObjects.FLOPPY_DISK_COMPONENT.get()); + if (id != null) { + var disk = com.craisinlord.antarchy.content.guide.ComputerGuideData.disk(id); + if (disk != null) { + tooltip.add(Component.translatable("guide.antarchy.category." + disk.category())); + } + } + } +} diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/worldgen/elythia/KingsTreeGridFeature.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/worldgen/elythia/KingsTreeGridFeature.java index f36689dd..2015399e 100644 --- a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/worldgen/elythia/KingsTreeGridFeature.java +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/worldgen/elythia/KingsTreeGridFeature.java @@ -144,7 +144,9 @@ public final class KingsTreeGridFeature extends Feature reload(PreparableReloadListener.PreparationBarrier barrier, ResourceManager manager, + ProfilerFiller prepareProfiler, ProfilerFiller applyProfiler, + Executor prepareExecutor, Executor applyExecutor) { + return com.craisinlord.antarchy.content.guide.ComputerGuideData.instance().reload( + barrier, manager, prepareProfiler, applyProfiler, prepareExecutor, applyExecutor); + } + }); } private static void registerTradeReloadListener() { diff --git a/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/AntarchyFabricContent.java b/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/AntarchyFabricContent.java index 9bae7b26..363c9a65 100644 --- a/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/AntarchyFabricContent.java +++ b/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/AntarchyFabricContent.java @@ -400,6 +400,10 @@ public final class AntarchyFabricContent { AntarchyObjects.setCookedCorndog(() -> AntarchyFabricItems.COOKED_CORNDOG.get()); AntarchyObjects.setGlimmerBottle(() -> AntarchyFabricItems.GLIMMER_BOTTLE.get()); AntarchyObjects.setGlimmerVariantComponent(() -> AntarchyFabricMisc.GLIMMER_VARIANT.get()); + AntarchyObjects.setFloppyDiskComponent(() -> AntarchyFabricMisc.FLOPPY_DISK_COMPONENT.get()); + AntarchyObjects.setFloppyDisk(() -> AntarchyFabricItems.FLOPPY_DISK.get()); + AntarchyObjects.setComputer(() -> AntarchyFabricBlocks.COMPUTER.get()); + AntarchyObjects.setComputerBlockEntity(() -> AntarchyFabricBlocks.COMPUTER_BLOCK_ENTITY.get()); AntarchyObjects.setAmericanComponent(() -> AntarchyFabricMisc.AMERICAN.get()); AntarchyObjects.setLumen(() -> AntarchyFabricMisc.LUMEN.get()); AntarchyObjects.setFlowingLumen(() -> AntarchyFabricMisc.FLOWING_LUMEN.get()); diff --git a/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/client/AntarchyFabricClient.java b/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/client/AntarchyFabricClient.java index ee14787f..c6a6d189 100644 --- a/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/client/AntarchyFabricClient.java +++ b/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/client/AntarchyFabricClient.java @@ -1,6 +1,8 @@ package com.craisinlord.antarchy.fabric.client; import com.craisinlord.antarchy.Antarchy; +import com.craisinlord.antarchy.content.client.AntarchyClientHooks; +import com.craisinlord.antarchy.content.client.screen.ComputerScreen; import com.craisinlord.antarchy.fabric.network.AntarchyFabricClientNetworking; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.resource.IdentifiableResourceReloadListener; @@ -10,6 +12,7 @@ import net.minecraft.server.packs.PackType; import net.minecraft.server.packs.resources.PreparableReloadListener; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.util.profiling.ProfilerFiller; +import net.minecraft.client.Minecraft; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; @@ -20,6 +23,21 @@ public final class AntarchyFabricClient implements ClientModInitializer { AntarchyFabricClientNetworking.register(); AntarchyFabricClientNetworking.bootstrapMultipartClient(); AntarchyFabricClientBootstrap.register(); + AntarchyClientHooks.setComputerOpener(pos -> Minecraft.getInstance().setScreen(new ComputerScreen(pos))); + ResourceManagerHelper.get(PackType.CLIENT_RESOURCES).registerReloadListener(new IdentifiableResourceReloadListener() { + @Override + public ResourceLocation getFabricId() { + return ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "computer_guide_client"); + } + + @Override + public CompletableFuture reload(PreparableReloadListener.PreparationBarrier barrier, ResourceManager manager, + ProfilerFiller prepareProfiler, ProfilerFiller applyProfiler, + Executor prepareExecutor, Executor applyExecutor) { + return com.craisinlord.antarchy.content.guide.ComputerGuideData.instance().reload( + barrier, manager, prepareProfiler, applyProfiler, prepareExecutor, applyExecutor); + } + }); ResourceManagerHelper.get(PackType.CLIENT_RESOURCES).registerReloadListener(new IdentifiableResourceReloadListener() { @Override public ResourceLocation getFabricId() { @@ -35,4 +53,3 @@ public final class AntarchyFabricClient implements ClientModInitializer { }); } } - diff --git a/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/client/AntarchyFabricClientBootstrap.java b/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/client/AntarchyFabricClientBootstrap.java index ba7ca725..e9b87fc9 100644 --- a/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/client/AntarchyFabricClientBootstrap.java +++ b/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/client/AntarchyFabricClientBootstrap.java @@ -102,6 +102,10 @@ public final class AntarchyFabricClientBootstrap { (net.minecraft.world.level.block.entity.BlockEntityType) AntarchyFabricBlocks.UNDERVAULT_BLOCK_ENTITY.get(), (BlockEntityRendererProvider) UnderVaultRenderer::new ); + BlockEntityRendererRegistry.register( + (net.minecraft.world.level.block.entity.BlockEntityType) AntarchyFabricBlocks.COMPUTER_BLOCK_ENTITY.get(), + (BlockEntityRendererProvider) ComputerRenderer::new + ); EntityRendererRegistry.register(AntarchyFabricEntities.EASTER_BUNNY.get(), context -> withTemporalGeoLayer(new EasterBunnyRenderer(context))); EntityRendererRegistry.register(AntarchyFabricEntities.FLYING_SQUIRREL.get(), context -> withTemporalGeoLayer(new FlyingSquirrelRenderer(context))); diff --git a/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricBlocks.java b/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricBlocks.java index ccdea6bf..b10eb392 100644 --- a/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricBlocks.java +++ b/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricBlocks.java @@ -6,6 +6,7 @@ import com.craisinlord.antarchy.content.AntarchyObjects; import com.craisinlord.antarchy.content.block.*; import com.craisinlord.antarchy.content.block.entity.AntNestBlockEntity; import com.craisinlord.antarchy.content.block.entity.CritterCageBlockEntity; +import com.craisinlord.antarchy.content.block.entity.ComputerBlockEntity; import com.craisinlord.antarchy.content.block.entity.DreamCampfireBlockEntity; import com.craisinlord.antarchy.content.block.entity.HushweedBlockEntity; import com.craisinlord.antarchy.content.block.entity.LucidAnchorBlockEntity; @@ -1211,6 +1212,8 @@ public final class AntarchyFabricBlocks { public static final DeferredBlock UPPER = BLOCKS.register("upper", () -> new UpperBlock(AntarchyFabricBlocks::upperBlockEntityType, BlockBehaviour.Properties.ofFullCopy(Blocks.HOPPER))); + public static final DeferredBlock COMPUTER = BLOCKS.register("computer", + () -> new com.craisinlord.antarchy.content.block.ComputerBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).noOcclusion())); public static final DeferredBlock ANTIMETAL_RAIL = BLOCKS.register("antimetal_rail", () -> new com.craisinlord.antarchy.content.block.AntimetalRailBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.RAIL))); @@ -1528,6 +1531,11 @@ public final class AntarchyFabricBlocks { (pos, state) -> new DimensionalTearMarkerBlockEntity(pos, state, AntarchyFabricBlocks::dimensionalTearMarkerBlockEntityType), DIMENSIONAL_TEAR_MARKER.get() ).build(null)); + public static final DeferredHolder, BlockEntityType> COMPUTER_BLOCK_ENTITY = BLOCK_ENTITY_TYPES.register("computer", + () -> BlockEntityType.Builder.of( + (pos, state) -> new ComputerBlockEntity(pos, state, AntarchyFabricBlocks::computerBlockEntityType), + COMPUTER.get() + ).build(null)); public static final DeferredHolder, BlockEntityType> QUEEN_TRAIL_SPAWN_MARKER_BLOCK_ENTITY = BLOCK_ENTITY_TYPES.register("queen_trail_spawn_marker", () -> BlockEntityType.Builder.of( (pos, state) -> new QueenTrailSpawnMarkerBlockEntity(pos, state, AntarchyFabricBlocks::queenTrailSpawnMarkerBlockEntityType), @@ -1568,6 +1576,10 @@ public final class AntarchyFabricBlocks { return UPPER_BLOCK_ENTITY.get(); } + private static BlockEntityType computerBlockEntityType() { + return COMPUTER_BLOCK_ENTITY.get(); + } + private static BlockEntityType vortexLensBlockEntityType() { return VORTEX_LENS_BLOCK_ENTITY.get(); } diff --git a/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricItems.java b/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricItems.java index 257bbe66..b3b3cb85 100644 --- a/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricItems.java +++ b/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricItems.java @@ -86,6 +86,7 @@ public final class AntarchyFabricItems { public static final DeferredItem NIGHTMARE_SCALE = ITEMS.registerSimpleItem("nightmare_scale", new Item.Properties().rarity(Rarity.RARE).fireResistant()); + public static final DeferredItem FLOPPY_DISK = ITEMS.register("floppy_disk", () -> new com.craisinlord.antarchy.content.item.FloppyDiskItem(new Item.Properties())); public static final DeferredItem MUSIC_DISC_UNDERSIDE = ITEMS.registerSimpleItem("music_disc_underside", new Item.Properties().stacksTo(1).rarity(Rarity.RARE) @@ -99,6 +100,7 @@ public final class AntarchyFabricItems { public static final DeferredItem DUPLICATOR_LOG_ITEM = ITEMS.registerSimpleBlockItem(AntarchyFabricBlocks.DUPLICATOR_LOG); + public static final DeferredItem COMPUTER_ITEM = ITEMS.registerSimpleBlockItem(AntarchyFabricBlocks.COMPUTER); public static final DeferredItem OURANWOOD_LOG_ITEM = ITEMS.registerSimpleBlockItem(AntarchyFabricBlocks.OURANWOOD_LOG); diff --git a/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricMisc.java b/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricMisc.java index db4df39b..e1b107ae 100644 --- a/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricMisc.java +++ b/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricMisc.java @@ -191,6 +191,13 @@ public final class AntarchyFabricMisc { .networkSynchronized(com.craisinlord.antarchy.content.entity.glimmer.GlimmerVariant.STREAM_CODEC) .build()); + public static final DeferredHolder, net.minecraft.core.component.DataComponentType> FLOPPY_DISK_COMPONENT = + DATA_COMPONENT_TYPES.register("floppy_disk", + () -> net.minecraft.core.component.DataComponentType.builder() + .persistent(net.minecraft.resources.ResourceLocation.CODEC) + .networkSynchronized(net.minecraft.resources.ResourceLocation.STREAM_CODEC) + .build()); + public static final DeferredHolder, net.minecraft.core.component.DataComponentType> AMERICAN = DATA_COMPONENT_TYPES.register("american", diff --git a/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyMobsConfig.java b/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyMobsConfig.java index b947b03c..33e6cce3 100644 --- a/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyMobsConfig.java +++ b/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyMobsConfig.java @@ -988,9 +988,9 @@ public final class AntarchyMobsConfig { MANTICORE_HEALTH = b.comment("Base max health.").defineInRange("health", 40.0D, 1.0D, 32768.0D); MANTICORE_ATTACK_DAMAGE = b.comment("Base attack damage for bites and stings.").defineInRange("attackDamage", 7.0D, 0.0D, 1024.0D); MANTICORE_STING_POISON_TICKS = b.comment("Poison duration in ticks applied by a Manticore sting.").defineInRange("stingPoisonTicks", 100, 0, 12000); - QUEEN_MANTICORE_CAP = b.comment("Maximum number of living Manticores a single Queen may keep summoned.").defineInRange("queenSummonCap", 15, 1, 200); - QUEEN_MANTICORE_SUMMON_COOLDOWN_TICKS = b.comment("Ticks between Queen Manticore summon attempts.").defineInRange("queenSummonCooldownTicks", 600, 20, 200000); - QUEEN_MANTICORE_SUMMON_COUNT = b.comment("Maximum Manticores created by one Queen summon attempt.").defineInRange("queenSummonCount", 3, 1, 32); + QUEEN_MANTICORE_CAP = b.comment("Maximum number of living Manticores a single Queen may keep summoned.").defineInRange("queenSummonCap", 6, 1, 200); + QUEEN_MANTICORE_SUMMON_COOLDOWN_TICKS = b.comment("Ticks between Queen Manticore summon attempts.").defineInRange("queenSummonCooldownTicks", 800, 20, 200000); + QUEEN_MANTICORE_SUMMON_COUNT = b.comment("Maximum Manticores created by one Queen summon attempt.").defineInRange("queenSummonCount", 2, 1, 32); QUEEN_MANTICORE_SUMMON_RANGE = b.comment("Maximum horizontal distance from the Queen used for Manticore spawn positions.").defineInRange("queenSummonRange", 24.0D, 4.0D, 128.0D); b.pop(); diff --git a/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyNeoforge.java b/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyNeoforge.java index d52cd92e..7410a6c5 100644 --- a/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyNeoforge.java +++ b/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyNeoforge.java @@ -473,6 +473,10 @@ public class AntarchyNeoforge { AntarchyObjects.setCookedCorndog(() -> AntarchyNeoforgeItems.COOKED_CORNDOG.get()); AntarchyObjects.setGlimmerBottle(() -> AntarchyNeoforgeItems.GLIMMER_BOTTLE.get()); AntarchyObjects.setGlimmerVariantComponent(() -> AntarchyNeoforgeMisc.GLIMMER_VARIANT.get()); + AntarchyObjects.setFloppyDiskComponent(() -> AntarchyNeoforgeMisc.FLOPPY_DISK_COMPONENT.get()); + AntarchyObjects.setFloppyDisk(() -> AntarchyNeoforgeItems.FLOPPY_DISK.get()); + AntarchyObjects.setComputer(() -> AntarchyNeoforgeBlocks.COMPUTER.get()); + AntarchyObjects.setComputerBlockEntity(() -> AntarchyNeoforgeBlocks.COMPUTER_BLOCK_ENTITY.get()); AntarchyObjects.setAmericanComponent(() -> AntarchyNeoforgeMisc.AMERICAN.get()); AntarchyObjects.setLumen(() -> AntarchyNeoforgeMisc.LUMEN.get()); AntarchyObjects.setFlowingLumen(() -> AntarchyNeoforgeMisc.FLOWING_LUMEN.get()); diff --git a/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/client/AntarchyNeoForgeClient.java b/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/client/AntarchyNeoForgeClient.java index 6f6a9f2d..c764a880 100644 --- a/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/client/AntarchyNeoForgeClient.java +++ b/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/client/AntarchyNeoForgeClient.java @@ -2,6 +2,8 @@ package com.craisinlord.antarchy.neoforge.client; import com.craisinlord.antarchy.Antarchy; import com.craisinlord.antarchy.content.client.GoopedHudRenderer; +import com.craisinlord.antarchy.content.client.AntarchyClientHooks; +import com.craisinlord.antarchy.content.client.screen.ComputerScreen; import com.craisinlord.antarchy.content.client.HordeHudRenderer; import com.craisinlord.antarchy.content.client.TigerEyeClientHooks; import com.craisinlord.antarchy.content.client.hud.BloodglassHudRenderer; @@ -99,6 +101,7 @@ public final class AntarchyNeoForgeClient { event.registerBlockEntityRenderer(AntarchyNeoforgeBlocks.CRITTER_CAGE_BLOCK_ENTITY.get(), CritterCageRenderer::new); event.registerBlockEntityRenderer(AntarchyNeoforgeBlocks.UNDERTRIAL_SPAWNER_BLOCK_ENTITY.get(), UndertrialSpawnerRenderer::new); event.registerBlockEntityRenderer(AntarchyNeoforgeBlocks.UNDERVAULT_BLOCK_ENTITY.get(), UnderVaultRenderer::new); + event.registerBlockEntityRenderer(AntarchyNeoforgeBlocks.COMPUTER_BLOCK_ENTITY.get(), ComputerRenderer::new); event.registerEntityRenderer(AntarchyNeoforgeEntites.EASTER_BUNNY.get(), context -> withParalyzedGeoLayer(new EasterBunnyRenderer(context))); event.registerEntityRenderer(AntarchyNeoforgeEntites.FLYING_SQUIRREL.get(), context -> withParalyzedGeoLayer(new FlyingSquirrelRenderer(context))); event.registerEntityRenderer(AntarchyNeoforgeEntites.CATERPILLAR.get(), context -> withParalyzedGeoLayer(new CaterpillarRenderer(context))); @@ -595,6 +598,7 @@ public final class AntarchyNeoForgeClient { @SubscribeEvent public static void onClientSetup(FMLClientSetupEvent event) { event.enqueueWork(() -> { + AntarchyClientHooks.setComputerOpener(pos -> Minecraft.getInstance().setScreen(new ComputerScreen(pos))); TigerEyeClientHooks.setCamouflageKeyTextSupplier(() -> AntarchyKeyBindings.TIGERS_EYE_CAMOUFLAGE.getTranslatedKeyMessage()); ItemBlockRenderTypes.setRenderLayer(AntarchyNeoforgeBlocks.UNDERTRIAL_SPAWNER.get(), RenderType.cutout()); ItemBlockRenderTypes.setRenderLayer(AntarchyNeoforgeBlocks.UNDERVAULT.get(), RenderType.cutout()); @@ -709,6 +713,7 @@ public final class AntarchyNeoForgeClient { @SubscribeEvent public static void registerClientReloadListeners(RegisterClientReloadListenersEvent event) { + event.registerReloadListener(com.craisinlord.antarchy.content.guide.ComputerGuideData.instance()); event.registerReloadListener(new net.minecraft.server.packs.resources.SimplePreparableReloadListener() { @Override protected Void prepare(net.minecraft.server.packs.resources.ResourceManager resourceManager, net.minecraft.util.profiling.ProfilerFiller profiler) { diff --git a/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoForgeEvents.java b/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoForgeEvents.java index 52ecfb0d..b742cb33 100644 --- a/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoForgeEvents.java +++ b/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoForgeEvents.java @@ -381,6 +381,7 @@ public final class AntarchyNeoForgeEvents { static void registerReloadListeners(AddReloadListenerEvent event) { event.addListener(new DrTrayaurusTradeManager()); + event.addListener(com.craisinlord.antarchy.content.guide.ComputerGuideData.instance()); } static void handleStartTracking(PlayerEvent.StartTracking event) { if (event.getTarget().level().isClientSide()) { diff --git a/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeBlocks.java b/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeBlocks.java index 9130ed3b..0a1101c1 100644 --- a/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeBlocks.java +++ b/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeBlocks.java @@ -6,6 +6,7 @@ import com.craisinlord.antarchy.content.AntarchyObjects; import com.craisinlord.antarchy.content.block.*; import com.craisinlord.antarchy.content.block.entity.AntNestBlockEntity; import com.craisinlord.antarchy.content.block.entity.CritterCageBlockEntity; +import com.craisinlord.antarchy.content.block.entity.ComputerBlockEntity; import com.craisinlord.antarchy.content.block.entity.DimensionalTearMarkerBlockEntity; import com.craisinlord.antarchy.content.block.entity.DreamCampfireBlockEntity; import com.craisinlord.antarchy.content.block.entity.HushweedBlockEntity; @@ -716,6 +717,8 @@ public final class AntarchyNeoforgeBlocks { () -> new com.craisinlord.antarchy.content.block.AntimetalRailBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.RAIL))); public static final DeferredBlock UPPER = BLOCKS.register("upper", () -> new UpperBlock(AntarchyNeoforgeBlocks::upperBlockEntityType, BlockBehaviour.Properties.ofFullCopy(Blocks.HOPPER))); + public static final DeferredBlock COMPUTER = BLOCKS.register("computer", + () -> new com.craisinlord.antarchy.content.block.ComputerBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).noOcclusion())); public static final DeferredBlock ANTIMETAL_POWERED_RAIL = BLOCKS.register("antimetal_powered_rail", () -> new com.craisinlord.antarchy.content.block.AntimetalPoweredRailBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.POWERED_RAIL))); public static final DeferredBlock ANTIMETAL_DETECTOR_RAIL = BLOCKS.register("antimetal_detector_rail", @@ -948,6 +951,11 @@ public final class AntarchyNeoforgeBlocks { (pos, state) -> new DimensionalTearMarkerBlockEntity(pos, state, AntarchyNeoforgeBlocks::dimensionalTearMarkerBlockEntityType), DIMENSIONAL_TEAR_MARKER.get() ).build(null)); + public static final DeferredHolder, BlockEntityType> COMPUTER_BLOCK_ENTITY = BLOCK_ENTITY_TYPES.register("computer", + () -> BlockEntityType.Builder.of( + (pos, state) -> new ComputerBlockEntity(pos, state, AntarchyNeoforgeBlocks::computerBlockEntityType), + COMPUTER.get() + ).build(null)); public static final DeferredHolder, BlockEntityType> QUEEN_TRAIL_SPAWN_MARKER_BLOCK_ENTITY = BLOCK_ENTITY_TYPES.register("queen_trail_spawn_marker", () -> BlockEntityType.Builder.of( (pos, state) -> new QueenTrailSpawnMarkerBlockEntity(pos, state, AntarchyNeoforgeBlocks::queenTrailSpawnMarkerBlockEntityType), @@ -1046,6 +1054,10 @@ public final class AntarchyNeoforgeBlocks { return UPPER_BLOCK_ENTITY.get(); } + private static BlockEntityType computerBlockEntityType() { + return COMPUTER_BLOCK_ENTITY.get(); + } + private static BlockEntityType vortexLensBlockEntityType() { return VORTEX_LENS_BLOCK_ENTITY.get(); } diff --git a/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeItems.java b/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeItems.java index 064e3775..9d12becb 100644 --- a/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeItems.java +++ b/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeItems.java @@ -92,6 +92,8 @@ public final class AntarchyNeoforgeItems { () -> Ingredient.of(AntarchyNeoforgeItems.QUEEN_SCALE.get()) ); + public static final DeferredItem FLOPPY_DISK = ITEMS.register("floppy_disk", () -> new com.craisinlord.antarchy.content.item.FloppyDiskItem(new Item.Properties())); + public static final DeferredItem NIGHTMARE_SCALE = ITEMS.registerSimpleItem("nightmare_scale", new Item.Properties().rarity(Rarity.RARE).fireResistant()); public static final DeferredItem MUSIC_DISC_UNDERSIDE = ITEMS.registerSimpleItem("music_disc_underside", @@ -204,6 +206,7 @@ public final class AntarchyNeoforgeItems { // Block items public static final DeferredItem DUPLICATOR_LOG_ITEM = ITEMS.registerSimpleBlockItem(AntarchyNeoforgeBlocks.DUPLICATOR_LOG); + public static final DeferredItem COMPUTER_ITEM = ITEMS.registerSimpleBlockItem(AntarchyNeoforgeBlocks.COMPUTER); public static final DeferredItem OURANWOOD_LOG_ITEM = ITEMS.registerSimpleBlockItem(AntarchyNeoforgeBlocks.OURANWOOD_LOG); public static final DeferredItem OURANWOOD_WOOD_ITEM = ITEMS.registerSimpleBlockItem(AntarchyNeoforgeBlocks.OURANWOOD_WOOD); public static final DeferredItem MOSSY_OURANWOOD_LOG_ITEM = ITEMS.registerSimpleBlockItem(AntarchyNeoforgeBlocks.MOSSY_OURANWOOD_LOG); diff --git a/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeMisc.java b/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeMisc.java index 66ce19ea..bcafb2f8 100644 --- a/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeMisc.java +++ b/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeMisc.java @@ -86,6 +86,12 @@ public final class AntarchyNeoforgeMisc { .persistent(com.craisinlord.antarchy.content.entity.glimmer.GlimmerVariant.CODEC) .networkSynchronized(com.craisinlord.antarchy.content.entity.glimmer.GlimmerVariant.STREAM_CODEC) .build()); + public static final DeferredHolder, net.minecraft.core.component.DataComponentType> FLOPPY_DISK_COMPONENT = + DATA_COMPONENT_TYPES.register("floppy_disk", + () -> net.minecraft.core.component.DataComponentType.builder() + .persistent(net.minecraft.resources.ResourceLocation.CODEC) + .networkSynchronized(net.minecraft.resources.ResourceLocation.STREAM_CODEC) + .build()); public static final DeferredHolder, net.minecraft.core.component.DataComponentType> AMERICAN = DATA_COMPONENT_TYPES.register("american", () -> net.minecraft.core.component.DataComponentType.builder()