Jump to content

Recommended Posts

Posted

Hey there,

 

I'm having some problems with a mod I'm working on. I want to rewrite the WorldGenDesertWells class so they become useful (seriously, they are pretty useless as they are now). As I finished and made the whole re-compile-obfuscate-blah procedure I recognized and remembered that it's impossible due to the new 1.6 update to replace base class files. Now I'm having a bit of a problem: I read a lot about ClassTransformers and stuff, but it didn't fit my imagination.

 

So my question is: is there any way to replace a whole vanilla class? The "new" class contains a new field, a (quiet huge) method and some changes in the generate() method. I do not own the original class file, because I've already edited it. Does anyone have an idea on how to do this? I am very close to release this mod and this is my last hurdle. I don't want to start the whole project all over again.

 

Greets from Germany

~ sep87x

Posted

possible but hard..

 

anyways wouldn't it be easier to replace every reference to that class with one to your own class. That at least sounds like less work if it's not called all over the place which it sounds like it ain't ?

  Quote

If you guys dont get it.. then well ya.. try harder...

Posted

Okay, I removed a lot of code from the WorldGenDesertWells class and moved it into the main mod class. How should I progress further?

Posted

well I suggested moving it to it's own class. Since you where about to req. a few hundred byte code manipulations to change the whole class I figured you knew your java.

 

In any case it sounds quite extreme to do it like that, are you sure there aren't better ways to do the generation?

 

Also the base class thing not getting edited is possible to override for a mod if ya want to, but as always base class edited will possibly make your mod incompatible with other mods.

  Quote

If you guys dont get it.. then well ya.. try harder...

Posted
  On 7/17/2013 at 10:45 AM, Mazetar said:

In any case it sounds quite extreme to do it like that, are you sure there aren't better ways to do the generation?

 

My current plan was to make the "custom" generation only one method in the main class to call, but diesieben07 had the better idea.

 

  Quote

How I would do it: Disable the vanilla WorldGenDesertWell by removing the override BiomeGenDesert.decorate via ASM (should be quite easy). That will stop the generation and then just generate a new type of well.

 

Thanks for that. Is there already an interface for that in Forge? I know I have to read something about ASM, but I already know a byte about it.

Posted

Okay, so I read through the whole thing and made the following: I set up a IClassTransformer which locates the decorate()-function inside the BiomeGenDesert class. With some byte code stuff I attempted to remove these lines:

 

            WorldGenDesertWells worldgendesertwells = new WorldGenDesertWells();
            worldgendesertwells.generate(par1World, par2Random, k, par1World.getHeightValue(k, l) + 1, l);

 

(Small amount of code, I hope it is okay to post it directly here)

 

... and make it to this:

 

            new FakeWorldGenDesertWells().generate(par1World, par2Random, k, par1World.getHeightValue(k, l) + 1, l);

 

I wrote it out and retrieved the byte code. My class transformer looks like this now: http://gw.minecraftforge.net/Ybvi

 

Before compiling, I have some questions left. Where do I need to register the class transformer and the FMLLoadingPlugin (onInit() should be clear, but which class is needed)? There are some other classes with the decorate()-method in it as I looked inside conf/methods. At the code it is now, should it be clear which method I want? I think "a" is a bit short ... even for a recompiled source.

Posted

I'm sorry but I'm a bit confused now. I don't have an idea about coremods, so I need to ask. The DesertGenFMLLoadingPlugin (http://gw.minecraftforge.net/RBEG) class is the main class of the core mod. I've already "linked" the ClassTransformer in it. Do I need to add the name of the "original" mod in the method getModContainerClass(), so ModDesertWells.class.getName()? What does the manifest file look like? And I tried to add the argument (in program arguments) "fml.coreMods.load net.sep87x.desertwells.DesertGenFMLLoadingPlugin", but it didn't work. Am I doing something wrong?

Posted

As far as I understood: I have two "main" classes now, the ModDesertWells class (\w @Mod annotation) and the DesertGenFMLLoadingPlugin (implements IFMLLoadingPlugin). Is it possible to "merge" both files? I mean if I can use the implementation in my ModDesertWells class? And ...

 

  On 7/17/2013 at 4:02 PM, sep87x said:

I tried to add the argument (in program arguments) "fml.coreMods.load net.sep87x.desertwells.DesertGenFMLLoadingPlugin", but it didn't work. Am I doing something wrong?

 

