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


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

MoxLotus's Achievements

Tree Puncher

Tree Puncher (2/8)



  1. Any helpful crash logs? I can't give much insight without those. It's not convenient for me to dig through code right now, but somewhere in Entity or EntityLiving there should be functions that deal with which direction the entity is looking in. Maybe try finding examples in the Enderman code, since line of sight is so important to them. If you can find it, figuring out if the ray-trace from the arrow came from the appropriate direction should just be a question of math. Do my sense of aesthetic a favor and combine those first two if statements with a &&. That way you cast your two variables only if you actually need them.
  2. Instead of creating a new RayTraceResult you should have an instanceof test and cast event.getRayTraceResult. As for your question, does it do what you expect if you always cancel the event?
  3. I believe it's simply because nobody took the time to update that system.
  4. ServerPlayerEntity extends PlayerEntity. No idea where which one is used, but you can run an instanceof and try casting. And yes, changing the method signature would invalidate the @Override, but basic Java is normally outside the scope of this forum. You can try: if (player instanceof ServerPlayerEntity){ ServerEntityPlayer serverPlayer = (ServerEntityPlayer)player; glide(serverPlayer); }else {System.out.println("player is not a ServerPlayerEntity :(");} and feel free to look up appropriate Java tutorials for casting and polymorphism. But like I said, I'm not sure exactly when PlayerEntity is or is not an instance of ServerPlayerEntity.
  5. In ServerPlayNetHandler::processEntityAction But if you call that setElytraFlying method from PlayerEntity does that have the desired effect? The setFlag method is protected, but all setElytraFlying appears to do is set it. I don't see any additional checks after it is called. It won't fully replicate the behavior of Elytra, but my guess is that it is in charge of the flying part.
  6. From AbstractArrowEntity::tick EntityRayTraceResult entityraytraceresult = this.rayTraceEntities(vec3d2, vec3d3); if (entityraytraceresult != null) { raytraceresult = entityraytraceresult; } if (raytraceresult != null && raytraceresult.getType() == RayTraceResult.Type.ENTITY) { Entity entity = ((EntityRayTraceResult)raytraceresult).getEntity(); Entity entity1 = this.getShooter(); if (entity instanceof PlayerEntity && entity1 instanceof PlayerEntity && !((PlayerEntity)entity1).canAttackPlayer((PlayerEntity)entity)) { raytraceresult = null; entityraytraceresult = null; } } if (raytraceresult != null && raytraceresult.getType() != RayTraceResult.Type.MISS && !flag && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { this.onHit(raytraceresult); this.isAirBorne = true; } The event is fired in that fourth if statement. You should be able to get the Enity the arrow hit (if any) from the EntityRayTraceResult. Then I suppose you'll want to find out if the Entity is a player and if they were facing the appropriate direction at the time.
  7. I'm looking at the 1.15 code, but it's substantially similar. My understanding is that when a player jumps in midair while Elytra are equipped, the client sends that packet to the server. The server receives the packet and double checks the criteria for flying. public void processEntityAction(CEntityActionPacket packetIn) { ... case START_FALL_FLYING: if (!this.player.func_226566_ei_()) { this.player.func_226568_ek_(); } break; The server calls another function which sets flag 7. public void func_226568_ek_() { this.setFlag(7, true); this.setFlag(7, false); }
  8. Have you searched for usages of Items.ELYTRA? In PlayerEntity I find a reference to a flag for "elytra flying". There is also logic in ClientPlayerEntity that appears to submit a request for that flag to be set when the right conditions are met.
  9. I believe you would want to create a custom BiomeProvider and override the getNoiseBiome method inherited from BiomeManager.IBiomeReader. This won't actually accomplish anything unless you have a ChunkGenerator which uses your BiomeProvider. The only way I know to do that is to create a new WorldType and employ the createChunkGenerator method to create a new instance of a ChunkGenerator when the appropriate DimensionType is being loaded. You likely want an OverworldChunkGenerator which accepts a BiomeProvider as an argument to the constructor. I also believe new WorldType instances are registered when you call super("unique_name"). Just don't forget to actually create an instance of your WorldType when your mod loads. Then when you play you can pick your WorldType during world creation. I don't have a working example in 1.15 yet, so I could have missed something.
  10. It is possible; I've confirmed that this code has the desired effect: public void notifyBlockUpdate(World worldIn, BlockPos pos, IBlockState oldState, IBlockState newState, int flags){ if (oldState.getBlock() != Blocks.FLOWING_LAVA) return; if (newState.getBlock() != Blocks.COBBLESTONE) return; boolean adjacentToWater = false; if (worldIn.getBlockState(pos.north()).getMaterial() == Material.WATER) adjacentToWater = true; if (worldIn.getBlockState(pos.south()).getMaterial() == Material.WATER) adjacentToWater = true; if (worldIn.getBlockState(pos.east() ).getMaterial() == Material.WATER) adjacentToWater = true; if (worldIn.getBlockState(pos.west() ).getMaterial() == Material.WATER) adjacentToWater = true; if (worldIn.getBlockState(pos.down() ).getMaterial() == Material.WATER) adjacentToWater = true; if (worldIn.getBlockState(pos.up() ).getMaterial() == Material.WATER) adjacentToWater = true; if(!adjacentToWater) return; worldIn.setBlockState(pos, Blocks.DIAMOND_BLOCK.getDefaultState()); } But like you said, I'm using guess-work. I would still be interested in submitting a PR - if my technical knowledge extended to all that "@@ -452,4 +452,29 @@" stuff in BlockLiquid.java.patch. I don't suppose anyone has suggestions for topics to google?
  11. Bukkit has an event which can be used to modify the result of mixing lava and water. I'm wondering if Forge has something similar. I don't see anything in net.minecraft,block.BlockLiquid.checkForMixing, but I thought I'd double check here before I try anything too complex. My intention is to modify minecraft's behavior such that you can get granite etc. from a cobblestone generator.
  • Create New...

Important Information

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