Jump to content

FoxBox

Members
  • Posts

    20
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

FoxBox's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Trying to get BlockState or BlockEntity from Level force chunks to be loaded? I didn't know it, thanks.
  2. Is it normal that my BlockEntity keeps ticking even if it is on a chunk that is out of the player's view? (even if I teleport more than 10000 blocks away, the entity will continue to process ticks (at least from the server side. I also get true when calling Level#isLoadedChunk)). I'm not sure if I should look for any problems in the code until I'm convinced that this is incorrect behavior.
  3. Immersive Portals mixin fatal error, submit a crash log to the mod developer.
  4. What is the best way to handle the motion of a custom vehicle extended from Entity? At the moment, the processing on both sides (client and server with Entity$move) works best for me, however, there are small synchronization issues when movement occurs without a player-passenger. I don't think I'm using the correct way.
  5. Thanks, I figured out how to generate maps
  6. Then another question - can I generate a map pointing to a custom structure but with a vanilla icon?
  7. Is there a way to create a custom map marker for a custom structure/biome (same as a vanilla mansion)?
  8. Thanks, now I've figured it out, ConfiguredFeature and PlacedFeature have indeed been moved to the datapack files
  9. I'm trying to add features to a biome via a datapack, but for a long time I can't figure out how to register ConfiguredFeature and PlacedFeature after the last update... DifferedRegister has only FEATURES key, and the old way (as in 1.19.2) to register a PlacedFeature does not work, because the registration methods in PlacementUtils have been significantly changed and I don’t understand if it’s possible to use them at all now. How should I register ConfiguredFeature and PlacedFeature now? T_T
  10. Thanks! Also, is everything okay with my registration code? What confuses me is that I have to specify the mob category for a non-living entity. I didn't find any other way to register, only EntityType.Builder
  11. I'm trying to create an entity that extends Entity class. I can collide with it, but can't hit or interact with RMB. What is the problem? public class ReliquaryEntity extends Entity { public ReliquaryEntity(PlayMessages.SpawnEntity message, Level level) { this(LumecoreMod.Entities.RELIQUARY.get(), level); } public ReliquaryEntity(EntityType<?> type, Level level) { super(type, level); this.blocksBuilding = true; } @Override public @NotNull Packet<?> getAddEntityPacket() { return NetworkHooks.getEntitySpawningPacket(this); } @Override public void defineSynchedData() { } @Override public void readAdditionalSaveData(@NotNull CompoundTag data) { } @Override public void addAdditionalSaveData(@NotNull CompoundTag data) { } @Override public boolean canBeCollidedWith() { return true; } @Override public boolean isPushable() { return true; } @Override public @NotNull InteractionResult interact(Player player, InteractionHand hand) { System.out.println(1); this.kill(); return InteractionResult.SUCCESS; } } public static class Entities { public static final DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, MODID); public static final RegistryObject<EntityType<ReliquaryEntity>> RELIQUARY = register("reliquary", EntityType.Builder.<ReliquaryEntity>of(ReliquaryEntity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true) .setTrackingRange(64).setUpdateInterval(3).fireImmune().sized(0.6f, 1.8f)); private static <T extends Entity> RegistryObject<EntityType<T>> register(String name, EntityType.Builder<T> entityTypeBuilder) { return ENTITY_TYPES.register(name, () -> entityTypeBuilder.build(name)); } }
  12. The only unusual thing I'll do is dynamically update the contents and position of the tooltip, as the displayed information and button position may change while viewing it.
  13. @SubscribeEvent public static void onPlayerInventory(@NotNull ScreenEvent.InitScreenEvent.Post event) { if (event.getScreen() instanceof InventoryScreen inventory && event.getScreen().getMinecraft().player != null) { //ACTIONS Button.OnPress attributes = button -> event.getScreen().getMinecraft().setScreen(new ObscureBookScreen( new ObscureBookMenu(1, event.getScreen().getMinecraft().player.getInventory(), new FriendlyByteBuf(Unpooled.buffer()).writeBlockPos(new BlockPos(0,0,0)) ), event.getScreen().getMinecraft().player.getInventory(), new TextComponent("attributes"))); Button.OnPress factions = button -> event.getScreen().getMinecraft().setScreen(new ObscureBookScreen( new ObscureBookMenu(1, event.getScreen().getMinecraft().player.getInventory(), new FriendlyByteBuf(Unpooled.buffer()).writeBlockPos(new BlockPos(0,0,0)) ), event.getScreen().getMinecraft().player.getInventory(), new TextComponent("factions"))); //TOOLTIPS Button.OnTooltip tooltipStats = new Button.OnTooltip() { public void onTooltip(Button button, PoseStack pose, int mouseX, int mouseY) { List<Component> lines = new ArrayList<>(); for (String line : getStats().split(">")) lines.add(FontHelper.component(line)); pose.pushPose(); assert Minecraft.getInstance().screen != null; final float scale = Math.max(1, (float) Minecraft.getInstance().options.guiScale - (ObscureAPIConfig.Client.reduceTooltips.get() ? 1F : 0)) / (float) Minecraft.getInstance().options.guiScale; pose.scale(scale, scale, 1F); pose.translate(mouseX, mouseY, 500F); inventory.renderTooltip(pose, lines, Optional.empty(), 0, 0); pose.popPose(); } public void narrateTooltip(Consumer<Component> text) { text.accept(new TextComponent("")); } }; Button.OnTooltip tooltipFractions = new Button.OnTooltip() { public void onTooltip(@NotNull Button button, @NotNull PoseStack pose, int mouseX, int mouseY) { List<Component> lines = new ArrayList<>(); for (String line : getFactions().split(">")) lines.add(FontHelper.component(line)); pose.pushPose(); assert Minecraft.getInstance().screen != null; final float scale = Math.max(1, (float) Minecraft.getInstance().options.guiScale - (ObscureAPIConfig.Client.reduceTooltips.get() ? 1F : 0)) / (float) Minecraft.getInstance().options.guiScale; pose.translate(mouseX, mouseY, 0F); pose.scale(scale, scale, 1F); inventory.renderTooltip(pose, lines, Optional.empty(), 0, 0); pose.popPose(); } public void narrateTooltip(Consumer<Component> text) { text.accept(new TextComponent("")); } }; final int width = 20; final int height = 20; event.addListener(new ImageButton(0, 0, width, height,0, 0, 20, BUTTONS_LOCATION, 200, 200, attributes, tooltipStats, new TextComponent("")) { @Override public void renderButton(PoseStack pose, int mouseX, int mouseY, float partialTicks) { assert Minecraft.getInstance().screen != null; final int posX = Math.max(16, Math.min(Minecraft.getInstance().screen.width - 16, (inventory.getGuiLeft() - width / 2) + 162 + ObscureAPIConfig.Client.buttonsOffsetX.get())); final int posY = Math.max(16, Math.min(Minecraft.getInstance().screen.width - 16, (Minecraft.getInstance().screen.height / 2 - height / 2) - 96 + ObscureAPIConfig.Client.buttonsOffsetY.get())); this.x = posX; this.y = posY; super.renderButton(pose, mouseX, mouseY, partialTicks); } }); event.addListener(new ImageButton(0, 0, width, height,20, 0, 20, BUTTONS_LOCATION, 200, 200, factions, tooltipFractions, new TextComponent("")) { @Override public void renderButton(PoseStack pose, int mouseX, int mouseY, float partialTicks) { assert Minecraft.getInstance().screen != null; final int posX = Math.max(16, Math.min(Minecraft.getInstance().screen.width - 16, (inventory.getGuiLeft() - width / 2) + 140 + ObscureAPIConfig.Client.buttonsOffsetX.get())); final int posY = Math.max(16, Math.min(Minecraft.getInstance().screen.width - 16, (Minecraft.getInstance().screen.height / 2 - height / 2) - 96 + ObscureAPIConfig.Client.buttonsOffsetY.get())); this.x = posX; this.y = posY; super.renderButton(pose, mouseX, mouseY, partialTicks); } }); } }
  14. How exactly can I move the tooltip closer? Nothing changes when I move the PoseStack before the tooltip renders until the tooltip goes out of the camera... pose.pushPose(); pose.translate(mouseX, mouseY, 500F); inventory.renderTooltip(pose, lines, Optional.empty(), 0, 0); pose.popPose();
  15. I don't know how to make the tooltip render on top of the item durability... I subscribed to InitScreenEvent.Post and added new buttons.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.