Search the Community
Showing results for tags 'porting'.
-
I'm trying to migrate my mod from 1.20 to 1.21. Some packages in the forge api were changed so my mod did have some classes not working. I've changed everything i needed but still is getting me the following error error: cannot access Registry DeferredRegister.create(ForgeRegistries.BLOCKS, FarmMod.MOD_ID); ^ class file for net.minecraft.core.Registry not found The piece of code that is wrong is public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, FarmMod.MOD_ID); And here are my imports import com.lucas.farmmod.FarmMod; import com.lucas.farmmod.block.custom.BaseIrrigatorBlock; import com.lucas.farmmod.item.ModItems; import com.lucas.farmmod.item.custom.BaseIrrigatorBlockItem; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; The class DeferredRegister is throwing the error in the print below I've tried running rebuilding my project in every way possible, tried refreshing my dependencies but nothing works. What can i do?
-
I am currently trying to port a mod from 1.12.2 to 1.20.4, and I have found the guide on how to do so, but there doesn't seem to be a way to port directly from 1.12.2 to 1.20.4, and It seems tedious to go through and port one version to the next. I only need to port one file, not the entire mod, so I don't need to rewrite the structures of the entire mod from the ground up. The only thing that really needs to be changed are the imports, if there are functionally equivalent ones in 1.20.4. Is there any shorter guide, or a set of mappings I can use?
-
When I create a new world, after having configured the new biome using Citadel's ExpandedBiomes, it is not generated. I have decided to take the map code from Alex Caves, just for testing purposes, then I will delete it. This map can't find it either. But, in locate the biome appears, even if it cannot be found and when generating a world with a single biome, I can choose the biome and it "generates" it. I don't know where I could have made a mistake. Github repository Any help is welcome. Thank you all in advance, for helping or taking the time to read.
-
So I was told that "only one string" needed to change for this 1.8.9 mod to become a 1.16.5 mod. Im not very sure what this line is as I am new to this coding thing, so I thought I might ask around. Thanks in advance. Here is pt.1 of the code: package studio.dreamys.gui; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import java.awt.Color; import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.util.Session; import org.apache.commons.io.IOUtils; import org.lwjgl.input.Keyboard; import studio.dreamys.TokenAuth; public class SessionGui extends GuiScreen { private GuiScreen previousScreen; private String status = "Session:"; private GuiTextField sessionField; private ScaledResolution sr; public SessionGui(GuiScreen previousScreen) { this.previousScreen = previousScreen; } public void func_73866_w_() { Keyboard.enableRepeatEvents(true); this.sr = new ScaledResolution(this.field_146297_k); this.sessionField = new GuiTextField(1, this.field_146297_k.field_71466_p, this.sr.func_78326_a() / 2 - 100, this.sr.func_78328_b() / 2, 200, 20); this.sessionField.func_146203_f(32767); this.sessionField.func_146195_b(true); this.field_146292_n.add(new GuiButton(998, this.sr.func_78326_a() / 2 - 100, this.sr.func_78328_b() / 2 + 30, 200, 20, "Login")); this.field_146292_n.add(new GuiButton(999, this.sr.func_78326_a() / 2 - 100, this.sr.func_78328_b() / 2 + 60, 200, 20, "Restore")); super.func_73866_w_(); } public void func_146281_b() { Keyboard.enableRepeatEvents(false); super.func_146281_b(); } public void func_73863_a(int mouseX, int mouseY, float partialTicks) { this.func_146276_q_(); this.field_146297_k.field_71466_p.func_78276_b(this.status, this.sr.func_78326_a() / 2 - this.field_146297_k.field_71466_p.func_78256_a(this.status) / 2, this.sr.func_78328_b() / 2 - 30, Color.WHITE.getRGB()); this.sessionField.func_146194_f(); super.func_73863_a(mouseX, mouseY, partialTicks); } protected void func_146284_a(GuiButton button) throws IOException { if (button.field_146127_k == 998) { try { String session = this.sessionField.func_146179_b(); String username; String uuid; String token; if (session.contains(":")) { username = session.split(":")[0]; uuid = session.split(":")[1]; token = session.split(":")[2]; } else { HttpURLConnection c = (HttpURLConnection)(new URL("https://api.minecraftservices.com/minecraft/profile/")).openConnection(); c.setRequestProperty("Content-type", "application/json"); c.setRequestProperty("Authorization", "Bearer " + this.sessionField.func_146179_b()); c.setDoOutput(true); JsonObject json = (new JsonParser()).parse(IOUtils.toString(c.getInputStream())).getAsJsonObject(); username = json.get("name").getAsString(); uuid = json.get("id").getAsString(); token = session; } this.field_146297_k.field_71449_j = new Session(username, uuid, token, "mojang"); this.field_146297_k.func_147108_a(this.previousScreen); } catch (Exception var9) { this.status = "§cError: Couldn't set session (check mc logs)"; var9.printStackTrace(); } } if (button.field_146127_k == 999) { try { this.field_146297_k.field_71449_j = TokenAuth.originalSession; this.field_146297_k.func_147108_a(this.previousScreen); } catch (Exception var8) { this.status = "§cError: Couldn't restore session (check mc logs)"; var8.printStackTrace(); } } super.func_146284_a(button); } protected void func_73869_a(char typedChar, int keyCode) throws IOException { this.sessionField.func_146201_a(typedChar, keyCode); if (1 == keyCode) { this.field_146297_k.func_147108_a(this.previousScreen); } else { super.func_73869_a(typedChar, keyCode); } } } and heres pt.2 : package studio.dreamys; import java.awt.Color; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiMultiplayer; import net.minecraft.util.Session; import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import studio.dreamys.gui.SessionGui; @Mod( modid = "ta", name = "TokenAuth", version = "1.1.0" ) public class TokenAuth { public static Minecraft mc = Minecraft.func_71410_x(); public static Session originalSession; public TokenAuth() { } @EventHandler public void preInit(FMLPreInitializationEvent e) { MinecraftForge.EVENT_BUS.register(this); } @SubscribeEvent public void onInitGuiPost(GuiScreenEvent.InitGuiEvent.Post e) { if (e.gui instanceof GuiMultiplayer) { e.buttonList.add(new GuiButton(999, 5, 5, 100, 20, "TokenAuth")); } } @SubscribeEvent public void onDrawScreenPost(GuiScreenEvent.DrawScreenEvent.Post e) { if (e.gui instanceof GuiMultiplayer) { String status = String.format("User: §a%s §rUUID: §a%s", mc.field_71449_j.func_111285_a(), mc.field_71449_j.func_148255_b()); Minecraft.func_71410_x().field_71466_p.func_78276_b(status, 115, 10, Color.WHITE.getRGB()); } } @SubscribeEvent public void onActionPerformedPre(GuiScreenEvent.ActionPerformedEvent.Pre e) { if (e.gui instanceof GuiMultiplayer && e.button.field_146127_k == 999) { Minecraft.func_71410_x().func_147108_a(new SessionGui(e.gui)); } } static { originalSession = mc.field_71449_j; } }
-
I've been working on updating a mod that is somewhat abandoned, and I just need to fix some issues related to the ":compileJava" task, which has been giving me errors. I was wondering if someone could help me since, assuming that it's an old version mod, the coding in that area might be different. I would appreciate any help in fixing it. I'll be waiting.
-
Topic for making tags
-
- 1.10.2
- 1.11.2
-
(and 81 more)
Tagged with:
- 1.10.2
- 1.11.2
- 1.12.2
- 1.13.2
- 1.14.4
- 1.15.2
- 1.16.5
- 1.17.1
- 1.18.2
- 1.19.0
- 1.19.1
- 1.19.2
- 1.19.3
- 1.19.4
- 1.2.5
- 1.20.0
- 1.3.2
- 1.4.7
- 1.5.2
- 1.6.4
- 1.7.10
- 1.8.9
- 1.9.4
- armour
- bad jvm args
- biomes
- blocks
- broken mod
- bug
- capabilities
- client
- client-only mods on server
- codecs
- commands
- dimensions
- effects
- enchantments
- entities
- events
- feature request
- fluids
- food
- gradle
- groovy
- guis
- ide
- installer
- items
- java
- kotlin
- launcher
- libraries
- loot
- metadata
- missing jar association
- missing java
- missing mods
- mixin
- needs more info
- networking
- news
- optifine
- ores
- out of memory
- outdated drivers
- particles
- performance
- porting
- potions
- recipes
- registries
- rendering
- scala
- server
- solved
- sounds
- textures
- tools
- tutorial
- weapons
- worldgen
- wrong java version
- wrong mod version
-
Hi all, I've been updating my mod from 1.18 to 1.19 and so far I've been able to fix the changes regarding literal/translatable Components and other minor changes, but the Button class' constructor seems to have changed, and I don't know how to update it. Here is my working constructor for 1.18: public BuySellButton(int x, int y, String buyText, String sellText, boolean isBuy, OnPress listener) { super(x, y, 50, 12, new TextComponent((isBuy ? buyText : sellText)), listener); this.isBuy = isBuy; } Simply changing the component does not work: public BuySellButton(int x, int y, String buyText, String sellText, boolean isBuy, OnPress listener) { super(x, y, 50, 12, Component.literal((isBuy ? buyText : sellText)), listener); this.isBuy = isBuy; } Cannot resolve method 'super(int, int, int, int, MutableComponent, OnPress)' Here are the available constructors/builders from the Button class: public static Button.Builder builder(Component p_254439_, Button.OnPress p_254567_) { return new Button.Builder(p_254439_, p_254567_); } protected Button(int p_259075_, int p_259271_, int p_260232_, int p_260028_, Component p_259351_, Button.OnPress p_260152_, Button.CreateNarration p_259552_) { super(p_259075_, p_259271_, p_260232_, p_260028_, p_259351_); this.onPress = p_260152_; this.createNarration = p_259552_; } protected Button(Builder builder) { this(builder.x, builder.y, builder.width, builder.height, builder.message, builder.onPress, builder.createNarration); setTooltip(builder.tooltip); // Forge: Make use of the Builder tooltip } Can someone please help me understand how to update my Button constructor?