I am very sorry to ask so much. I'm new to coremods. Alternatively a link about coremods would be MUCH more appreciated. I couldn't find a page where coremods are being described.

Posted

The link you found above is more or less the only collection of info on coremods besides the source code :P

You can replace the ModDessertWells with the FMMLLoadingplugin class totally if you'd like, or use both as two seperate mods if you wish.

 

 

  Quote

If you guys dont get it.. then well ya.. try harder...

Posted

I still don't get it. There must be something wrong when running MC. I removed the class with the @Mod annotation, moved anything to a ModContainer, and put the path into the gteModContainerClass() method of the FMLLoadingPlugin class. There must be something wrong with the running settings. I added the argument and added an environment variable.

 

uiEqWA8.png

 

dC1cG04.png

 

I just don't get it. What am I doing wrong?

Posted

Argh, me stupid ::)

 

I added it to the vm args. Well, it recognizes the mod as a coremod, BUT there is another hurdle that popped up suddenly. There's a ClassNotFound exception in the package cpw.mods.fml.common.asm.FMLSanityChecker. See the full stack trace here: http://gw.minecraftforge.net/uPpv Is this normal?

 

My nerves are done for today. I guess I should wait for the next morning to come. Thanks to anyone who has helped me so far.

 

P.S. The class exists in the package explorer.

 

y8LTHgn.png

Posted

Even with those two ideas it won't work. I'll just make a backup of my work, delete ANYTHING and create a new, fresh workspace.

Posted

java.lang.RuntimeException: java.lang.ClassNotFoundException: cpw.mods.fml.common.asm.FMLSanityChecker

 

Finally. I am not entirely sure, but I guess I found the source of the ClassNotFound error. As I read through the stack trace and searched for the path inside the jar, I couldn't find the common directory, the repackage and the server directory inside cpw/mods/fml. Might that be the source of the error? And what would be a way to fix this?

Posted

I've gotten some ASM stuff to work, not replacing a whole class though. What I would assume you do is this:

(just pseudocode)

for the transformer, the transform method will be called for *I think* every class

byte[] transform(String name, byte[] bytes)
{
if (name == obfuscated name || name == deobfuscatedname)
{
   byte[] newClass = getYourClassBytes();
   return newClass;
}
}

The transform method kinda just goes through everything, see if you want to make changes, then asks for the modified or unmodified bytes back. You might be getting class not found because you aren't returning the bytes of the class.

Posted
  On 7/18/2013 at 6:32 PM, sep87x said:

I've already dealt with that. The code should work as it is now (see here: http://gw.minecraftforge.net/hr4y). It returns the bytes correctly (of the target class), or am I missing something?

Are you trying to re-write a method, or the whole class? I see a bit of both in there.

Posted
  On 7/18/2013 at 6:58 PM, sep87x said:

I'm rewriting the decorate() method in the BiomeGenDesert class ... so a method.

Try this, it replaces 2 method bodies, and I've used it to modify a few things. Just copy the method declaration and then write your own body in a new class.

public byte[] patch (String name, byte[] bytes, String desc, String iFile, String rname) throws IOException
{
	ClassNode cn = new ClassNode();
	ClassReader cr = new ClassReader(bytes);
	//the class node is now visiting the bytes that the class reader has
	cr.accept(cn,0);
	//giving us something we can look at all the methods
	Iterator<MethodNode> methods = cn.methods.iterator();
	//creating the method node we are going to mess with
	MethodNode mn = null;
	while (methods.hasNext())
	{
		MethodNode m = methods.next();
		if (m.name.equals(name) && m.desc.equals(desc))
		{
			System.out.printf("Found a method we want to transform%n");
			mn = m;
			break;
		}
	}
	//get the file we're going to replace a method with
	java.io.InputStream in = DHNTransformer.class.getResourceAsStream(iFile);
	byte[] newbyte = IOUtils.toByteArray(in);
	//get the method
	ClassNode cnr = new ClassNode();
	ClassReader crr = new ClassReader(newbyte);
	crr.accept(cnr,0);
	//find the right one
	Iterator<MethodNode> repalcemethods = cnr.methods.iterator();
	MethodNode mnr = null;
	while (repalcemethods.hasNext())
	{
		MethodNode m = repalcemethods.next();
		if (m.name.equals(rname))
		{
			System.out.printf("Found the right method that is going to be the replacement");
			mnr = m;
			break;
		}
	}
	//now we start changing the bodies
	mn.instructions = mnr.instructions;
	ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
	//let the writer visit the class now
	cn.accept(cw);

	return cw.toByteArray();

}

