Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

StefanDeSterke

Members
  • Posts

    28
  • Joined

  • Last visited

StefanDeSterke's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. Woops I didn't see that it was in that class. But nonetheless, I don't really know where to override the AI of an entity.
  2. The code for when endermen get angry is here in the EndermanEntity class: /** * Checks to see if this enderman should be attacking this player */ private boolean shouldAttackPlayer(PlayerEntity player) { ItemStack itemstack = player.inventory.armorInventory.get(3); if (itemstack.isEnderMask(player, this)) { return false; } else { Vector3d vector3d = player.getLook(1.0F).normalize(); Vector3d vector3d1 = new Vector3d(this.getPosX() - player.getPosX(), this.getPosYEye() - player.getPosYEye(), this.getPosZ() - player.getPosZ()); double d0 = vector3d1.length(); vector3d1 = vector3d1.normalize(); double d1 = vector3d.dotProduct(vector3d1); return d1 > 1.0D - 0.025D / d0 ? player.canEntityBeSeen(this) : false; } } This method is not called in the enderman's AI tasks, but in it's tick method. public void tick() { if (this.enderman.getAttackTarget() == null) { super.func_234054_a_((LivingEntity)null); } if (this.player != null) { if (--this.aggroTime <= 0) { this.nearestTarget = this.player; this.player = null; super.startExecuting(); } } else { if (this.nearestTarget != null && !this.enderman.isPassenger()) { if (this.enderman.shouldAttackPlayer((PlayerEntity)this.nearestTarget)) { //It's called here if (this.nearestTarget.getDistanceSq(this.enderman) < 16.0D) { this.enderman.teleportRandomly(); } this.teleportTime = 0; } else if (this.nearestTarget.getDistanceSq(this.enderman) > 256.0D && this.teleportTime++ >= 30 && this.enderman.teleportToEntity(this.nearestTarget)) { this.teleportTime = 0; } } super.tick(); } } The only problem is, I don't know how to override a vanilla minecraft class.
  3. Done that, but still couldn't find any event that matches what I'm looking for :(. I also looked into the enderman entity class itself, and it seems that 'itemstack.isEnderMask(PlayerEntity, EndermanEntity)' controls wether an item is considered a mask from endermen. Any way I can override this and add my enchantment?
  4. Hi, so I've just added an enchantment to my mod that is supposed to not anger endermen when you put an helmet on with that enchantment. I was wondering if there was a sort of EntityAggravatedEvent of some sort, that I can cancel when an enderman gets angry at a player with that enchantment. Thanks!
  5. We can't help you unless you post the crash log.
  6. I'm sorry, but I've been sitting here for 2 hours now, squeezing my eyes together and looking at Minecraft's source code, but I generally don't know what they are doing. This is mostly due to the fact that the code is obfuscated, and there is generally not really a way to know what 'func_230364_a_' means, or 'int p_230364_3_'. One of the ways to do this, is to have some context around it, and seeing what the other methods around that one do. But they are obfuscated too, leading me only into darkness. Now my question is, is there some deobfuscated form of Minecraft's source code at wich I can look at, and know what they are doing? Thanks.
  7. Hi! My problem is that I don't know how to add custom structures, and I couldn't find any good tutorial that's up to date to 1.15 or 1.16. I know you have to do stuff with Features, but I don't really know where to start. If anyone could link me to an up to date tutorial or could explain what I need to do that would be great. Thanks!
  8. You should check out the forge documentation. https://mcforge.readthedocs.io/en/1.14.x/
  9. Hi! So I coded a block with harvest level 3 and tooltype pickaxe, but for some reason it still drops its loot table when I mine it with a tool that has harvest level 2 (for example an iron pickaxe). It even ignores the tooltype, because if you mine it with for instance a diamond shovel it still drops. I only want it to drop when mined with a diamond pickaxe or a netherite pickaxe. Here's my code: @SubscribeEvent public static void registerBlocks(RegistryEvent.Register<Block> event) { event.getRegistry().registerAll( new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(6f, 2000f).harvestTool(ToolType.PICKAXE).harvestLevel(3)).setRegistryName(location("blaststone_ore")) ); } If someone has a solution to this, that would be greatly appreciated. Thanks!
  10. Nevermind I already found a previous post that worked.
  11. I want to create a mod that implements a new type of rails, but how do I remove the collision for the rails? Vanilla Minecraft rails have disabled collisions so you can walk through them, but my rails currently have a collision just like one layer of snow on the ground does. I have checked the AbstractRailBlock and RailBlock classes of Forge but I couldn't find anything. Overriding the method getCollisionBoundingBoxFromPool and returning null doesn't work either because it doesn't exist anymore. Does anyone have an idea of how to do this?
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.