Skip to content

Commit

Permalink
Fixed Universal Repairing Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
RaymondBlaze committed Aug 27, 2022
1 parent e2d5efa commit 4573678
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Inspired by [Origins: Environmental Armor](https://github.com/MagicQuartz/Enviro
- Slowly loses durability in rain but won't get completely broken
- Slowly regains durability when exposed to normal weather, hot environments could accelerate the process.
- Needs to be dyed to a color dark enough to keep out sunlight, and it won't cost durability.
- Propeties can be configured in server config.
- Properties can be configured in server config.

#### Goggles
- Defined in tag `forge:goggles` can be used to remove Enderian's visual problem on pumpkins.
Expand All @@ -39,7 +39,7 @@ providing the best protection for Elytrian.
### Enchantments

#### Flying Protection
- Protection enchantment which excluisvely protects player from "Fly into wall" damage.
- Protection enchantment which exclusively protects player from "Fly into wall" damage.

### Effects

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,14 @@ public static void onLivingUpdate(LivingEvent.LivingUpdateEvent event) {
BlockPos pos = entity.blockPosition();
boolean isInRain = level.isRainingAt(pos) || level.isRainingAt(new BlockPos(pos.getX(), entity.getBoundingBox().maxY, pos.getZ()));
for(ItemStack stack : entity.getHandSlots()) {
if(isInRain) {
stack.setDamageValue(Mth.clamp(stack.getDamageValue() + 1, 0, stack.getMaxDamage()));
} else if(level.getBiome(pos).value().shouldSnowGolemBurn(pos)) {
stack.setDamageValue(Mth.clamp(stack.getDamageValue() - 2, 0, stack.getMaxDamage()));
} else {
stack.setDamageValue(Mth.clamp(stack.getDamageValue() - 1, 0, stack.getMaxDamage()));
if(stack.getItem() instanceof UmbrellaItem) {
if(isInRain) {
stack.setDamageValue(Mth.clamp(stack.getDamageValue() + 1, 0, stack.getMaxDamage()));
} else if(level.getBiome(pos).value().shouldSnowGolemBurn(pos)) {
stack.setDamageValue(Mth.clamp(stack.getDamageValue() - 2, 0, stack.getMaxDamage()));
} else {
stack.setDamageValue(Mth.clamp(stack.getDamageValue() - 1, 0, stack.getMaxDamage()));
}
}
}
}
Expand Down

0 comments on commit 4573678

Please sign in to comment.