And how to use it:

if (arg0.equals("bhg")) {
		System.out.println("Doing RenderPlayer transformers in a obfuscated environment");
		newimport("",arg2);
		try {
			return patch("a", arg2, "(Lue;)V","/DHNCore/asm/Methods.class","renderFirstPersonArm");
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
if (arg0.equals("net.minecraft.client.renderer.entity.RenderPlayer")) {
		System.out.println("Doing RenderPlayer transformers in a de-obfuscated environment");
		//make sure we import the class so that it does crash
		newimport("",arg2);
		try {
			return patch("renderFirstPersonArm", arg2, "(Lnet/minecraft/entity/player/EntityPlayer;)V","/DHNCore/asm/Methods.class","renderFirstPersonArm");
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		}

Posted

Its there. I forgot to mention that this won't let you use methods with 'this' ex: this.doSomething() I don't know if thats a problem for you.

Posted

So, last question: the Methods.class in your patch method ... does it contain a method it should be replaced with?

 

P.S. While skimming the transformer class I found the error in the code ... well ... nobody was born perfect.

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Well, as usual, it was user error. Naming mismatch in sounds.json.  Please delete this post if you find it necessary. 
    • Use the exclusive "acw696499" Temu coupon code to unlock the best discounts available in 2025. This code is especially beneficial for savvy shoppers in the USA, Canada, and across European nations. If you're an existing customer, this is your chance to cash in on massive savings. With our Temu coupon code 2025 for existing customers and Temu 70% discount coupon, there's never been a better time to shop. What Is The Temu Coupon Code 70% Off? At Temu, both new and returning customers are rewarded generously. With our Temu coupon 70% off and 70% off Temu coupon code, you can enjoy steep discounts whether you're shopping for the first time or coming back for more. acw696499 – Use this to get up to 70% off for new users. acw696499 – Apply it for a flat 70% discount for existing users. acw696499 – Unlock a $100 discount for new Temu users. acw696499 – Redeem a $100 coupon pack usable across multiple orders. acw696499 – Claim an extra $100 off promo code valid in the USA, Canada, and European nations. Temu Coupon Code 70% Off For New Users If you're new to Temu, you’re in for a treat. Our Temu coupon 70% off is your one-way pass to the best value for your first order. The Temu coupon code 70 off for existing users also holds great perks for loyal customers who haven't redeemed this offer yet. Here’s how new users can benefit from our code: acw696499 – Get a flat 70% discount right off the bat. acw696499 – Unlock a $100 coupon bundle exclusively for new customers. acw696499 – Redeem up to $100 in coupons across multiple transactions. acw696499 – Enjoy free shipping to 68 countries globally. acw696499 – Grab an extra 40% off your first purchase. How To Redeem The Temu 70% Off Coupon Code For New Customers? Using the Temu 70% off and Temu 70 off coupon code is easy. Just follow these steps: Download the Temu app or visit the official website. Create a new account or sign in. Add your favorite products to the cart. Proceed to checkout. Enter the coupon code acw696499 in the promo section. Hit "Apply" and enjoy your 70% discount. Temu Coupon Code 70% Off For Existing Users Existing users, don’t feel left out! With our exclusive Temu 70 off coupon code, you too can enjoy incredible savings. Our Temu coupon code for existing customers ensures you get the value you deserve for sticking with Temu. Check out these benefits: acw696499 – Enjoy a generous 70% discount on your next purchase. acw696499 – Unlock a $100 coupon bundle for multiple shopping sessions. acw696499 – Get a free gift with express shipping across the USA and Canada. acw696499 – Score an extra 30% off even on discounted items. acw696499 – Benefit from free shipping to 68 countries worldwide. How To Use The Temu Coupon Code 70% Off For Existing Customers? To use the Temu coupon code 70 off and Temu discount code for existing users, follow this quick guide: Open the Temu app or log in to the website. Log into your existing Temu account. Select your desired items and go to the cart. Enter the coupon code acw696499 in the promo box. Click "Apply" and see the savings roll in. How To Find The Temu Coupon Code 70% Off? You can easily find the Temu coupon code 70% off first order and latest Temu coupons 70 off through various platforms. Sign up for the Temu newsletter to get insider deals directly to your inbox. Follow Temu on their official social media accounts for flash deals and coupon drops. For verified and tested promo codes, make sure to visit trusted coupon websites like ours regularly. How Temu 70% Off Coupons Work? The Temu coupon code 70% off first time user and Temu coupon code 70 percent off work by applying the discount directly to your cart during checkout. All you need to do is enter the coupon code, and Temu automatically adjusts your total amount. These promo codes are valid for both app and website users. Whether you're shopping from the USA, Canada, or Europe, the discount applies as long as the code is valid and the items are eligible. No tricky terms, just straightforward savings. How To Earn 70% Off Coupons In Temu As A New Customer? To earn the Temu coupon code 70% off and Temu 70 off coupon code first order, simply sign up on Temu as a new customer. After registration, you’ll receive access to a welcome bonus pack, including exclusive discounts. You can also participate in Temu’s referral program to get even more discount codes. Keep your eyes on seasonal campaigns or app notifications, which often contain limited-time coupon opportunities. What Are The Advantages Of Using Temu 70% Off Coupons? The benefits of using our Temu 70% off coupon code legit and coupon code for Temu 70 off are truly impressive: 70% discount on your first order. $100 coupon bundle usable for multiple purchases. 70% discount on popular items across various categories. 70% off for existing Temu customers. Up to 70% off selected items. Free gift for new users. Free delivery to 68 countries. Temu Free Gift And Special Discount For New And Existing Users When you apply the Temu 70% off coupon code or 70% off Temu coupon code, you open the door to exclusive rewards and gifts. acw696499 – Get 70% discount on your first order. acw696499 – Enjoy an extra 30% off on any item. acw696499 – Claim a free gift exclusively for new Temu users. acw696499 – Score up to 70% discount on any item available in the Temu app. acw696499 – Get a free gift with free shipping to 68 countries including the USA and UK. Pros And Cons Of Using Temu Coupon Code 70% Off Here are some pros and cons of using the Temu coupon 70% off code and Temu free coupon code 70 off: Pros: Massive 70% discount on a wide range of items. Easy to apply and redeem. Works for both new and existing users. Includes free gifts and shipping. Valid across 68 countries. Cons: Can’t be combined with some other promotions. Limited to select items and categories. May have limited-time availability. Terms And Conditions Of The Temu 70% Off Coupon Code In 2025 Make sure to understand these terms when using our Temu coupon code 70% off free shipping and Temu coupon code 70% off reddit: The coupon code doesn’t have any expiration date. Valid for both new and existing users. Usable in 68 countries including the USA, Canada, and European regions. No minimum purchase required. Cannot be combined with some other limited-time offers. Must be entered manually at checkout to apply. Final Note Don’t miss out on this golden opportunity to save with our Temu coupon code 70% off. Whether you're a new shopper or a loyal Temu fan, the savings are too good to pass up. We hope this guide helps you take full advantage of the Temu 70% off coupon. Start shopping smart and enjoy unbeatable discounts today! FAQs Of Temu 70% Off Coupon  What is the best Temu coupon code for 2025? The best code we recommend is "acw696499," which gives users up to 70% off, a $100 coupon pack, and free gifts for both new and existing users.  Can existing users use the Temu 70% off coupon? Yes, existing users can use the "acw696499" coupon to get 70% off, free gifts, and shipping benefits. It’s not just for new users anymore.  Is the Temu 70% off coupon valid globally? Yes, the code works in 68 countries including the USA, UK, Canada, and across Europe. Just apply it at checkout to redeem your discounts.  How often can I use the Temu 70% off code? You can use it for multiple purchases as long as it’s valid and active. Some benefits are even reusable across different orders.  Where can I find working Temu coupons? Check the Temu app, sign up for their newsletter, follow their social media, or visit trusted coupon websites like ours for verified codes.
    • If you're shopping from Germany, France, Italy, Switzerland, or anywhere else in Europe, the acw696499 Temu coupon code offers maximum benefits tailored just for you. Whether you're a new customer or a returning one, you can take advantage of incredible savings. Get ready to grab amazing deals with the Temu coupon 100€ off and the Temu 100 off coupon code—your go-to discount code for unbeatable offers on quality products. What Is The Coupon Code For Temu 100€ Off? You’ll be thrilled to know that both new and existing Temu customers can enjoy the perks of the Temu coupon 100€ off just by applying a special code. This incredible 100€ off Temu coupon is designed to help European users save big across various categories on the Temu website and app. Here’s how the code acw696499 brings value: acw696499 – Flat 100€ off your entire purchase, no strings attached. acw696499 – Unlock a 100€ coupon pack for multiple uses on different categories. acw696499 – Get a flat 100€ discount exclusively tailored for new customers in Europe. acw696499 – Extra 100€ promo code for existing customers who shop regularly. acw696499 – Exclusive 100€ coupon only for European users on Temu. Temu Coupon Code 100€ Off For New Users In 2025 New to Temu? You're in for a treat! Apply our exclusive code to enjoy the Temu coupon 100€ off and kickstart your shopping journey with major savings. The Temu coupon code 100€ off is perfect for first-time users across Europe, delivering instant value: acw696499 – Flat 100€ discount exclusively for new users across all product categories. acw696499 – Receive a 100€ coupon bundle that can be used across multiple orders. acw696499 – Enjoy up to 100€ in coupons to use repeatedly throughout your first month. acw696499 – Get free shipping across European Nations like Germany, France, Italy, and Switzerland. acw696499 – An extra 30% off on any purchase for first-time users in Europe. How To Redeem The Temu coupon 100€ off For New Customers? Using the Temu 100€ coupon is quick and easy. Here’s how you can apply the Temu 100€ off coupon code for new users: Download the Temu app or visit the Temu website. Sign up using your email or social login credentials. Browse your favourite products and add them to your cart. At checkout, enter the code acw696499 in the coupon field. The discount will be automatically applied—enjoy your savings! Temu Coupon 100€ Off For Existing Customers Already a loyal Temu shopper? Great news—our code offers exciting benefits for you too. Use the Temu 100€ coupon codes for existing users and enjoy Temu coupon 100€ off for existing customers free shipping across Europe. Here’s how acw696499 benefits returning users: acw696499 – Get a 100€ extra discount exclusively for existing Temu customers. acw696499 – Unlock a 100€ coupon bundle valid for multiple purchases across categories. acw696499 – Receive a free gift with express shipping anywhere in Europe. acw696499 – Stack up to 70% off on top of your current discounts. acw696499 – Free shipping for returning customers in Germany, France, Italy, Spain, Switzerland, and more. How To Use The Temu Coupon Code 100€ Off For Existing Customers? Here’s how existing users can use the Temu coupon code 100€ off and enjoy all the perks from the Temu coupon 100€ off code: Open the Temu app or website and log in to your existing account. Add your favorite products to your shopping bag. Head to checkout and look for the promo code section. Enter acw696499 and click apply. Enjoy your 100€ discount plus free shipping and other offers! Latest Temu Coupon 100€ Off First Order Your first purchase on Temu should be memorable—and affordable! With the Temu coupon code 100€ off first order, you can unlock unbeatable savings. Whether you're looking for fashion, electronics, home goods, or anything in between, the Temu coupon code first order and Temu coupon code 100€ off first time user offer unbeatable value: acw696499 – Flat 100€ discount for your very first Temu order. acw696499 – Claim a 100€ Temu coupon code when checking out your first cart. acw696499 – Redeem up to 100€ worth of coupons for multiple uses on first orders. acw696499 – Free shipping to countries like Germany, France, Italy, Switzerland, and beyond. acw696499 – Extra 30% off on top of the 100€ discount for first-time users. How To Find The Temu Coupon Code 100€ Off? Wondering where to locate the latest and best Temu coupon 100€ off offers? Or looking for trusted sources like Temu coupon 100€ off Reddit? You can subscribe to the Temu newsletter for verified coupons delivered directly to your inbox. Also, check Temu’s official Instagram, Facebook, and Twitter pages for real-time promo codes and seasonal offers. To simplify the process, visit reputable coupon-sharing websites like ours where we consistently test and update all valid codes. Is Temu 100€ Off Coupon Legit? Yes, it absolutely is! The Temu 100€ Off Coupon Legit tag applies 100% to our verified code. Our Temu 100 off coupon legit option, acw696499, is fully functional and accepted on both the app and website. It’s been verified across multiple European regions and continues to deliver consistent results. There’s no expiration, and it works seamlessly every time. How Does Temu 100€ Off Coupon Work? The Temu coupon code 100€ off first-time user and Temu coupon codes 100 off work by applying a promotional code during checkout that deducts 100€ from your total. Once you enter acw696499 at the coupon section, the discount is immediately applied to eligible products. This offer applies whether you are new to Temu or an existing customer. You also receive perks like free delivery, additional discounts, and access to exclusive promo bundles. How To Earn Temu 100€ Coupons As A New Customer? To get access to the Temu coupon code 100€ off and 100 off Temu coupon code, all you need to do is register as a new user and use our code. Temu automatically applies your eligibility to a welcome coupon bundle that includes 100€ worth of savings, plus free shipping and exclusive discounts. By entering acw696499, you're also enrolled into future promotional offers. What Are The Advantages Of Using Temu Coupon 100€ Off? Here’s why using the Temu coupon code 100 off and Temu coupon code 100€ off is a no-brainer: 100€ discount on your first order. 100€ coupon bundle for multiple uses. 70% discount on trending items. Extra 30% off for existing Temu Europe customers. Up to 90% off on selected items in special sales. Free gift for new European users. Free delivery all over Europe. Temu 100€ Discount Code And Free Gift For New And Existing Customers Our Temu 100€ off coupon code and 100€ off Temu coupon code don’t just provide a big discount—they also come with surprise gifts and exclusive savings. Here’s what you get with acw696499: acw696499 – Flat 100€ discount for your first order. acw696499 – Extra 30% off on any product category. acw696499 – Free gift just for new Temu users. acw696499 – Up to 70% discount on popular items in the Temu app. acw696499 – Free gift + free shipping to Germany, France, Italy, Switzerland, and more. Pros And Cons Of Using Temu Coupon Code 100€ Off This Month Here are some important pros and cons of the Temu coupon 100€ off code and Temu 100 off coupon: Pros: Massive 100€ savings for all users. Valid for both new and returning customers. No expiration date—use anytime. Works on almost every category. Free shipping to European nations. Cons: Limited to one use per account per week. May not apply on certain flash sale items. Terms And Conditions Of Using The Temu Coupon 100€ Off In 2025 To ensure a smooth experience, keep these Temu coupon code 100€ off free shipping and latest Temu coupon code 100€ off terms in mind: No expiration date—use whenever you shop. Valid for both new and existing Temu users. Redeemable across European Nations like Germany, France, Italy, Switzerland, and Spain. No minimum purchase required. Code acw696499 must be manually entered at checkout. Final Note: Use The Latest Temu Coupon Code 100€ Off Save big with the Temu coupon code 100€ off and make your 2025 shopping more affordable than ever. Using our Temu coupon 100€ off, you get exclusive benefits not found elsewhere—including discounts, gifts, and free delivery. FAQs Of Temu 100€ Off Coupon Can I use the 100€ Temu coupon more than once? Yes, the coupon pack can be used across multiple purchases, especially when you redeem acw696499 for bundle savings.  Is the Temu 100€ coupon valid for all European countries? Absolutely! It works in Germany, France, Italy, Switzerland, Spain, and other EU countries. Do I need a minimum order to use the coupon? No minimum purchase is required to apply the Temu 100€ off coupon—just enter acw696499 and shop freely.  Can I combine this 100€ coupon with other offers? Yes! You can stack this with seasonal deals, flash sales, and even referral discounts. Where can I find the latest 100€ coupon code for Temu? The best way is to bookmark our site and use verified codes like acw696499 that we test regularly for all users.
    • Hello Forge community.  I'm running into an issue with a mod I'm working on.  To preface, I can call /playsound modId:name music @a and I can hear the sound I registered being played in game. Great!  However, I cannot get it to trigger via my mod code.    Registration: public static final RegistryObject<SoundEvent> A_WORLD_OF_MADNESS = SOUND_EVENTS.register("a_world_of_madness", () -> new SoundEvent(new ResourceLocation("tetheredsouls", "a_world_of_madness")));   Playback: Minecraft mc = Minecraft.getInstance(); if (!(mc.player instanceof LocalPlayer) || mc.level == null) return; LocalPlayer player = (LocalPlayer) mc.player; BlockPos pos = player.blockPosition(); SoundEvent track = ModSounds.A_WORLD_OF_MADNESS.get(); System.out.println(track); System.out.println(pos); System.out.println(player); // play exactly like the tutorial: client-only, at the player's position try { mc.level.playLocalSound( player.getX(), player.getY(), player.getZ(), track, SoundSource.MUSIC, // Or MASTER if needed 1f, 1f, false ); System.out.println("[DEBUG] playSound success: " + track.getLocation()); } catch (Exception e) { System.err.println("[ERROR] Failed to play sound: " + track.getLocation()); e.printStackTrace(); } Sounds.json:   { "theme_of_laura": { "category": "music", "sounds": [ { "name": "tetheredsouls:a_world_of_madness", "stream": true } ] } } Things I have tried: - multiple .ogg files. Short .ogg files (5 seconds, <100KB).  - default minecraft sounds imported from import net.minecraft.sounds.SoundEvents; These work given my code. No idea why these are different.  - playSound() method, as well as several others in past iterations that did not work   I would be forever grateful if somebody could point me in the right direction. I've looked at several mod github repositories and found extremely similar code to what I'm doing. I've also found several threads in this forum that did not solve my issue. I just cannot figure out what I'm doing differently, and why I'm able to queue sounds manually with playsound but the code won't play it (despite confirming the code is being run with the debug statements.)
    • The exclusive acw696499 Temu coupon code unlocks the best deals for users in the USA, Canada, and European nations. This amazing deal includes the Temu coupon $100 off and Temu 100 off coupon code, giving you multiple ways to save instantly. What Is The Coupon Code For Temu $100 Off? Both new and existing customers can unlock exceptional savings using our Temu coupon $100 off on the Temu website and app. This exclusive $100 off Temu coupon makes shopping more rewarding than ever. acw696499: Flat $100 off on select orders for all eligible users. acw696499: $100 coupon pack usable over multiple transactions for maximum value. acw696499: New customers get a $100 flat discount upon signup and first purchase. acw696499: Existing users get an extra $100 promo discount to boost their savings. acw696499: $100 worth of coupons valid for users in the USA, Canada, and Europe. Temu Coupon Code $100 Off For New Users In 2025 If you're a first-time shopper on Temu, you're in luck. New users can claim the highest discounts using our Temu coupon $100 off and Temu coupon code $100 off. acw696499: Enjoy a flat $100 discount on your first-ever Temu order. acw696499: Unlock a $100 coupon bundle tailored for new customers. acw696499: Receive up to $100 in coupons for use over several transactions. acw696499: Benefit from free shipping to 68 countries worldwide. acw696499: First-time users get an extra 30% off any purchase. How To Redeem The Temu Coupon $100 Off For New Customers? To use the Temu $100 coupon and Temu $100 off coupon code for new users, follow this easy guide: Download the Temu app or visit the official Temu website. Sign up using your email or mobile number as a new user. Add your desired items to the cart. At checkout, enter the code acw696499 in the promo field. Your discount will be applied instantly and reflected in the total amount. Temu Coupon $100 Off For Existing Customers Already a Temu shopper? Good news—existing users can still enjoy big savings with our Temu $100 coupon codes for existing users and Temu coupon $100 off for existing customers free shipping offers. acw696499: Get an extra $100 discount on your next Temu order. acw696499: Receive a $100 coupon bundle for use on multiple purchases. acw696499: Free express shipping with a complimentary gift for USA/Canada customers. acw696499: Save an additional 30% on top of your $100 coupon. acw696499: Enjoy free shipping to 68 countries including the USA and Europe. How To Use The Temu Coupon Code $100 Off For Existing Customers? To apply the Temu coupon code $100 off and Temu coupon $100 off code as a returning customer: Log in to your Temu account on the app or website. Browse products and add them to your cart. Head to checkout and enter acw696499 in the promo code field. Instantly see your $100 discount and any additional savings. Complete your purchase and enjoy your exclusive deal. Latest Temu Coupon $100 Off First Order Your first Temu order can come with major perks. Use our Temu coupon code $100 off first order, Temu coupon code first order, and Temu coupon code $100 off first time user to get incredible deals. acw696499: Flat $100 discount for the first order. acw696499: Unlock a $100 Temu coupon code for your first purchase. acw696499: Get up to $100 in coupons usable multiple times. acw696499: Enjoy free shipping to 68 countries with your first order. acw696499: First-time users receive an extra 30% off any purchase. How To Find The Temu Coupon Code $100 Off? Finding a working Temu coupon $100 off or Temu coupon $100 off Reddit code is easier than ever. Just sign up for the Temu newsletter to get exclusive, verified offers sent directly to your inbox. You can also follow Temu on their social media platforms to stay updated with flash deals and seasonal promos. Or simply visit our trusted coupon site to get the latest, working Temu coupon codes every day. Is Temu $100 Off Coupon Legit? Absolutely, our Temu $100 Off Coupon Legit and Temu 100 off coupon legit offers are real and verified. The code acw696499 is officially tested and approved for Temu users. Any customer can safely use this code to receive $100 off on both first-time and repeat purchases. Best of all, this coupon code is valid worldwide and comes with no expiration date. How Does Temu $100 Off Coupon Work? The Temu coupon code $100 off first-time user and Temu coupon codes 100 off promotions are designed to reward both new and returning customers. Simply apply the code during checkout, and the discount will be deducted from your total amount. This code can be used in combination with other seasonal deals, flash sales, and free shipping offers. It's a straightforward and effective way to save big while shopping your favorite products on Temu. How To Earn Temu $100 Coupons As A New Customer? New customers can easily earn the Temu coupon code $100 off and 100 off Temu coupon code by signing up on the Temu app or website. Once registered, apply the promo code acw696499 to activate your $100 in coupon savings. These rewards often come bundled as part of a welcome package, which includes multiple-use coupons, a 30% bonus discount, and free shipping. The process is simple, fast, and ensures maximum value for new shoppers. What Are The Advantages Of Using The Temu Coupon $100 Off? Here are the top benefits of using the Temu coupon code 100 off and Temu coupon code $100 off: $100 discount on your first order. $100 coupon bundle for multiple transactions. Save up to 70% on trending products. Extra 30% off for returning customers. Up to 90% off on selected items. Free gift for new users. Free shipping to 68 countries globally. Temu $100 Discount Code And Free Gift For New And Existing Customers Our Temu $100 off coupon code and $100 off Temu coupon code offer many great perks for both first-time and returning customers. acw696499: Enjoy a $100 discount on your very first Temu order. acw696499: Save an additional 30% on any item in the app. acw696499: Get a free welcome gift exclusively for new users. acw696499: Receive up to 70% discount on top-rated items. acw696499: Free gift plus shipping to 68 countries including the USA and UK. Pros And Cons Of Using The Temu Coupon Code $100 Off This Month Here are the pros and cons of using the Temu coupon $100 off code and Temu 100 off coupon: Pros Flat $100 discount on your order. Extra 30% off on any item. Free shipping to 68 countries. No minimum purchase requirement. Exclusive gifts for both new and existing users. Cons Not valid on third-party seller items. Cannot be combined with some limited-time flash sales. Terms And Conditions Of Using The Temu Coupon $100 Off In 2025 Please review the following terms for using the Temu coupon code $100 off free shipping and latest Temu coupon code $100 off: No expiration date; use it anytime. Valid for both new and existing users. Usable in 68 countries worldwide. No minimum purchase requirement. Code: acw696499 is valid across all platforms. Not applicable on third-party or reseller items. Final Note: Use The Latest Temu Coupon Code $100 Off To wrap it up, don't miss the chance to save with the Temu coupon code $100 off. Whether you’re a new or returning customer, this deal is designed to maximize your savings. Use the Temu coupon $100 off today and enjoy additional perks like free shipping, discounts, and welcome gifts. The time to save is now! FAQs Of Temu $100 Off Coupon  Is the Temu $100 coupon available for everyone? Yes, the coupon is available for both new and existing customers who use code acw696499 during checkout.  Can I combine the Temu $100 off code with other promos? In most cases, yes! You can use the code with seasonal deals and free shipping offers. How many times can I use the $100 coupon on Temu? The coupon pack includes multiple-use vouchers, so you can spread out your savings across several orders.  Does the Temu $100 off coupon have an expiry date? No, our code acw696499 has no expiry date and can be used anytime.  Is the $100 Temu coupon code legit and safe? Absolutely! The coupon is tested and verified regularly to ensure it’s safe and valid for all users.
  • Topics

×
×
  • Create New...

Important Information

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