-
Posts
34 -
Joined
-
Last visited
Everything posted by Jonas Handtke
-
I tried to use the Entity.setPose Method in a Keybind to force sitting the Player but it didn't work at all. Do I use it wrong? Do I need to do more than using the setPose() Method?
-
Hello Everyone, I need some help with a Method where I want to throw Exceptions on certain Conditions. If you use the Method and if any of those Conditions to throw a Exception is true, then it should give us an Exception but I don't know how to implement this right. This is the Code: public static SoulType register(String id, String displayName, SoulTypeRarities rarity, double corruption, double strength) { double minCorruption = 0; double maxCorruption = 2; double minStrength = 0; double maxStrength = 5; if (SOUL_TYPES.containsKey(id)) { throw new IllegalArgumentException("SoulType with id '" + id + "' already exists."); } if (corruption < minCorruption || corruption > maxCorruption) { throw new IllegalArgumentException("Corruption must be between " + minCorruption + " and " + maxCorruption + " ."); } if (strength < minStrength || strength > maxStrength) { throw new IllegalArgumentException("Strength must be between " + minStrength + " and " + maxStrength + " ."); } SoulType newType = new SoulType(id, displayName, rarity, corruption, strength); SOUL_TYPES.put(id, newType); return newType; }
-
I want to create a Enchantment that adds an Overlay with an Shader that acts like Echolocation Effect. Where should I start? Are this type of Shader hard to code??
-
I want to create a completely new Entity Class (exactly like the Vanilla Entity Class) but has more Properties and Fields for my Mod. For Example I want to add a new Property to add Types (Elemental, Dark, Physical, Magical etc.) this will add automatically Weakness and Strengths to the Entity. Or should I add these "Types" when an Entity is spawned?
-
EDIT: I found the Solution how to fix it by myself. I'm trying to make a Event that is fired if a Player is swimming. Here is the Event Class: public class PlayerSwimEvent extends PlayerEvent { public PlayerSwimEvent(Player player) { super(player); } } Here is the Hooks (similar to ForgeHooks Class) that has Methods for the Events: public class EventHooks { public static void onPlayerSwim(Player player) { MinecraftForge.EVENT_BUS.post(new PlayerSwimEvent(player)); } } And here is the Mixin Class: @Mixin(value = Player.class) public class MixinPlayerSwimEvent { @Inject(method = "isSwimming", at = @At("HEAD")) public boolean isSwimming(CallbackInfoReturnable<Boolean> cir) { Player player = null; if (!player.getAbilities().flying && !player.isSpectator()) { EventHooks.onPlayerSwim(player); } return cir.getReturnValue(); } } My Issue is now that I don't get it to work because of the missing Parameter Player. Can someone help with this?
-
1.20.1 ForgeRegistries.BIOMES.getKeys() returning null
Jonas Handtke replied to saxon564's topic in Modder Support
Well the Code I tried didn't work, sadly. -
1.20.1 ForgeRegistries.BIOMES.getKeys() returning null
Jonas Handtke replied to saxon564's topic in Modder Support
I think I found a found a solution but I need to check myself if this code I want to try works. -
I want to extend the Attribute Class with a new Method that if you have a specific Value of that Attribute you use this Method you get a permanent Potion Effect. For example if you have a Attribute that has the min Value 0 and the Max Value 1 and want that you get the specified Potion Effect if the Value of that Attribute is 1. I never made something like extending a certain Class with new Functionality and need some Instructions to get into. Maybe you know a good Tutorial about it.
-
I want to make a Mod similar to the Tinkers Construct Crafting System where you can use different Materials to create a Tool. But mainly I want to recreate the Texture Overlay Feature. Sadly I don't know the Method how to create something like that. Can someone tell me the rough Step how can I make something like the Tinkers Construct Crafting System?
-
What are the Steps to create a custom Event?
Jonas Handtke replied to Jonas Handtke's topic in Modder Support
Also does someone know which java file is calling for example the Event LivingAttackEvent? -
What are the Steps to create a custom Event?
Jonas Handtke replied to Jonas Handtke's topic in Modder Support
That was just an example and a test to see how it works. -
I want to create an Event called PlayerSwimEvent. I know how an event is structured, but I don't know how to make it works so you can use it. Somehow I can't see through it. Can someone explain to me the steps for roughly setting up an event?
-
How to Reset Style for a TextComponent in 1.18.2?
Jonas Handtke replied to Jonas Handtke's topic in Modder Support
But there is no Reset Method for the TextColor Method, right? -
I made an Command that provides Information about the current World. That includes the World Name. Here is the Code: Style WorldInfoStyle = Style.EMPTY; WorldInfoStyle = Style.EMPTY.withColor(TextColor.fromRgb(0xFFAA00)); if (entity instanceof Player _player && !_player.level.isClientSide()) _player.displayClientMessage(new TextComponent("World Name: ").setStyle(WorldInfoStyle).append(new TextComponent(world.getServer().getWorldData().getLevelName()).setStyle(Style.EMPTY)), (false)); I want after "World Name: " that the Style gets resets to its default Plain Text/String. I tried for myself at least 2-3 hours and tested a lot of other methods to reset the Style. Am I missing something?
-
I got to made the Component that I copied from SeedCommand to work. But the only issue that if I get the Component Variable inside the displayClientMessage and using getString() it only prints the String but not the Style to the chat. I think I'm missing something... Component TestComponent = ComponentUtils.wrapInSquareBrackets((new TextComponent(TestString)).withStyle((TestStyle) -> { return TestStyle.withColor(ChatFormatting.RED).withInsertion(TestString); })); if (entity instanceof Player _player && !_player.level.isClientSide()) _player.displayClientMessage(new TextComponent(TestComponent.getString()), (false));
-
One Question: What is the best Method to implement MutableComponent inside of displayClientMessage Method? Here is a Code and tried to implement it inside it: if (entity instanceof Player _player && !_player.level.isClientSide()) _player.displayClientMessage(new TextComponent(("§6" + "Seed: " + "§r" new MutableComponent(world.getServer().overworld().getSeed()).withStyle(style -> style.bold(true)).build())), (false)); But got this Error: error: MutableComponent is abstract; cannot be instantiated