-
Posts
20 -
Joined
-
Last visited
Posts posted by FoxBox
-
-
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.
-
23 minutes ago, Fluffs said:
I'm not sure if this is the correct place to ask but recently we started up a server in aternos using the new paying/credit system and we added mods and it seems to keep crashing, I'm not very good at reading errors and seeing which mod is causing the error
Thank you in advance for anybody who stops by and reads<3
Here are the logs:
https://mclo.gs/W99Rk18Immersive Portals mixin fatal error, submit a crash log to the mod developer.
-
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.
-
4 hours ago, ChampionAsh5357 said:
Sure, that's how the treasure maps for buried treasure work. Take a look at the shipwreck_map loot table or the TreasureMapForEmeralds villager trade for an example on how to create them.
Thanks, I figured out how to generate maps
-
2 hours ago, ChampionAsh5357 said:
Currently no, MapDecoration$Type is a non-extended enum. You could attempt to make a PR for it, but that would require a lot of work since the value is essentially hardcoded into a specific texture with only bytes to represent some amount of data.
Then another question - can I generate a map pointing to a custom structure but with a vanilla icon?
-
Is there a way to create a custom map marker for a custom structure/biome (same as a vanilla mansion)?
-
On 12/9/2022 at 10:48 PM, warjort said:
Can't say I understand the new way of doing the builtin registries in 1.19.3. 🙂
But you can always register your features using json files in your src/main/resources/data
That's probably the way most likely to be portable across versions?
Although, Mojang still describe the new worldgen first introduced in 1.16 as "experimental".
The only part that needs to be registered manually is the Feature, because that is code.
e.g. vanilla iron ore's configured and placed feature as json
https://github.com/misode/mcmeta/blob/data/data/minecraft/worldgen/configured_feature/ore_iron.json
Thanks, now I've figured it out, ConfiguredFeature and PlacedFeature have indeed been moved to the datapack files
-
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
-
9 hours ago, warjort said:
Entity.isPickable() controls whether a ray trace can target your entity.
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
-
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)); } }
-
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.
-
44 minutes ago, warjort said:
You need to show what you are actually doing.
I already guessed (wrongly) once on this thread that you were doing custom rendering.
I shouldn't have to guess.
From that small snippet of code out of context it looks like you are calling Screen's renderTooltip() which should do it for you.
There is something else you are doing wrong.
@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); } }); } }
-
49 minutes ago, warjort said:
GUI screens are actually 3d in minecraft. The z direction is the distance out of the screen.
Look at how the class Screen handles tool tips by both translating the z co-ord of the PoseStack and changing ItemRenderer.blitOffset which controls the same thing for the drawing items.
Note how it uses +400 in renderTooltipInternal() and +200 in ItemRender.renderGuiItemDecorations() - the latter being things like the damage bar.
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();
-
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.
-
Vanilla minecraft code is obfuscated (encoded). After obfuscation, variables lose their names. What you see after decoding is just the variable ID.
-
I tried to do it like this, but with shaders the animations are 2x faster..
private static long LAST_TIME = 0;
public static float DELTA_TIME = 0;@SubscribeEvent
public static void onRenderTick(TickEvent.RenderTickEvent event) {
if (event.phase == TickEvent.Phase.START) {
final long time = Util.getNanos();
DELTA_TIME = (time - LAST_TIME) / 16666666F;
LAST_TIME = time;
}
} -
Is it possible to add custom calculation of the usual Delta Time, which will work fine both with and without shaders?
-
How to get DeltaTime variable? I tried to take one from the Minecraft instance and multiply by 3 (because the default is not 60 but 20 fps). This works, except that with shaders the variable becomes several times larger and the animations become too fast.
-
What class handles the minecraft/font/default.json file?
1.19 Block Entity Ticking Range
in Modder Support
Posted
Trying to get BlockState or BlockEntity from Level force chunks to be loaded? I didn't know it, thanks.