Jump to content

Search the Community

Showing results for tags 'tutorial'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Minecraft Forge
    • Releases
    • Support & Bug Reports
    • Suggestions
    • General Discussion
  • Mod Developer Central
    • Modder Support
    • User Submitted Tutorials
  • Non-Forge
    • Site News (non-forge)
    • Minecraft General
    • Off-topic
  • Forge Mods
    • Mods

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


XMPP/GTalk


Gender


URL


Location


ICQ


AIM


Yahoo IM


MSN Messenger


Personal Text

Found 9 results

  1. I am creating a mod on forge 1.20.1 that makes Minecraft more wintery. I want to make it so that it always snows but I can't find how weather works in Minecraft. My plan was to check if it is raining, and if it is not in a biome that doesn't rain anyway, it instead snows. The fake code below is the logic I was thinking of. public class Weather { static void ontheground() { // look at the block, starting from the build limit going down untill the block is not air } if(raining == true) { if(biome != biometype.savana | biometype.desert) { particle.render(snow) place(Blocks.SNOW, ontheground, (x, y+1)) } } }
  2. I created a custom effect called "Fullness" that prevents the player from losing hunger when they get the effect. For this, I created a new java class called FullnessEffect. Everything is working fine, and the player isn't able to lose hunger, but I wanted to make it so that whenever you have the Fullness effect, your hunger bar changes color to gold, similar to how your hunger bar turns sickly green when you have the hunger effect. I searched online, but there seems to be no information regarding how to do this. Does anyone know how to do this? Here is the code for the FullnessEffect class in case anyone needs it (the import section is omitted): public class FullnessEffect extends MobEffect { public FullnessEffect (MobEffectCategory mobEffectCategory, int color) { super(mobEffectCategory, color); } @Override public boolean applyEffectTick (LivingEntity pLivingEntity, int pAmplifier) { if (!pLivingEntity.getCommandSenderWorld().isClientSide() && pLivingEntity instanceof Player player) { FoodData foodData = player.getFoodData(); float exhaustionLevel = foodData.getExhaustionLevel(); if (exhaustionLevel > 0.0F) { player.causeFoodExhaustion(-exhaustionLevel); } } super.applyEffectTick(pLivingEntity, pAmplifier); return true; } @Override public boolean shouldApplyEffectTickThisTick(int duration, int amplifier) { return true; } } I may sound a bit stupid because I'm a bit new to modding but any help would be greatly appreciated
  3. 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.
  4. Like the title i wanted to render a obj model into minecraft but i cant find any tutorials for this.
  5. This is a guide explaining how to get logs on various launchers. If there is a launcher you want to see added reply in the comments. Once you have logs you can either upload them as an attachment if they are in the form of a file, or if its in clipboard format you can put on a paste website. Vanilla Launcher (Official one provided by Mojang) Minecraft Server MinecraftForge Installer ModLists Note: We are not officially affiliated with any of the 3rd party launchers, we cannot fix their errors and cannot attest for differences or problems in them and are going from personal experience. CurseForge Launcher TLauncher MultiMC (and derivatives) GDLauncher Coming soon: ATLauncher
  6. package com.example.examplemod.entity.renderer import com.example.examplemod.ExampleMod; import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.model.Model; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.HumanoidMobRenderer; import net.minecraft.client.renderer.entity.MobRenderer; import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer; import net.minecraft.client.renderer.entity.layers.ItemInHandLayer; import net.minecraft.resources.ResourceLocation; public class ExampleEntityRenderer<Type extends ExampleEntity> extends HumanoidMobRenderer<Type, ExampleEntityModel<Type>> { private static final ResourceLocation TEXTURE = new ResourceLocation(ExampleMod.MOD_ID, "textures/entity/example/exampleentity.png"); public ExampleEntityRenderer(EntityRendererProvider.Context context) { super(context, new ExampleEntityModel<>(context.bakeLayer(ExampleEntityModel.LAYER_LOCATION)), 0.6f); this.addLayer(new ItemInHandLayer<>(this)); this.addLayer(new HumanoidArmorLayer<>(this, new HumanoidModel(context.bakeLayer(ModelLayers.PLAYER_INNER_ARMOR)), new HumanoidModel(context.bakeLayer(ModelLayers.PLAYER_OUTER_ARMOR)))); } @Override public ResourceLocation getTextureLocation(Type entity) { return TEXTURE; } } If your entity model extends the humanoid model and has the appropriate methods and items in its equipment slots, it will hopefully render them
×
×
  • Create New...

Important Information

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