mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-24 05:47:59 +01:00
Disable a number of amulet effects when in creative mode
This commit is contained in:
parent
0bc7c5d233
commit
e7d6c22fb4
1 changed files with 7 additions and 2 deletions
|
@ -89,7 +89,7 @@ public class AlicornAmuletItem extends AmuletItem implements ItemTracker.Trackab
|
|||
public void interactWithPlayer(IItemEntity item, PlayerEntity player) {
|
||||
ItemEntity entity = (ItemEntity)item;
|
||||
|
||||
if (!player.world.isClient && !entity.isRemoved()) {
|
||||
if (!player.world.isClient && !entity.isRemoved() && !player.isCreative()) {
|
||||
if (player.getPos().distanceTo(entity.getPos()) < 0.5) {
|
||||
if (entity.world.random.nextInt(150) == 0) {
|
||||
entity.setPickupDelay(0);
|
||||
|
@ -115,6 +115,11 @@ public class AlicornAmuletItem extends AmuletItem implements ItemTracker.Trackab
|
|||
|
||||
@Override
|
||||
public void onUnequipped(Living<?> wearer, long timeWorn) {
|
||||
|
||||
if (wearer.getMaster() instanceof PlayerEntity player && player.isCreative()) {
|
||||
return;
|
||||
}
|
||||
|
||||
float attachedTime = timeWorn / 100F;
|
||||
|
||||
LocalDifficulty difficulty = wearer.getReferenceWorld().getLocalDifficulty(wearer.getOrigin());
|
||||
|
@ -188,7 +193,7 @@ public class AlicornAmuletItem extends AmuletItem implements ItemTracker.Trackab
|
|||
reserves.getExertion().add(2);
|
||||
}
|
||||
|
||||
if (fullSecond && world.random.nextInt(12) == 0) {
|
||||
if (fullSecond && world.random.nextInt(12) == 0 && !pony.getMaster().isCreative()) {
|
||||
reserves.getEnergy().add(reserves.getEnergy().getMax() / 10F);
|
||||
pony.getCorruption().add((int)MathHelper.clamp(attachedTicks / ItemTracker.HOURS, 1, pony.getCorruption().getMax()));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue