Everything posted by squidlex
-
[1.15.2] How to remove a widget
When I load the creative menu, I add a widget using: event.addWidget(); in public void onScreenInit(GuiScreenEvent.InitGuiEvent.Post event) { } I now want to remove the widget via a method that I can use at any time whilt the menu is open. How would I go about doing this? In my init method I can simply use event.removeWidget() but I want to be able to do this in a seperate method. Thanks for your help!
-
Is it possible to only add an item to a tag if it has specific NBT data?
Thanks for confirming that for me
-
Is it possible to only add an item to a tag if it has specific NBT data?
Say for example I wanted to add only my own player skull to a tag and not every player skull (I'm guessing it isn't but figured it was worth asking) Thanks for your help!
-
[1.15.2] Adding vanilla items with NBT data to a new Creative Tab
Thank you! I got it working
-
[1.15.2] Adding vanilla items with NBT data to a new Creative Tab
So I now have the Creative Tab down, but how do I add NBT data to an ItemStack? At the moment I'm messing with ItemStack.write() but I don't know if that's correct or how to properly format NBT within it.
-
[1.15.2] Adding vanilla items with NBT data to a new Creative Tab
Thank you both for you replies! Would you be able to explain why this won't show up? It worked with modded items but not when using the override method. public class ModItemGroup extends ItemGroup { public ModItemGroup(int index, String label) { super(index, label); } @Override public ItemStack createIcon() { return new ItemStack(Items.DRAGON_EGG); } @Override public void fill(NonNullList<ItemStack> items) { items.add(new ItemStack(Items.DRAGON_EGG)); } } I fixed it, it was an error with me hardcoding an index like an idiot. Thanks for all your help!
-
[1.15.2] Adding vanilla items with NBT data to a new Creative Tab
Hi there, I'm trying to add existing vanilla items to a new Creative Tab. I've already created my tab, but I don't know how to add vanilla items, let alone with NBT data stored in them. Say for example I want to add a chest with NBT data to a new tab. Any help would be greatly appreciated!
-
[1.14.4] bin\main has mods that were not found error
Sorry I forgot to include it! MyMod.java @Mod(MyMod.MODID) public class MyMod { public static final String NAME = "MyMod"; public static final String MODID = "mymod"; public static ResourceLocation locate(String name) { return new ResourceLocation(MODID, name); } public static String find(String name) { return MODID + ":" + name; } public MyMod() { ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, ConfigHandler.CLIENT_SPEC); ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, ConfigHandler.COMMON_SPEC); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onCommonSetup); MinecraftForge.EVENT_BUS.register(this); DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> { MinecraftForge.EVENT_BUS.register(new ModEvents()); MinecraftForge.EVENT_BUS.register(new ModGui()); FMLJavaModLoadingContext.get().getModEventBus().addListener(ModClient::clientInit); }); } @OnlyIn(Dist.CLIENT) public static class ModClient { @OnlyIn(Dist.CLIENT) public static net.minecraft.client.settings.KeyBinding DODGE_KEY = new net.minecraft.client.settings.KeyBinding( "dodge.key.dodge", GLFW.GLFW_KEY_LEFT_ALT, "key.categories.movement"); @SubscribeEvent public static void clientInit(FMLClientSetupEvent event) { DodgeKeyRegistry dodgeKeyRegistry = new DodgeKeyRegistry(); MinecraftForge.EVENT_BUS.register(dodgeKeyRegistry); dodgeKeyRegistry.register(DODGE_KEY); } } private void onCommonSetup(FMLCommonSetupEvent event) { PacketHandler.init(); } // Send the server Common config to the client @SubscribeEvent public void onPlayerJoinWorld(EntityJoinWorldEvent event) { if(event.getEntity() instanceof PlayerEntity && !event.getWorld().isRemote) { PacketHandler.instance.send(PacketDistributor.ALL.noArg() , new CommonConfigMessage( // DOUBLES ConfigHandler.dodgePower, // INTS ConfigHandler.hungerRequirement, ConfigHandler.cooldownLength, // BOOLEANS ConfigHandler.allowDodgeWhileAirborne, ConfigHandler.enableCooldown, ConfigHandler.displayParticles, ConfigHandler.fancyParticles )); } } }
-
[1.14.4] bin\main has mods that were not found error
For some reason I'm getting this error whenever I use runClient in my IDE. It also launches minecraft twice. Here's my mods.toml modLoader="javafml" #mandatory loaderVersion="[28,)" [[mods]] #mandatory modId="mymod" version="1.14.4-1.4.2" displayName="My Mod" #mandatory credits="Squidlex" authors="Squidlex" description=''' For all your squid needs. ''' # A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. [[dependencies.mymod]] #optional # the modid of the dependency modId="forge" #mandatory # Does this dependency have to exist - if not, ordering below must be specified mandatory=true #mandatory # The version range of the dependency versionRange="[28,)" #mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory ordering="NONE" # Side this dependency is applied on - BOTH, CLIENT or SERVER side="BOTH" # Here's another dependency [[dependencies.mymod]] modId="minecraft" mandatory=true versionRange="[1.14.4]" ordering="NONE" side="BOTH" And my build.gradle buildscript { repositories { maven { url = 'https://files.minecraftforge.net/maven' } jcenter() mavenCentral() } dependencies { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true } } apply plugin: 'net.minecraftforge.gradle' // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. apply plugin: 'eclipse' apply plugin: 'maven-publish' version = '1.14.4-1.4.2' group = 'com.squidlex.mymod' // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = 'mymod' sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. minecraft { // The mappings can be changed at any time, and must be in the following format. // snapshot_YYYYMMDD Snapshot are built nightly. // stable_# Stables are built at the discretion of the MCP team. // Use non-default mappings at your own risk. they may not always work. // Simply re-run your setup task after changing the mappings to update your workspace. mappings channel: 'snapshot', version: '20190719-1.14.3' // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Default run configurations. // These can be tweaked, removed, or duplicated as needed. runs { client { workingDirectory project.file('run') // Recommended logging data for a userdev environment property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' // Recommended logging level for the console property 'forge.logging.console.level', 'debug' mods { examplemod { source sourceSets.main } } } server { workingDirectory project.file('run') // Recommended logging data for a userdev environment property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' // Recommended logging level for the console property 'forge.logging.console.level', 'debug' mods { examplemod { source sourceSets.main } } } data { workingDirectory project.file('run') // Recommended logging data for a userdev environment property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' // Recommended logging level for the console property 'forge.logging.console.level', 'debug' args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/') mods { examplemod { source sourceSets.main } } } } } dependencies { // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied. // The userdev artifact is a special name and will get all sorts of transformations applied to it. minecraft 'net.minecraftforge:forge:1.14.4-28.2.17' // You may put jars on which you depend on in ./libs or you may define them like so.. // compile "some.group:artifact:version:classifier" // compile "some.group:artifact:version" // Real examples // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env // compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env // The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. // provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' // These dependencies get remapped to your current MCP mappings // deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev' // For more info... // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html // http://www.gradle.org/docs/current/userguide/dependency_management.html } // Example for how to get properties into the manifest for reading by the runtime.. jar { manifest { attributes([ "Specification-Title": "examplemod", "Specification-Vendor": "examplemodsareus", "Specification-Version": "1", // We are version 1 of ourselves "Implementation-Title": project.name, "Implementation-Version": "${version}", "Implementation-Vendor" :"examplemodsareus", "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") ]) } } // Example configuration to allow publishing using the maven-publish task // we define a custom artifact that is sourced from the reobfJar output task // and then declare that to be published // Note you'll need to add a repository here def reobfFile = file("$buildDir/reobfJar/output.jar") def reobfArtifact = artifacts.add('default', reobfFile) { type 'jar' builtBy 'reobfJar' } publishing { publications { mavenJava(MavenPublication) { artifact reobfArtifact } } repositories { maven { url "file:///${project.projectDir}/mcmodsrepo" } } } Thank you so much for the help!
-
Help with backporting my mod to 1.14.4
Hi there, I'm trying to backport my 1.15.2 mod to 1.14.4 but I don't know what to replace these with: Minecraft.getInstance().getMainWindow().getScaledHeight() and Player.getPosX() Any help as to what these used to be called would be really helpful! Edit: I've figured out getPosX() but I still don't know what to do about getting the window.
-
[1.15.2] How to inject into a loot-table?
Thanks for the explanation!
-
[1.15.2] How to inject into a loot-table?
Thank you for your reply, how would I use this to inject into an existing chest loot table?
-
[1.15.2] How to inject into a loot-table?
Hi there, I'm currently trying to inject an item into a loot table, so far my injection code is as follows: @SubscribeEvent public static void onLootLoad(LootTableLoadEvent event) { if (event.getName().equals(new ResourceLocation("minecraft", "underwater_ruin_small"))) { event.getTable().addPool(LootPool.builder().addEntry(TableLootEntry.builder(new ResourceLocation(MyMod.MODID, "underwater_ruin_small"))).build()); } } And my json file looks like this: { "pools": [ { "name": "main", "rolls": 1, "entries":[ { "type": "item", "weight": 5, "name": "mymod:myitem" }, { "type": "item", "weight": 75, "name": "minecraft:compass" } ] } ] } When I access the vanilla loot table using /setblock ~ ~ ~ chest{LootTable:"minecraft:chests/underwater_ruin_small"} My items are never in it. Any help would be greatly appreciated!
-
I Opened forge using the wrong thing
right click open with More apps Program Files Java your java version bin then choose your java file You should end up in program files\java\java version\bin At least that's where my java is installed, if not you may have to look for it
-
[1.15.2] Access another mod's Block without having to import it
Thanks for your reply My issue is that I don't have the Mod present in my working directory, would that still work? If not do you know of any way to just get my Data Generator to set the key to a given ID? Sorry if that's a dumb question.
-
[1.15.2] Access another mod's Block without having to import it
Hi there! I'm messing around with Data Generators and I want one of my recipes to use a block from another mod. I already have a check to make sure the mod is installed, but I don't know how to actually get the mod's item. I know I can change it in the JSONs but I want to do it directly from my code. I'm using ShapedReciperBuilder.key() which requires an implementation of IItemProvider. I read about a 'getBlockById' method somewhere but this has either been renamed or removed in later versions. Any help with this would be greatly appreciated!
-
[1.15.2] src/generated/resources is not being read by my code
I tried that earlier and deleted everything by accident, I now make constant backups haha. Thanks for the suggestion though, it works if you use '--existing' but I wanted my things to be seperate Ugdhar's method may be cleaner for some users so it's worth noting if you're reading this in the future!
-
[1.15.2] src/generated/resources is not being read by my code
I got it to work! I needed to add this: sourceSets { main { resources { srcDirs += "src/generated/resources" } } } to my build.gradle. Honestly don't know how I missed that.
-
[1.15.2] src/generated/resources is not being read by my code
Hi there, So I've been tinkering with Data Generators today and have managed to get my recipes to generate into src/generated/resources like I wanted, but the issue is the recipes don't work unless I move them into src/main/resources. How do I make it so that my generated folder is recognised by forge? Thanks for your help!
-
[1.15.2] [Solved] What are the pros of Data Generators and should I be using them?
You're also really great help, thank you so much for all you do on these forums That's really helpful thank you, I've managed to get one up and running now following the link you sent and I can see why they're useful, I'd definitely recommend trying it out. Have a great day!
-
[1.15.2] [Solved] What are the pros of Data Generators and should I be using them?
I've been looking at a lot of Data Generators for recipes and other things in mods' source code and was wondering if they are worth using. If so, does anyone know how to set one up? Thanks for your time!
-
[1.15.2] How to add a shortened hyperlink to the chat
Thank you
-
[1.15.2] How to only enable an item to be crafted under certain conditions
Thank you!
-
[1.15.2] How to only enable an item to be crafted under certain conditions
Thank you for your reply! Do you know of any good example source code of this?
-
[1.15.2] How to only enable an item to be crafted under certain conditions
I only want an item to be crafted under a certain condition, for example if another mod is present. Does anyone know a good way of going about doing this? At the moment I'm using json files for my recipes and I think I may have to move away from there for this, but I'm unsure how. Thanks for your help!
IPS spam blocked by CleanTalk.