Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NPC's now sit on little entity arrows... that sometimes bug themselves for no good reason and kind of mess things up. but at least it sits temporarily. Also it stands wrong. sometimes takes the stand command twice and a teleport to get it going.
- Loading branch information
1 parent
6c9fbd9
commit dcfbb5f
Showing
6 changed files
with
91 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/main/java/net/aufdemrand/denizen/utilities/entity/CraftFakeArrow.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package net.aufdemrand.denizen.utilities.entity; | ||
|
||
import net.minecraft.server.v1_7_R4.EntityArrow; | ||
import org.bukkit.Location; | ||
import org.bukkit.craftbukkit.v1_7_R4.CraftServer; | ||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; | ||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow; | ||
import org.bukkit.entity.Arrow; | ||
import org.bukkit.entity.LivingEntity; | ||
import org.bukkit.entity.Vehicle; | ||
|
||
public class CraftFakeArrow extends CraftArrow implements Vehicle { | ||
public CraftFakeArrow(CraftServer craftServer, EntityArrow entityArrow) { | ||
super(craftServer, entityArrow); | ||
} | ||
|
||
public void setShooter (LivingEntity livingEntity) { | ||
} | ||
|
||
@Override | ||
public void remove() { | ||
if (getPassenger() != null) { | ||
return; | ||
} | ||
super.remove(); | ||
} | ||
|
||
public static Arrow createArrow(Location location) { | ||
CraftWorld world = (CraftWorld) location.getWorld(); | ||
EntityArrow arrow = new FakeArrowEntity(world, location); | ||
return (Arrow) arrow.getBukkitEntity(); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/net/aufdemrand/denizen/utilities/entity/FakeArrowEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package net.aufdemrand.denizen.utilities.entity; | ||
|
||
import net.minecraft.server.v1_7_R4.EntityArrow; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.Location; | ||
import org.bukkit.craftbukkit.v1_7_R4.CraftServer; | ||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; | ||
|
||
public class FakeArrowEntity extends EntityArrow { | ||
|
||
public FakeArrowEntity(CraftWorld craftWorld, Location location) { | ||
super(craftWorld.getHandle()); | ||
setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); | ||
world.addEntity(this); | ||
bukkitEntity = new CraftFakeArrow((CraftServer) Bukkit.getServer(), this); | ||
} | ||
|
||
@Override | ||
public void h() { | ||
// Do nothing | ||
} | ||
} |