Jump to content

Jimmeh

Members
  • Posts

    131
  • Joined

  • Last visited

Everything posted by Jimmeh

  1. 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!
  2. 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?
  3. I didn't realize Style.EMPTY.withColor() was a thing. Thanks!
  4. 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);"
  5. 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!
  6. 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!
  7. 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?
  8. 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
  9. 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".
  10. 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!
  11. 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!
  12. Update on this: I simply tried using a different task to build the jar, specifically using "reobfShadowJar" instead of "shadowJar" and it worked.
  13. I've imported: import net.minecraft.world.level.material.Material; This worked prior to me updating to 1.18.2 from 1.16.5, which is why I thought that maybe I messed up my build.gradle somehow.
  14. Hi Luis, here's the full class for the example above: public class BlockAmethystOre extends AbstractBlock implements Lootable { public BlockAmethystOre() { super(Properties.of(Material.STONE) //.harvestLevel(HarvestLevel.STONE.value()) //.harvestTool(ToolType.PICKAXE) .noDrops() .requiresCorrectToolForDrops() .strength(15f), BlockTypes.AMETHYST_ORE, null); } @Override protected @NonNull InteractionResult onRightClick(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult traceResult, boolean clientSide) { return InteractionResult.PASS; } @Override protected @NonNull InteractionResult onLeftClick(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult traceResult, boolean clientSide) { return InteractionResult.PASS; } public static final class BlockItemAmethyst extends AbstractBlockItem { private static final Item.Properties properties = new Item.Properties().tab(ModItemGroups.GROUP); public BlockItemAmethyst(AbstractBlock block) { super(block, properties); } } } That extends my own "AbstractBlock" class, which is here: public abstract class AbstractBlock extends Block { @Getter private final BlockType type; public AbstractBlock(Properties blockProperties, final @NonNull BlockType type) { super(blockProperties); this.type = type; } protected abstract @NonNull InteractionResult onRightClick(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult traceResult, boolean clientSide); protected abstract @NonNull InteractionResult onLeftClick(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult traceResult, boolean clientSide); //TODO this is deprecated. This is called from AbstractBlock.AbstractState#use. When updating, figure out what that calls @Override public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult traceResult) { return hand == InteractionHand.MAIN_HAND ? this.onLeftClick(state, world, pos, player, traceResult, world.isClientSide) : this.onRightClick(state, world, pos, player, traceResult, world.isClientSide); } } "BlockType" is also my own class. Hopefully that all makes sense. Thanks!
  15. Hi there. I have a custom block where I pass this in the constructor: super(Properties.of(Material.STONE) //.harvestLevel(HarvestLevel.STONE.value()) //.harvestTool(ToolType.PICKAXE) .noDrops() .requiresCorrectToolForDrops() .strength(15f) When I start my server, the following error is thrown: [17:41:58] [main/ERROR] [ne.mi.fm.ja.FMLModContainer/]: Exception caught during firing event: STONE Index: 1 Listeners: 0: NORMAL 1: ASM: net.minecraftforge.registries.DeferredRegister$EventDispatcher@fdd7c7d handleEvent(Lnet/minecraftforge/event/RegistryEvent$Register;)V 2: ASM: net.minecraftforge.registries.DeferredRegister$EventDispatcher@3223a6e7 handleEvent(Lnet/minecraftforge/event/RegistryEvent$Register;)V java.lang.NoSuchFieldError: STONE at TRANSFORMER/genesis@1.18.2-0.0.1/com.playarcanum.genesis.common.game.block.blocks.ore.BlockAmethystOre.<init>(BlockAmethystOre.java:27) at TRANSFORMER/forge@40.1.0/net.minecraftforge.registries.DeferredRegister.lambda$register$0(DeferredRegister.java:214) at TRANSFORMER/forge@40.1.0/net.minecraftforge.registries.DeferredRegister.addEntries(DeferredRegister.java:446) at TRANSFORMER/forge@40.1.0/net.minecraftforge.registries.DeferredRegister$EventDispatcher.handleEvent(DeferredRegister.java:376) at net.minecraftforge.eventbus.ASMEventHandler_0_EventDispatcher_handleEvent_Register.invoke(.dynamic) at MC-BOOTSTRAP/eventbus@5.0.3/net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) at MC-BOOTSTRAP/eventbus@5.0.3/net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) at MC-BOOTSTRAP/eventbus@5.0.3/net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) at LAYER PLUGIN/javafmllanguage@1.18.2-40.1.0/net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(FMLModContainer.java:106) at LAYER PLUGIN/fmlcore@1.18.2-40.1.0/net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:107) at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) at LAYER PLUGIN/fmlcore@1.18.2-40.1.0/net.minecraftforge.fml.ModWorkManager$SyncExecutor.driveOne(ModWorkManager.java:42) at LAYER PLUGIN/fmlcore@1.18.2-40.1.0/net.minecraftforge.fml.ModWorkManager$DrivenExecutor.drive(ModWorkManager.java:26) at LAYER PLUGIN/fmlcore@1.18.2-40.1.0/net.minecraftforge.fml.ModLoader.waitForTransition(ModLoader.java:201) at LAYER PLUGIN/fmlcore@1.18.2-40.1.0/net.minecraftforge.fml.ModLoader.lambda$dispatchAndHandleError$21(ModLoader.java:186) at java.base/java.util.Optional.ifPresent(Optional.java:178) at LAYER PLUGIN/fmlcore@1.18.2-40.1.0/net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:186) at LAYER PLUGIN/fmlcore@1.18.2-40.1.0/net.minecraftforge.fml.ModLoader.lambda$gatherAndInitializeMods$11(ModLoader.java:163) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at LAYER PLUGIN/fmlcore@1.18.2-40.1.0/net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:163) at TRANSFORMER/forge@40.1.0/net.minecraftforge.server.loading.ServerModLoader.load(ServerModLoader.java:32) at TRANSFORMER/minecraft@1.18.2/net.minecraft.server.Main.main(Main.java:112) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at MC-BOOTSTRAP/fmlloader@1.18.2-40.1.0/net.minecraftforge.fml.loading.targets.CommonServerLaunchHandler.lambda$launchService$0(CommonServerLaunchHandler.java:32) at MC-BOOTSTRAP/cpw.mods.modlauncher@9.1.3/cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) at MC-BOOTSTRAP/cpw.mods.modlauncher@9.1.3/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) at MC-BOOTSTRAP/cpw.mods.modlauncher@9.1.3/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) at MC-BOOTSTRAP/cpw.mods.modlauncher@9.1.3/cpw.mods.modlauncher.Launcher.run(Launcher.java:106) at MC-BOOTSTRAP/cpw.mods.modlauncher@9.1.3/cpw.mods.modlauncher.Launcher.main(Launcher.java:77) at MC-BOOTSTRAP/cpw.mods.modlauncher@9.1.3/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) at MC-BOOTSTRAP/cpw.mods.modlauncher@9.1.3/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) at cpw.mods.bootstraplauncher@1.0.0/cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:149) The strange this is that `Material.STONE` very much exists. So that leaves me to guess that maybe it has something to do with Parchment mappings or my build.gradle, although I'm not entirely sure. Here's the build.gradle: buildscript { repositories { // These repositories are only for Gradle plugins, put any other repositories in the repository block further below maven { url = 'https://maven.minecraftforge.net' } maven { url = 'https://maven.parchmentmc.org' } maven { url = 'https://repo.spongepowered.org/repository/maven-public/' } mavenCentral() } dependencies { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT' classpath 'org.parchmentmc:librarian:1.+' } } plugins { id 'com.github.johnrengelman.shadow' version '6.0.0' id 'maven-publish' } apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.parchmentmc.librarian.forgegradle' apply plugin: 'org.spongepowered.mixin' apply plugin: 'com.github.johnrengelman.shadow' group = "com.playarcanum" version = "0.0.1" archivesBaseName = "genesis" java { toolchain.languageVersion = JavaLanguageVersion.of(17) } tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' } minecraft { mappings channel: 'parchment', version: '2022.08.02-1.18.2' runs { client { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. property 'forge.enabledGameTestNamespaces', 'genesis' mods { genesis { source sourceSets.main } } } server { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' property 'forge.enabledGameTestNamespaces', 'genesis' mods { genesis { source sourceSets.main } } } gameTestServer { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' property 'forge.enabledGameTestNamespaces', 'genesis' mods { genesis { source sourceSets.main } } } data { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' args '--mod', 'genesis', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') mods { genesis { source sourceSets.main } } } } } mixin { add sourceSets.main, "genesis.refmap.json" config "genesis.mixins.json" } sourceSets.main.resources { srcDir 'src/generated/resources' } repositories { maven { url 'https://jitpack.io' } } configurations { shade } ext { } dependencies { minecraft "net.minecraftforge:forge:1.18.2-40.1.0" // deobfProvided "mezz.jei:jei_${mc_version}:${jei_version}:api" // runtime "mezz.jei:jei_${mc_version}:${jei_version}" // compile "org.apache.httpcomponents:fluent-hc:${httpclient_version}" } // Example for how to get properties into the manifest for reading at runtime. jar { manifest { attributes([ "Specification-Title" : "genesis", //"Specification-Vendor": "test authors", "Specification-Version" : "1", // We are version 1 of ourselves "Implementation-Title" : project.name, "Implementation-Version" : project.jar.archiveVersion, //"Implementation-Vendor": "test authors", "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") ]) } } shadowJar { archiveName("${mod_name}-${mc_version}-${mod_version}.jar") classifier = '' configurations = [project.configurations.shade] } reobf { shadowJar{} } tasks.build.dependsOn reobfShadowJar jar.finalizedBy('reobfShadowJar') Any help is greatly appreciated! Thank you!
  16. Hey there, I'm trying to create a Quaternion like so: Vector3f.YP.rotationDegrees(180.f) This is happening server-side, on start up. It's throwing the error: Caused by: java.lang.NoSuchMethodError: 'net.minecraft.util.math.vector.Quaternion net.minecraft.util.math.vector.Vector3f.func_229187_a_(float)' Even though Quaternion has the constructor in question: public Quaternion(Vector3f pVector, float pAngle, boolean pDegrees) of which, Vector3f.YP.rotationDegrees(180.f) uses. So I'm quite confused as to why this might be happening. What I'm using this in is included both client and server-side, yet server-side is the only one throwing this error. By that, it led me to think Quaternions might only be client-side, but I'm unsure if that's correct. Thanks!
  17. Question with this. If I make a WornItemLayer extends LayerRenderer, I implement the following render method: @Override public void render(MatrixStack pMatrixStack, IRenderTypeBuffer pBuffer, int pPackedLight, Entity pLivingEntity, float pLimbSwing, float pLimbSwingAmount, float pPartialTicks, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) { if(this.equipped == null) return; //Get the player's facing direction //Reverse that to know the direction the location offset will be for positioning //Rotate the item 135 degrees final float rotation = this.minecraft.player.yBodyRot; } I don't think this will work for multiplayer, as in, it won't render other players' equipped items on my screen, since I'm getting the local player from Minecraft. Can you think of a way so that this may be applied to all players? Perhaps some sort of loop through viewable players each render() call?
  18. Hi there. I'm wanting to create 'slots' that exist on the player's back and hip so that they may equip a weapon in either. So if I equip an item on my back slot, it should then render in game on my back. I'm trying to think about how to do this. I see there's an Minecraft.getInstance().getItemRenderer() with multiple different render() methods, most of which I think are GUI related. I do see it has this: render(ItemStack pItemStack, ItemCameraTransforms.TransformType pTransformType, boolean pLeftHand, MatrixStack pMatrixStack, IRenderTypeBuffer pBuffer, int pCombinedLight, int pCombinedOverlay, IBakedModel pModel) which might be want I should use. Although, I'm unsure how to get/create an IRenderTypeBuffer. I found this outdated mod that did exactly what I'm looking to do, where he has the item being represented by a BipedModel. Is this the same approach that should be taken in 1.16.5? I'm not sure if it's possible, but I'd like to avoid the rendered items as being entities (I'm not sure if that even makes sense, to be honest), ideally for performance (in my head, if I had 100 players in an area, there'd be 200 entities by default since each could have a rendered weapon on their back or hip. If this is the only solution, I could make a culling system of sorts). Here's what I'm wanting to essentially accomplish: Thanks for any input! Edit: I've found the HeldItemLayer class which, I believe, renders held items. I'm thinking I can create my own LayerRenderer that's essentially mimicking this but at a different place on the player.
  19. I don't know why I didn't think of doing that. Thank you, it's fixed!
  20. I appreciate the help and recommendation @matthew123. Thanks! So trying it like you described, it's not doing an infinite amount of translations, which is nice. But it is still just translating instead of scaling. Any further ideas? https://gyazo.com/f63f8b98f48c53e0ce28e946657031bb pMatrixStack.pushPose(); pMatrixStack.scale(1.2f, 1.2f, 1.2f); minecraft.font.draw(pMatrixStack, new StringTextComponent("Amethyst Crystal"), x, y, HexColors.WHITE ); pMatrixStack.popPose();
×
×
  • Create New...

Important Information

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