9
0
mirror of https://github.com/SparklyPower/SparklyPaper.git synced 2025-12-21 07:59:31 +00:00
Files
SparklyPaperMC/patches/server/0013-Don-t-get-entity-equipment-if-not-needed.patch
2021-02-24 10:49:53 -03:00

43 lines
2.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Paul Sauve <paul@technove.co>
Date: Fri, 15 Jan 2021 20:08:54 -0600
Subject: [PATCH] Don't get entity equipment if not needed
Airplane
Copyright (C) 2020 Technove LLC
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 5a717085e16fcb08bcc350463bc9dacedb7bac07..c8b5d56bd58aaf91a89a6ebdb90e87f0d1bd9e29 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -815,11 +815,13 @@ public abstract class EntityLiving extends Entity {
}
if (entity != null) {
- ItemStack itemstack = this.getEquipment(EnumItemSlot.HEAD);
- Item item = itemstack.getItem();
+ // Airplane start - don't get equipment if not needed
+ //ItemStack itemstack = this.getEquipment(EnumItemSlot.HEAD);
+ //Item item = itemstack.getItem();
EntityTypes<?> entitytypes = entity.getEntityType();
- if (entitytypes == EntityTypes.SKELETON && item == Items.SKELETON_SKULL || entitytypes == EntityTypes.ZOMBIE && item == Items.ZOMBIE_HEAD || entitytypes == EntityTypes.CREEPER && item == Items.CREEPER_HEAD) {
+ if (entitytypes == EntityTypes.SKELETON && this.getEquipment(EnumItemSlot.HEAD).getItem() == Items.SKELETON_SKULL || entitytypes == EntityTypes.ZOMBIE && this.getEquipment(EnumItemSlot.HEAD).getItem() == Items.ZOMBIE_HEAD || entitytypes == EntityTypes.CREEPER && this.getEquipment(EnumItemSlot.HEAD).getItem() == Items.CREEPER_HEAD) {
+ // Airplane end
d0 *= 0.5D;
}
}