Jump to content

The Typholorian

Members
  • Posts

    59
  • Joined

  • Last visited

Everything posted by The Typholorian

  1. mcp reborn https://github.com/Hexeption/MCP-Reborn follow instructions in readme.md
  2. make some example gui in mcreator with a button and some text, then open it up with the code editor to see how to do it.
  3. _level.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), "execute at @e[type=cod] run summon lightning_bolt"); should do it, I don't think it'll send a chat message every time. Code thing wasn't working so I had to do plain text.
  4. _level.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), "execute at @e[type=cod] run summon lightning_bolt"); should do it, I don't think it'll send a chat message every time. Code thing wasn't working so I had to do plain text.
  5. Broke teeth? Hah. I already see that MuchedHard is misspelled. You could try looking at the MC source code to see how they add death messages, or maybe MCreatir could help. It's not good for directly making mods, but it has a bunch of examples on how to do stuff.
  6. That seems like it's not properly overriding the texture, check the code for the arrow and see if you are doing everything right. Just ctrl click on Arrow from extends Arrow and it should show you it. Or you could get it via mcp reborn at https://github.com/Hexeption/MCP-Reborn
  7. That seems completely fine, and there are no meaningful errors or any indication of bad stuff, as far as I can tell. Can you give me some more information about what you are trying to do? Try stripping the mod down to just a renamed MDK and see if it runs.
  8. hello. me again. This time I want to modify the game, but not with forge or fabric or quilt or something like that. I want to make a .jar, similar to Forge/Fabric/OptiFine (installer, not the forge mod) that copies 1.19.2 and modifies the game to add stuff like menus and blocks. I tried ChatGPT but it can't help since it doesn't understand the Minecraft EULA, and I tried doing some research but there is no documentation on this. Help?
  9. So, if you look in the minecraft resource files, things like leaves and grass blocks are grey. This is because, I assume, they get color based on the biome. Is there a way I can get the texture of the grass block from the side in a plains biome? No, I can't just take a screenshot. I need the 16x16 square texture with no light changing the texture. Is there some way I can get that easily?
  10. Seems like an optifine issue. Do you have it installed? If you do, try removing it.
  11. hi. me again. This time, I have my custom crop I am working on all 100% done and working... except the model is not loading. I can tell it is the model and not the texture since it looks like a vanilla block and the texture not loaded texture is on all 6 sides. If the model was loading, I think it would look like the crop model with those textures. I don't think I have any spelling errors, but last time I said that it was the whole problem. I don't know how to upload folders to github, so if that is necessary please let me know how. Here's my code. Block Registry (has custom block class in it): resources/assets/pnegative/models/block/blueberry_bush.json: resources/assets/pnegative/models/block/blueberry_bush_stage0-7.json (identical for all eight, named as above: The only difference is the texture name. Textures in resources/assets/pnegative/textures/block. Named as above, ending in .png. Are there any issues? If you need to re-create it, I am using forge 43.2.21. java/net/the_typholorian/pnegative/PNegative.class: Thank you.
  12. That was it. Thank you!
  13. so I want to make a custom crop. I followed the tutorials and such, and now I have a thing that grows and such. But when I try to add a loot table, it doesn't do anything. No errors at all. I check that all the directories and such are correct, did it the same as MCreator generates it. Works fine there, dunno why not here. Loot table code: { "type": "minecraft:block", "functions": [ { "function": "minecraft:explosion_decay" } ], "pools": [ { "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", "name": "minecraft:cabbage" } ], "rolls": 1.0 }, { "bonus_rolls": 0.0, "conditions": [ { "block": "minecraft:cabbage_crop", "condition": "minecraft:block_state_property", "properties": { "age": "7" } } ], "entries": [ { "type": "minecraft:item", "functions": [ { "enchantment": "minecraft:fortune", "formula": "minecraft:binomial_with_bonus_count", "function": "minecraft:apply_bonus", "parameters": { "extra": 3, "probability": 0.5714286 } } ], "name": "minecraft:cabbage" } ], "rolls": 1.0 } ] } Block registry code: package net.the_typholorian.pnegative.adventure; import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.CropBlock; import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Material; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; import net.the_typholorian.pnegative.PNegative; public class Blocks { public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, PNegative.MODID); public static final RegistryObject<Block> CABBAGE_CROP = BLOCKS.register("cabbage_crop", () -> new CabbageCropBlock(BlockBehaviour.Properties.of(Material.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.CROP))); public static void register(IEventBus eventBus) { BLOCKS.register(eventBus); } } class CabbageCropBlock extends CropBlock { private static final VoxelShape[] SHAPE_BY_AGE = new VoxelShape[]{ Block.box(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D), Block.box(0.0D, 0.0D, 0.0D, 16.0D, 4.0D, 16.0D), Block.box(0.0D, 0.0D, 0.0D, 16.0D, 6.0D, 16.0D), Block.box(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D), Block.box(0.0D, 0.0D, 0.0D, 16.0D, 10.0D, 16.0D), Block.box(0.0D, 0.0D, 0.0D, 16.0D, 12.0D, 16.0D), Block.box(0.0D, 0.0D, 0.0D, 16.0D, 14.0D, 16.0D), Block.box(0.0D, 0.0D, 0.0D, 16.0D, 16.0D, 16.0D) }; public CabbageCropBlock(Properties properties) { super(properties); } @Override public BlockState getPlant(BlockGetter level, BlockPos pos) { return Blocks.CABBAGE_CROP.get().defaultBlockState(); } @Override protected ItemLike getBaseSeedId() { return Items.CABBAGE.get(); } @Override public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { return SHAPE_BY_AGE[state.getValue(this.getAgeProperty())]; } } Do I need to register that it is using a loot table somewhere?
  14. Well, it seems like Apotheosis does something similar, conditionally registering blocks/items if a config value is true. The problem I am having is that the server config is not being generated while in the IDE. If I export the mod and generate a world, it shows up fine. Is there maybe some setting or some code I am missing to make it generate in the IDE, so I don't have to export for testing?
  15. I am using it like this: if (ENABLE_BUILDING_TOOLS_MODULE.get()) { net.the_typholorian.pnegative.building_tools.Items.register(modEventBus); } inside my main mod class file. I want it to register the items if the config enables them. I tried with passing true/false, and it worked as I wanted it to. I can't figure out how to add folders to a github, is a .zip okay?
  16. If you are using 0.5.1, you no longer need flywheel. Throw it out the window and it might work. Also try updating/downgrading supplementaries.
  17. Yeah. I added public static final ForgeConfigSpec.ConfigValue<Boolean> ENABLE_BUILDING_TOOLS_MODULE; and ENABLE_BUILDING_TOOLS_MODULE = BUILDER.define("Building Tools Module", true); into the config file, and using ENABLE_BUILDING_TOOLS_MODULE.get() to get the variable. Working when I remove that part, but it doesn't do what I want with the variable.
  18. I got Caused by: java.lang.IllegalStateException: Cannot get config value before config is loaded.
  19. So, do I need to create the file? What do I do to fix it?
  20. so I'm tryna make a server config for my mod. I have it renamed and all, but it only generates when I export the mod and run it. Here's my config code: ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, ServerConfig.SPEC, "pnegative-server-config.toml"); in the main mod file, import net.minecraftforge.common.ForgeConfigSpec; class ServerConfig { public static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder(); public static final ForgeConfigSpec SPEC; static { BUILDER.push("Project Negative Config"); BUILDER.pop(); SPEC = BUILDER.build(); } } in config file. I am looking for the config file in run/saves/worldname/serverconfig. Only seeing forge-server.toml. Help? It doesn't crash, just doesn't work as it's supposed to.
  21. You can find very helpful guides here and here on how to create a config, but I want to make a tutorial so here. 1.) Create the config file in your mod. Not the .toml, the .java in src/main/java/com/yourname/modid. Put it wherever in that directory you like, just name it something like ClientConfig. Inside, copy-paste: Replace "Example Mod Client Configs" in BUILDER.push("Example Mod Client Configs" to whatever you want to be at the top of the .toml file. That will set up your config, but now we have to register it. In your main mod file (usually named modid.java), inside public ModID() put Here is where you will actually rename stuff. If you want a config other than client, replace CLIENT in ModConfig.Type.CLIENT with COMMON or SERVER, whichever one you want. I will explain those at the end, just copy the code for now. You will also have to rename ClientConfig in ClientConfig.SPEC to whatever your config.java is called. Then, the final argument is "modid-client-config.toml", just replace that with what you want it to be named. Make sure to put your modid in there, so you can find it easier in modpacks. That's great and all, but how do we actually add a variable to our config? Go back to your config file, and add after You probably have some errors, but we're not done. In static, after add Rename EXAMPLE_INTEGER to whatever you wrote before. The .comment() adds a comment when generated since the mod doesn't come with the .toml file pre-made. The .define() will be the name of the variable, and the 0 at the end is the default value. There are things like range, but I can't figure it out so you'll have to check link one or google it. If you haven't modified anything yet, the file should look like this: That's great and all, but how do we actually use it in our code? Well, you can use for getting the value, or to return a true/false. If you want to have modules similar to Apotheosis or Quark, then that is as simple as wrapping the registers in an if connected to a server client config boolean. That would look like this: in your modid.java file. This assumes that modEventBus is declared like If you want to create seperate module files, then you have to make it public and static. Also, move it to the public class instead of the public inside the public class. That shouldn't break anything, or at least it didn't in my mod. Quick Note: This may have an issue regarding the modules, but if I put false in the IF loop it disables the items. The issue seems to be in the getting of the value, and the server config is not being generated when running in the MDK. Outside it works fine, but setting the config to false and re-running does not get rid of the items. If anybody knows how I can fix this, please let me know. Now here's the part of the tutorial where I said I would explain more about config and variable types. There are three types of configs; Client, Common, and Server. Client is usually reserved for things like textures and image sizes, as they only show up on client-side. Examples for client-side mods are Journeymap, Appleskin, and JEI (mostly, the button to move items to crafting table only works when server-side is installed). Common is on both sides, client and server. Server is per-world, and act pretty much like gamerules. You can probably get away with only using Integers, Booleans, and Strings as your variable types. If you want more information about variable types, check link one. I have stuff to do and this tutorial is already super long.
  22. Update: I restarted the game and it was working, but when I closed the menu and re-opened it it crashed with error message Caused by: java.net.UnknownHostException: sessionserver.mojang.com.
  23. Caused by: java.lang.NullPointerException: Cannot read field "level" because "this.minecraft" is null This is my first big error when coding. I looked it up, but there are a bunch of references to Dawncraft and not enough to figure out what was going wrong. I found this, but it involves a command and my GUI only opens when you shift + right-click while holding an item. They fixed it by not calling it with a command, but I am not using a command. Here's the render of my menu, which is the only part that changed between it working and not: @Override public void render(@Nonnull PoseStack mstack, int mouseX, int mouseY, float partialTicks) { int midx = this.width / 2; int midy = this.height / 2; this.renderBackground(mstack); drawCenteredString(mstack, font, I18n.get("config.shape_tool"), midx, 4, 0xC3D1D8); Utils.renderImage(midx - 12, midy, 20, 20, "textures/gui/plus.png", mstack); addRenderableWidget(new Button(midx - 12, midy, 10, 10, Component.translatable(""), this::increaseax)); Utils.renderImage(midx + 12, midy, 20, 20, "textures/gui/minus.png", mstack); addRenderableWidget(new Button(midx + 12, midy, 10, 10, Component.translatable(""), this::decreaseax)); drawCenteredString(mstack, font, String.valueOf(shapetoolax), midx, midy + 10, 0xC3D1D8); super.render(mstack, mouseX, mouseY, partialTicks); } Utils.renderImage is this: public static void renderImage(int x, int y, int width, int height, String img, PoseStack mstack) { RenderSystem.setShaderColor(1, 1, 1, 1); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); RenderSystem.setShaderTexture(0, new ResourceLocation(PNegative.MODID, img)); blit(mstack, x, y, 0, 0, width, height, width, height); RenderSystem.disableBlend(); } I have used it before and it has worked, so it can't be a problem.
  24. How can I create a slider for my GUI?
×
×
  • Create New...

Important Information

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