- Increasing the World Height
-
Increasing the World Height
Hi there! I'm trying to increase the normal overworld max height. I'm not sure how to go about this without using reflection to change this in DimensionType: protected static final DimensionType DEFAULT_OVERWORLD = create(OptionalLong.empty(), true, false, false, true, 1.0D, false, false, true, false, true, -64, 384, 384, BlockTags.INFINIBURN_OVERWORLD, OVERWORLD_EFFECTS, 0.0F); Would that be the recommended way to accomplish this? Or is there some data file in the world folder that I should change? Any help is appreciated!
-
Creating a Command with an Argument
That makes sense. I appreciate it!
-
Creating a Command with an Argument
Thank you!
-
Creating a Command with an Argument
Hi there! I've surprisingly found very little resources on Google/YouTube for this. I'm trying to make a custom command: /speed #. I'm doing the following: public SpeedCommand(final CommandDispatcher<CommandSourceStack> dispatcher) { dispatcher.register(Commands.literal("speed") .then(Commands.argument("amount", IntegerArgumentType.integer())) .requires(source -> { /*try { return ServerLifecycleHooks.getCurrentServer().getPlayerList().isOp(source.getPlayerOrException().getGameProfile()); } catch (CommandSyntaxException e) { e.printStackTrace(); return false; }*/ return source.hasPermission(3); }) .executes(command -> { final ServerPlayer player = command.getSource().getPlayerOrException(); player.flyingSpeed = MathTools.clamp(IntegerArgumentType.getInteger(command, "amount"), 1, 4); return 1; }) ); } In game, when typing "/speed", it shows the suggestion for me to include the "amount" argument. However, when I do include it, "/speed 1", it says that it's an unknown or incomplete command. Any ideas?
-
[Solved] How to Create my own Style Instances
I didn't realize Style.EMPTY.withColor() was a thing. Thanks!
-
[Solved] How to Create my own Style Instances
Hi there. I'm trying to create my own Style instances so I can apply custom colors those to MutableComponents. For instance, lets say I have public static final int RED_ORANGE = FastColor.ARGB32.color(255, 247, 69, 37); And I wanted to apply this custom color to a MutableComponent with MutableComponent#withStyle. I notice the Style constructor isn't public, so I'm doing some reflection like so: final Constructor<Style> constructor = Style.class.getDeclaredConstructor(TextColor.class, Boolean.class, Boolean.class, Boolean.class, Boolean.class, Boolean.class, ClickEvent.class, HoverEvent.class, String.class, ResourceLocation.class ); final Style style = constructor.newInstance(TextColor.fromRgb(color.color()), false, false, false, false, false, null, null, null, null ); This, however, doesn't work. Is there a way to create custom Styles? Thanks! Edit: I needed to "constructor.setAccessible(true);"
-
PlayerLoggedIn Event is Firing Twice for Each Player
Turns out there was some unexpected behavior in my dependency injection library, so in a roundabout way, it was getting registered twice. Thanks for your reply!
-
PlayerLoggedIn Event is Firing Twice for Each Player
I've noticed a weird bit of behavior happening with the PlayerLoggedIn event in 1.18.2. I have some the following test code to debug this issue: MinecraftForge.EVENT_BUS.addListener(EventPriority.NORMAL, false, PlayerEvent.PlayerLoggedInEvent.class, this::test); ... public void test(final PlayerEvent.PlayerLoggedInEvent event) { System.out.println("-------------------------------"); System.out.println("Logged in event"); System.out.println("-------------------------------"); } The output in console when I log into my server is: ---------------------------- Logged in event ---------------------------- ---------------------------- Logged in event ---------------------------- Any help is appreciated. Thanks!
-
[Solved] Drawing a Texture on the Screen (as a Screen, not a HUD)
Perfect, this worked. Thank you!
-
[Solved] Drawing a Texture on the Screen (as a Screen, not a HUD)
Since that is a non-static method, should I be extending ForgeIngameGui for my AbstractScreen class instead of extending the Forge Screen class? What I'm drawing to the screen is a custom inventory texture, so it needs child widgets such as buttons and items to click. Based on what I see in the ForgeIngameGui and the Gui classes, ForgeIngameGui seems more for HUD overlays. Is that correct and I should stay with the Screen class?
-
[Solved] Drawing a Texture on the Screen (as a Screen, not a HUD)
When I blit this to the screen, I'm doing it like so: minecraft.textureManager.bindForSetup(new ResourceLocation(Genesis.MOD_ID, "textures/gui/inventory.png")); ... poseStack.pushPose(); Gui.blit(pMatrixStack, pos.x(), pos.y(), 0, start.x(), start.y(), dimensions.x(), dimensions.y(), textureSize.y(), textureSize.x()); poseStack.popPose(); However, the result is this instead of my texture: https://gyazo.com/5628b1b1013d37e3f0fa8a476800856d
-
[Solved] Drawing a Texture on the Screen (as a Screen, not a HUD)
I should've specified. I used ResourceLocation#toDebugFileName which does: public String toDebugFileName() { return this.toString().replace('/', '_').replace(':', '_'); } So if just do the normal ResourceLocation#toString, the output is: "genesis:textures/gui/inventory.png".
-
[Solved] Drawing a Texture on the Screen (as a Screen, not a HUD)
Hi there. This used to work in 1.16.5, but now it's not working. I'm creating a ResourceLocation like so: new ResourceLocation(Genesis.MOD_ID, "textures/gui/" + texture); where my mod ID is "genesis" and "texture" is "inventory.png". When debugging this, the ResourceLocation outputs "genesis_textures_gui_inventory.png", so I'm not too sure where I'm going wrong here. My resources folder can be found here (I tried attaching it, but it didn't like the Gyazo link): https://gyazo.com/089c354ee737f31d892c72335eddb024 It doesn't seem to be finding "inventory.png" correctly. Did the use of ResourceLocation change in-between these versions? Thanks!
-
Renderer is Null During EntityRendererEvent.AddLayers
Ahoy. I'm trying to register a custom render layer during the proper event, like so: Adding the event as a listener: final IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); modEventBus.addListener(EventPriority.LOWEST, this::registerRenderLayers); public void registerRenderLayers(final EntityRenderersEvent.AddLayers event) { final LivingEntityRenderer<Player, PlayerModel<Player>> playerRenderer = event.getRenderer(EntityType.PLAYER); playerRenderer.addLayer(new WornItemLayer<>(playerRenderer)); } An error is being thrown saying that "playerRenderer" is null. I'm not too sure what I'm doing wrong here, as I imagine that if the event is firing, the renderer shouldn't be null. Thanks!
IPS spam blocked by CleanTalk.