Jump to content

Jonas Handtke

Members
  • Posts

    34
  • Joined

  • Last visited

Everything posted by Jonas Handtke

  1. I want to ask if the AI Tasks you create for a Custom Entity the priority is important? For example if you want to make a Entity constantly attack the player the priority is the key, right?
  2. 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?
  3. I mean is it possible to do that? Like an Event so you can write what happens when a Player/Entity is hearing a Sound.
  4. 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; }
  5. 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??
  6. 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?
  7. For Example I have an Main Mod that adds new Content to Minecraft. But I'm using custom Classes etc. and I want it so that is an api integrated in the Main Mod but can be download seperately like an Module. Is this possible? If you need more Information just comment what you need to know ^^
  8. 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?
  9. Well the Code I tried didn't work, sadly.
  10. I think I found a found a solution but I need to check myself if this code I want to try works.
  11. 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.
  12. 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?
  13. Just a Question I'm currently thinking. I plan to add a new Operation to the existing Operation List, is this event possible??
  14. Also does someone know which java file is calling for example the Event LivingAttackEvent?
  15. That was just an example and a test to see how it works.
  16. 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?
  17. But there is no Reset Method for the TextColor Method, right?
  18. 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?
  19. Well that makes sense. I need to mention that I never had to do with Component and ComponentUtils. Only with TextComponent and TranslatebleComponent. So then I thought I can research for myself how to implement Text with Styles.
  20. 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));
  21. No what I want is how to use MutableComponent correctly inside of displayClientMessage.
  22. 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
  23. I'm making currently a Command that shows you Information of the World. There you can also see the Seed of the World. But I want it to make it clickable to make it copyable to clipboard. Know someone what the Code is?
  24. Thank you! I will research this, how to use it properly
×
×
  • Create New...

Important Information

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