mirror of
https://github.com/darksaid98/SiegeEngines.git
synced 2026-12-01 22:22:10 +00:00
.,
This commit is contained in:
1 parent
0601689778
commit
8f467ba352
4 files changed
+23
-6
No files matched your search
Binary file not shown.
Binary file not shown.
@@ -80,10 +80,16 @@ public class ClickHandler implements Listener {
|
||||
ItemStack item = event.getPlayer().getInventory().getItemInMainHand();
|
||||
if (item.getItemMeta() != null && item.getItemMeta().hasCustomModelData()) {
|
||||
int customModel = item.getItemMeta().getCustomModelData();
|
||||
CrunchSiegeCore.CreateTrebuchet(thePlayer, customModel, event.getBlockAgainst().getLocation());
|
||||
Boolean created = CrunchSiegeCore.CreateTrebuchet(thePlayer, customModel, event.getBlockAgainst().getLocation());
|
||||
if (created) {
|
||||
item.setAmount(item.getAmount() - 1);
|
||||
thePlayer.getInventory().setItemInMainHand(item);
|
||||
thePlayer.sendMessage("Cannon spawned!");
|
||||
}
|
||||
else {
|
||||
thePlayer.sendMessage("Cannon could not be spawned, is it enabled?");
|
||||
}
|
||||
event.setCancelled(true);
|
||||
item.setAmount(item.getAmount() - 1);
|
||||
thePlayer.getInventory().setItemInMainHand(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -179,12 +185,18 @@ public class ClickHandler implements Listener {
|
||||
ArmorStand stand = (ArmorStand) entity;
|
||||
stand.addEquipmentLock(EquipmentSlot.HEAD, LockType.REMOVING_OR_CHANGING);
|
||||
SiegeEquipment equip;
|
||||
|
||||
if (CrunchSiegeCore.equipment.containsKey(entity.getUniqueId())) {
|
||||
equip = CrunchSiegeCore.equipment.get(entity.getUniqueId());
|
||||
if (equip == null || !equip.Enabled) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
equip = CrunchSiegeCore.CreateClone(living.getEquipment().getHelmet().getItemMeta().getCustomModelData());
|
||||
|
||||
if (equip == null || !equip.Enabled) {
|
||||
return;
|
||||
}
|
||||
equip.AmmoHolder = new EquipmentMagazine();
|
||||
equip.Entity = entity;
|
||||
equip.EntityId = entity.getUniqueId();
|
||||
|
||||
@@ -239,12 +239,16 @@ public class CrunchSiegeCore extends JavaPlugin {
|
||||
d = d < 0 ? d - .5 : d + .5;
|
||||
return d;
|
||||
}
|
||||
public static void CreateTrebuchet(Player player, int CustomModelData, Location l) {
|
||||
public static Boolean CreateTrebuchet(Player player, int CustomModelData, Location l) {
|
||||
//l.setY(l.getY() - 1);
|
||||
l.add(0.5, 0, 0.5);
|
||||
SiegeEquipment equip = CreateClone(CustomModelData);
|
||||
if (equip == null || !equip.Enabled) {
|
||||
return false;
|
||||
}
|
||||
l.setDirection(player.getLocation().getDirection());
|
||||
Entity entity2 = player.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
|
||||
SiegeEquipment equip = CreateClone(CustomModelData);
|
||||
|
||||
ItemStack item = new ItemStack(Material.CARVED_PUMPKIN);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
equip.AmmoHolder = new EquipmentMagazine();
|
||||
@@ -278,6 +282,7 @@ public class CrunchSiegeCore extends JavaPlugin {
|
||||
TrackedStands.put(player.getUniqueId(), newList);
|
||||
}
|
||||
equipment.put(entity2.getUniqueId(), equip);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void UpdateEntityIdModel(Entity ent, int modelNumber, String WorldName) {
|
||||
|
||||
Reference in new issue
Block a user