I'm not sure if this is due to unimplemented code or what, but sand is impossible to work with without a bukkit entity. I'm getting this error: Code:java Caused by: java.lang.IllegalArgumentException: Don't know how to add class net.minecraft.server.EntityFallingBlock!at net.minecraft.server.EntityTrackerEntry.b(EntityTrackerEntry.java:348)at net.minecraft.server.EntityTrackerEntry.b(EntityTrackerEntry.java:191)at net.minecraft.server.EntityTrackerEntry.scanPlayers(EntityTrackerEntry.java:232)at net.minecraft.server.EntityTracker.addEntity(EntityTracker.java:97)at net.minecraft.server.EntityTracker.track(EntityTracker.java:69)at net.minecraft.server.WorldManager.a(WorldManager.java:16)at net.minecraft.server.World.c(World.java:920)at net.minecraft.server.WorldServer.c(WorldServer.java:175)at net.minecraft.server.World.addEntity(World.java:913)at org.bukkit.craftbukkit.CraftWorld.spawn(CraftWorld.java:861)at org.bukkit.craftbukkit.CraftWorld.spawn(CraftWorld.java:695)at com.FriedTaco.taco.MorePhysics.MorePhysicsBlockListener.onBlockPistonExtend(MorePhysicsBlockListener.java:67)... 21 more With this code: Code:java w.spawn(b.get(i).getLocation(), FallingSand.class); Additionally, this code, which USED to work, produces no results: Code:java EntityFallingBlock sand = new EntityFallingBlock(cWorld,b.get(i).getX(),b.get(i).getY(),b.get(i).getZ(),id,b.get(i).getData());Entity e = sand.getBukkitEntity();e.teleport(e.getLocation().add(.5,1.5,.5));cWorld.addEntity(sand);Vector vel = sand.getBukkitEntity().getVelocity();vel.add(new Vector(0,10,0));sand.getBukkitEntity().setVelocity(vel); The variable cWorld there is defined as follows: Code:java net.minecraft.server.World cWorld = ((CraftWorld)event.getBlock().getWorld()).getHandle();
you could try: Code: Block block = World.getBlockAt(*LOCATION* or *X,Y,Z*); block.setTypeId(Material.SAND, true); //the true should apply the physics to the sand
In that case I have no clue how to help you with that, however what I think your doing wrong with this: Code: w.spawn(b.get(i).getLocation(), FallingSand.class); is that FallingSand is an interface not a class
That's not an issue. You can use this with no issue, and Fireball.class is also an interface. Code: Fireball f = w.spawn(b.get(i).getLocation(), Fireball.class); f.setShooter(p);
In the code for CraftWorld.java: https://github.com/Bukkit/CraftBukk...a/org/bukkit/craftbukkit/CraftWorld.java#L727 You cannot use FallingSand as a class in spawn().
I don't see why not. This is in spawn() on line 748-749. If I'm missing something, please point out why it can't be used. Code: } else if (FallingSand.class.isAssignableFrom(clazz)) { entity = new EntityFallingBlock(world, x, y, z, 0, 0);
The exception is thrown in minecraft code. Minecraft expects the id field to be either 12 or 13 (sand or gravel) but craftbukkit passes 0.
That makes sense. Though why doesn't my original code (in my first post) work? It simply stopped working when the minecraft code changed from EntityFallingSand to EntityFallingBlock even though I pass in the id and data properly. I'm not asking for anyone to write the code for me, of course. I'm simply wondering where my error is. I've pushed my current code to my github if context helps any. Here: https://github.com/FriedTaco/MorePhysics/tree/master/MorePhysics/src/com/FriedTaco/taco/MorePhysics
Strange. That's how minecraft does it: https://github.com/Bukkit/CraftBukk.../java/net/minecraft/server/BlockSand.java#L32 I looket at the code of the bukkit methods you're calling and they shouldn't make a difference, should they? Maybe try it with just Code: EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, x, y,z, 12, 0); world.addEntity(entityfallingblock); and see if it works. Edit: x,y,z
I'll give that a shot when I get home today. I'll report back with my results. It doesn't seem to be adding the falling sand entity for some reason. EDIT by Moderator: merged posts, please use the edit button instead of double posting.