mirror of
https://github.com/Artillex-Studios/AxMinions.git
synced 2025-02-02 23:01:26 +01:00
Fix double chests v2, fix unbreakable
This commit is contained in:
parent
8f6789b0da
commit
a6e40dc2ec
@ -682,6 +682,10 @@ class Minion(
|
||||
return
|
||||
}
|
||||
|
||||
if (toolMeta.isUnbreakable) {
|
||||
return
|
||||
}
|
||||
|
||||
val maxDurability = tool.type.maxDurability
|
||||
val damage = toolMeta.damage
|
||||
val remaining = maxDurability - damage
|
||||
@ -749,6 +753,10 @@ class Minion(
|
||||
return true
|
||||
}
|
||||
|
||||
if (toolMeta.isUnbreakable) {
|
||||
return true
|
||||
}
|
||||
|
||||
val maxDurability = tool.type.maxDurability
|
||||
val damage = toolMeta.damage
|
||||
val remaining = maxDurability - damage
|
||||
|
@ -42,6 +42,10 @@ class CollectorMinionType : MinionType("collector", AxMinionsPlugin.INSTANCE.get
|
||||
minion.setLinkedChest(minion.getLinkedChest())
|
||||
}
|
||||
|
||||
if (type == Material.CHEST && minion.getLinkedInventory() is DoubleChestInventory && !hasChestOnSide(minion.getLinkedChest()!!.block)) {
|
||||
minion.setLinkedChest(minion.getLinkedChest())
|
||||
}
|
||||
|
||||
if (type != Material.CHEST && type != Material.TRAPPED_CHEST && type != Material.BARREL) {
|
||||
Warnings.NO_CONTAINER.display(minion)
|
||||
minion.setLinkedChest(null)
|
||||
|
@ -32,6 +32,10 @@ class CrafterMinionType : MinionType("crafter", AxMinionsPlugin.INSTANCE.getReso
|
||||
minion.setLinkedChest(minion.getLinkedChest())
|
||||
}
|
||||
|
||||
if (type == Material.CHEST && minion.getLinkedInventory() is DoubleChestInventory && !hasChestOnSide(minion.getLinkedChest()!!.block)) {
|
||||
minion.setLinkedChest(minion.getLinkedChest())
|
||||
}
|
||||
|
||||
if (type != Material.CHEST && type != Material.TRAPPED_CHEST && type != Material.BARREL) {
|
||||
Warnings.NO_CONTAINER.display(minion)
|
||||
minion.setLinkedChest(null)
|
||||
|
@ -47,6 +47,10 @@ class FarmerMinionType : MinionType("farmer", AxMinionsPlugin.INSTANCE.getResour
|
||||
minion.setLinkedChest(minion.getLinkedChest())
|
||||
}
|
||||
|
||||
if (type == Material.CHEST && minion.getLinkedInventory() is DoubleChestInventory && !hasChestOnSide(minion.getLinkedChest()!!.block)) {
|
||||
minion.setLinkedChest(minion.getLinkedChest())
|
||||
}
|
||||
|
||||
if (type != Material.CHEST && type != Material.TRAPPED_CHEST && type != Material.BARREL) {
|
||||
minion.setLinkedChest(null)
|
||||
}
|
||||
|
@ -42,6 +42,10 @@ class FisherMinionType : MinionType("fisher", AxMinionsPlugin.INSTANCE.getResour
|
||||
minion.setLinkedChest(minion.getLinkedChest())
|
||||
}
|
||||
|
||||
if (type == Material.CHEST && minion.getLinkedInventory() is DoubleChestInventory && !hasChestOnSide(minion.getLinkedChest()!!.block)) {
|
||||
minion.setLinkedChest(minion.getLinkedChest())
|
||||
}
|
||||
|
||||
if (type != Material.CHEST && type != Material.TRAPPED_CHEST && type != Material.BARREL) {
|
||||
minion.setLinkedChest(null)
|
||||
}
|
||||
|
@ -40,6 +40,10 @@ class LumberMinionType : MinionType("lumber", AxMinionsPlugin.INSTANCE.getResour
|
||||
minion.setLinkedChest(minion.getLinkedChest())
|
||||
}
|
||||
|
||||
if (type == Material.CHEST && minion.getLinkedInventory() is DoubleChestInventory && !hasChestOnSide(minion.getLinkedChest()!!.block)) {
|
||||
minion.setLinkedChest(minion.getLinkedChest())
|
||||
}
|
||||
|
||||
if (type != Material.CHEST && type != Material.TRAPPED_CHEST && type != Material.BARREL) {
|
||||
minion.setLinkedChest(null)
|
||||
}
|
||||
|
@ -67,12 +67,16 @@ class MinerMinionType : MinionType("miner", AxMinionsPlugin.INSTANCE.getResource
|
||||
Warnings.remove(minion, Warnings.CONTAINER_FULL)
|
||||
}
|
||||
|
||||
if (minion.getLinkedChest() != null) {
|
||||
if (minion.getLinkedChest() != null && minion.getLinkedInventory() != null) {
|
||||
val type = minion.getLinkedChest()!!.block.type
|
||||
if (type == Material.CHEST && minion.getLinkedInventory() !is DoubleChestInventory && hasChestOnSide(minion.getLinkedChest()!!.block)) {
|
||||
minion.setLinkedChest(minion.getLinkedChest())
|
||||
}
|
||||
|
||||
if (type == Material.CHEST && minion.getLinkedInventory() is DoubleChestInventory && !hasChestOnSide(minion.getLinkedChest()!!.block)) {
|
||||
minion.setLinkedChest(minion.getLinkedChest())
|
||||
}
|
||||
|
||||
if (type != Material.CHEST && type != Material.TRAPPED_CHEST && type != Material.BARREL) {
|
||||
minion.setLinkedChest(null)
|
||||
}
|
||||
|
@ -34,12 +34,15 @@ class SellerMinionType : MinionType("seller", AxMinionsPlugin.INSTANCE.getResour
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
val type = minion.getLinkedChest()!!.block.type
|
||||
if (type == Material.CHEST && minion.getLinkedInventory() !is DoubleChestInventory && hasChestOnSide(minion.getLinkedChest()!!.block)) {
|
||||
minion.setLinkedChest(minion.getLinkedChest())
|
||||
}
|
||||
|
||||
if (type == Material.CHEST && minion.getLinkedInventory() is DoubleChestInventory && !hasChestOnSide(minion.getLinkedChest()!!.block)) {
|
||||
minion.setLinkedChest(minion.getLinkedChest())
|
||||
}
|
||||
|
||||
if (type != Material.CHEST && type != Material.TRAPPED_CHEST && type != Material.BARREL) {
|
||||
Warnings.NO_CONTAINER.display(minion)
|
||||
minion.setLinkedChest(null)
|
||||
|
@ -40,6 +40,10 @@ class SlayerMinionType : MinionType("slayer", AxMinionsPlugin.INSTANCE.getResour
|
||||
minion.setLinkedChest(minion.getLinkedChest())
|
||||
}
|
||||
|
||||
if (type == Material.CHEST && minion.getLinkedInventory() is DoubleChestInventory && !hasChestOnSide(minion.getLinkedChest()!!.block)) {
|
||||
minion.setLinkedChest(minion.getLinkedChest())
|
||||
}
|
||||
|
||||
if (type != Material.CHEST && type != Material.TRAPPED_CHEST && type != Material.BARREL) {
|
||||
minion.setLinkedChest(null)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user