This commit is contained in:
TheCrunchy committed 2023-07-31 17:32:48 +01:00
1 parent f3a27551aa
commit 9dbb1cd17f
2 files changed
+37 -19

No files matched your search

Binary file not shown.
+37 -19
View File
@@ -75,7 +75,7 @@ public class ClickHandler implements Listener {
if (proj.PlaceBlocks) { if (proj.PlaceBlocks) {
TNTPrimed tntEnt = (TNTPrimed) tnt; TNTPrimed tntEnt = (TNTPrimed) tnt;
tntEnt.setYield(1); tntEnt.setYield(0);
tntEnt.setFuseTicks(0); tntEnt.setFuseTicks(0);
if (CrunchSiegeCore.towny != null) { if (CrunchSiegeCore.towny != null) {
TownBlock block = TownyAPI.getInstance().getTownBlock(loc); TownBlock block = TownyAPI.getInstance().getTownBlock(loc);
@@ -86,6 +86,7 @@ public class ClickHandler implements Listener {
} }
} }
} }
}
if (event.getHitBlock() != null) { if (event.getHitBlock() != null) {
List<Block> Blocks = sphere(event.getHitBlock().getLocation(), proj.ExplodePower); List<Block> Blocks = sphere(event.getHitBlock().getLocation(), proj.ExplodePower);
for (int i = 0; i < proj.BlocksToPlaceAmount; i++) { for (int i = 0; i < proj.BlocksToPlaceAmount; i++) {
@@ -94,7 +95,6 @@ public class ClickHandler implements Listener {
} }
} }
} }
}
else { else {
TNTPrimed tntEnt = (TNTPrimed) tnt; TNTPrimed tntEnt = (TNTPrimed) tnt;
tntEnt.setYield(proj.ExplodePower); tntEnt.setYield(proj.ExplodePower);
@@ -303,6 +303,13 @@ public class ClickHandler implements Listener {
if (ent.isDead()) { if (ent.isDead()) {
continue; continue;
} }
DoAimUp(ent, amount, player);
}
}
public void DoAimUp(Entity ent, float amount, Player player) {
Location loc = ent.getLocation(); Location loc = ent.getLocation();
ArmorStand stand = (ArmorStand) ent; ArmorStand stand = (ArmorStand) ent;
// player.sendMessage(String.format("" + loc.getPitch())); // player.sendMessage(String.format("" + loc.getPitch()));
@@ -323,10 +330,28 @@ public class ClickHandler implements Listener {
ent.teleport(loc); ent.teleport(loc);
}
public void DoAimDown(Entity ent, float amount, Player player) {
Location loc = ent.getLocation();
ArmorStand stand = (ArmorStand) ent;
// player.sendMessage(String.format("" + loc.getPitch()));
if (loc.getPitch() == 85 || loc.getPitch() + amount > 85) {
return;
}
SiegeEquipment equipment = CrunchSiegeCore.equipment.get(ent.getUniqueId());
if (equipment != null) {
equipment.ShowFireLocation(player);
if (equipment.RotateStandHead) {
stand.setHeadPose(new EulerAngle(loc.getDirection().getY()*(-1),0,0));
} }
} }
loc.setPitch((float) (loc.getPitch() + amount));
ent.teleport(loc);
}
@EventHandler @EventHandler
public void DeathEvent(EntityDeathEvent event) { public void DeathEvent(EntityDeathEvent event) {
@@ -364,24 +389,8 @@ public class ClickHandler implements Listener {
if (ent.isDead()) { if (ent.isDead()) {
continue; continue;
} }
Location loc = ent.getLocation();
ArmorStand stand = (ArmorStand) ent;
// player.sendMessage(String.format("" + loc.getPitch()));
if (loc.getPitch() == 85 || loc.getPitch() + amount > 85) {
return;
}
SiegeEquipment equipment = CrunchSiegeCore.equipment.get(ent.getUniqueId());
if (equipment != null) {
equipment.ShowFireLocation(player); DoAimDown(ent, amount, player);
if (equipment.RotateStandHead) {
stand.setHeadPose(new EulerAngle(loc.getDirection().getY()*(-1),0,0));
}
}
loc.setPitch((float) (loc.getPitch() + amount));
ent.teleport(loc);
} }
} }
@@ -519,6 +528,15 @@ public class ClickHandler implements Listener {
if (entity.getType() == EntityType.ARMOR_STAND){ if (entity.getType() == EntityType.ARMOR_STAND){
TakeControl(player, entity); TakeControl(player, entity);
if (CrunchSiegeCore.equipment.containsKey(entity.getUniqueId())) { if (CrunchSiegeCore.equipment.containsKey(entity.getUniqueId())) {
if (itemInHand == null || itemInHand.getType() == Material.AIR) {
if (player.isSneaking()) {
DoAimDown(entity, 1, player);
}
else {
DoAimUp(entity, 1, player);
}
return;
}
SiegeEquipment equipment = CrunchSiegeCore.equipment.get(entity.getUniqueId()); SiegeEquipment equipment = CrunchSiegeCore.equipment.get(entity.getUniqueId());
if (itemInHand.getType().equals(equipment.FuelMaterial)) { if (itemInHand.getType().equals(equipment.FuelMaterial)) {
if (!equipment.LoadFuel(player)) { if (!equipment.LoadFuel(player)) {