aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/SnowGolem.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/SnowGolem.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/SnowGolem.java.patch265
1 files changed, 265 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/SnowGolem.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/SnowGolem.java.patch
new file mode 100644
index 0000000000..3b935e9150
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/SnowGolem.java.patch
@@ -0,0 +1,265 @@
+--- a/net/minecraft/world/entity/animal/SnowGolem.java
++++ b/net/minecraft/world/entity/animal/SnowGolem.java
+@@ -11,15 +11,15 @@
+ import net.minecraft.sounds.SoundSource;
+ import net.minecraft.tags.BiomeTags;
+ import net.minecraft.util.Mth;
+-import net.minecraft.world.InteractionHand;
++import net.minecraft.world.EnumHand;
+ import net.minecraft.world.InteractionResult;
+ import net.minecraft.world.damagesource.DamageSource;
+ import net.minecraft.world.entity.Entity;
+ import net.minecraft.world.entity.EntityDimensions;
++import net.minecraft.world.entity.EntityPose;
+ import net.minecraft.world.entity.EntityType;
+ import net.minecraft.world.entity.LivingEntity;
+ import net.minecraft.world.entity.Mob;
+-import net.minecraft.world.entity.Pose;
+ import net.minecraft.world.entity.Shearable;
+ import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
+ import net.minecraft.world.entity.ai.attributes.Attributes;
+@@ -28,7 +28,7 @@
+ import net.minecraft.world.entity.ai.goal.RangedAttackGoal;
+ import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal;
+ import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal;
+-import net.minecraft.world.entity.monster.Enemy;
++import net.minecraft.world.entity.monster.IMonster;
+ import net.minecraft.world.entity.monster.RangedAttackMob;
+ import net.minecraft.world.entity.player.Player;
+ import net.minecraft.world.entity.projectile.Snowball;
+@@ -37,9 +37,12 @@
+ import net.minecraft.world.level.GameRules;
+ import net.minecraft.world.level.Level;
+ import net.minecraft.world.level.block.Blocks;
+-import net.minecraft.world.level.block.state.BlockState;
++import net.minecraft.world.level.block.state.IBlockData;
+ import net.minecraft.world.level.gameevent.GameEvent;
+ import net.minecraft.world.phys.Vec3;
++// CraftBukkit start
++import org.bukkit.craftbukkit.event.CraftEventFactory;
++// CraftBukkit end
+
+ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackMob {
+
+@@ -47,19 +50,18 @@
+ private static final byte PUMPKIN_FLAG = 16;
+ private static final float EYE_HEIGHT = 1.7F;
+
+- public SnowGolem(EntityType<? extends SnowGolem> entitytype, Level level) {
+- super(entitytype, level);
++ public SnowGolem(EntityType<? extends SnowGolem> entityType, Level level) {
++ super(entityType, level);
+ }
+
+ @Override
+- @Override
+ protected void registerGoals() {
+ this.goalSelector.addGoal(1, new RangedAttackGoal(this, 1.25D, 20, 10.0F));
+ this.goalSelector.addGoal(2, new WaterAvoidingRandomStrollGoal(this, 1.0D, 1.0000001E-5F));
+ this.goalSelector.addGoal(3, new LookAtPlayerGoal(this, Player.class, 6.0F));
+ this.goalSelector.addGoal(4, new RandomLookAroundGoal(this));
+- this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Mob.class, 10, true, false, (livingentity) -> {
+- return livingentity instanceof Enemy;
++ this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Mob.class, 10, true, false, (entityliving) -> {
++ return entityliving instanceof IMonster;
+ }));
+ }
+
+@@ -68,59 +70,58 @@
+ }
+
+ @Override
+- @Override
+ protected void defineSynchedData() {
+ super.defineSynchedData();
+ this.entityData.define(SnowGolem.DATA_PUMPKIN_ID, (byte) 16);
+ }
+
+ @Override
+- @Override
+- public void addAdditionalSaveData(CompoundTag compoundtag) {
+- super.addAdditionalSaveData(compoundtag);
+- compoundtag.putBoolean("Pumpkin", this.hasPumpkin());
++ public void addAdditionalSaveData(CompoundTag compound) {
++ super.addAdditionalSaveData(compound);
++ compound.putBoolean("Pumpkin", this.hasPumpkin());
+ }
+
+ @Override
+- @Override
+- public void readAdditionalSaveData(CompoundTag compoundtag) {
+- super.readAdditionalSaveData(compoundtag);
+- if (compoundtag.contains("Pumpkin")) {
+- this.setPumpkin(compoundtag.getBoolean("Pumpkin"));
++ public void readAdditionalSaveData(CompoundTag compound) {
++ super.readAdditionalSaveData(compound);
++ if (compound.contains("Pumpkin")) {
++ this.setPumpkin(compound.getBoolean("Pumpkin"));
+ }
+
+ }
+
+ @Override
+- @Override
+ public boolean isSensitiveToWater() {
+ return true;
+ }
+
+ @Override
+- @Override
+ public void aiStep() {
+ super.aiStep();
+ if (!this.level().isClientSide) {
+ if (this.level().getBiome(this.blockPosition()).is(BiomeTags.SNOW_GOLEM_MELTS)) {
+- this.hurt(this.damageSources().onFire(), 1.0F);
++ this.hurt(this.damageSources().melting, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
+ }
+
+ if (!this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
+ return;
+ }
+
+- BlockState blockstate = Blocks.SNOW.defaultBlockState();
++ IBlockData iblockdata = Blocks.SNOW.defaultBlockState();
+
+ for (int i = 0; i < 4; ++i) {
+ int j = Mth.floor(this.getX() + (double) ((float) (i % 2 * 2 - 1) * 0.25F));
+ int k = Mth.floor(this.getY());
+ int l = Mth.floor(this.getZ() + (double) ((float) (i / 2 % 2 * 2 - 1) * 0.25F));
+- BlockPos blockpos = new BlockPos(j, k, l);
++ BlockPos blockposition = new BlockPos(j, k, l);
+
+- if (this.level().getBlockState(blockpos).isAir() && blockstate.canSurvive(this.level(), blockpos)) {
+- this.level().setBlockAndUpdate(blockpos, blockstate);
+- this.level().gameEvent(GameEvent.BLOCK_PLACE, blockpos, GameEvent.Context.of(this, blockstate));
++ if (this.level().getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level(), blockposition)) {
++ // CraftBukkit start
++ if (!CraftEventFactory.handleBlockFormEvent(this.level(), blockposition, iblockdata, this)) {
++ continue;
++ }
++ // CraftBukkit end
++ this.level().gameEvent(GameEvent.BLOCK_PLACE, blockposition, GameEvent.Context.of(this, iblockdata));
+ }
+ }
+ }
+@@ -128,37 +129,39 @@
+ }
+
+ @Override
+- @Override
+- public void performRangedAttack(LivingEntity livingentity, float f) {
+- Snowball snowball = new Snowball(this.level(), this);
+- double d0 = livingentity.getEyeY() - 1.100000023841858D;
+- double d1 = livingentity.getX() - this.getX();
+- double d2 = d0 - snowball.getY();
+- double d3 = livingentity.getZ() - this.getZ();
++ public void performRangedAttack(LivingEntity target, float distanceFactor) {
++ Snowball entitysnowball = new Snowball(this.level(), this);
++ double d0 = target.getEyeY() - 1.100000023841858D;
++ double d1 = target.getX() - this.getX();
++ double d2 = d0 - entitysnowball.getY();
++ double d3 = target.getZ() - this.getZ();
+ double d4 = Math.sqrt(d1 * d1 + d3 * d3) * 0.20000000298023224D;
+
+- snowball.shoot(d1, d2 + d4, d3, 1.6F, 12.0F);
++ entitysnowball.shoot(d1, d2 + d4, d3, 1.6F, 12.0F);
+ this.playSound(SoundEvents.SNOW_GOLEM_SHOOT, 1.0F, 0.4F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
+- this.level().addFreshEntity(snowball);
++ this.level().addFreshEntity(entitysnowball);
+ }
+
+ @Override
+- @Override
+- protected float getStandingEyeHeight(Pose pose, EntityDimensions entitydimensions) {
++ protected float getStandingEyeHeight(EntityPose pose, EntityDimensions size) {
+ return 1.7F;
+ }
+
+ @Override
+- @Override
+- protected InteractionResult mobInteract(Player player, InteractionHand interactionhand) {
+- ItemStack itemstack = player.getItemInHand(interactionhand);
++ protected InteractionResult mobInteract(Player player, EnumHand hand) {
++ ItemStack itemstack = player.getItemInHand(hand);
+
+ if (itemstack.is(Items.SHEARS) && this.readyForShearing()) {
++ // CraftBukkit start
++ if (!CraftEventFactory.handlePlayerShearEntityEvent(player, this, itemstack, hand)) {
++ return InteractionResult.PASS;
++ }
++ // CraftBukkit end
+ this.shear(SoundSource.PLAYERS);
+ this.gameEvent(GameEvent.SHEAR, player);
+ if (!this.level().isClientSide) {
+- itemstack.hurtAndBreak(1, player, (player1) -> {
+- player1.broadcastBreakEvent(interactionhand);
++ itemstack.hurtAndBreak(1, player, (entityhuman1) -> {
++ entityhuman1.broadcastBreakEvent(hand);
+ });
+ }
+
+@@ -169,18 +172,18 @@
+ }
+
+ @Override
+- @Override
+- public void shear(SoundSource soundsource) {
+- this.level().playSound((Player) null, (Entity) this, SoundEvents.SNOW_GOLEM_SHEAR, soundsource, 1.0F, 1.0F);
++ public void shear(SoundSource category) {
++ this.level().playSound((Player) null, (Entity) this, SoundEvents.SNOW_GOLEM_SHEAR, category, 1.0F, 1.0F);
+ if (!this.level().isClientSide()) {
+ this.setPumpkin(false);
++ this.forceDrops = true; // CraftBukkit
+ this.spawnAtLocation(new ItemStack(Items.CARVED_PUMPKIN), 1.7F);
++ this.forceDrops = false; // CraftBukkit
+ }
+
+ }
+
+ @Override
+- @Override
+ public boolean readyForShearing() {
+ return this.isAlive() && this.hasPumpkin();
+ }
+@@ -189,10 +192,10 @@
+ return ((Byte) this.entityData.get(SnowGolem.DATA_PUMPKIN_ID) & 16) != 0;
+ }
+
+- public void setPumpkin(boolean flag) {
++ public void setPumpkin(boolean pumpkinEquipped) {
+ byte b0 = (Byte) this.entityData.get(SnowGolem.DATA_PUMPKIN_ID);
+
+- if (flag) {
++ if (pumpkinEquipped) {
+ this.entityData.set(SnowGolem.DATA_PUMPKIN_ID, (byte) (b0 | 16));
+ } else {
+ this.entityData.set(SnowGolem.DATA_PUMPKIN_ID, (byte) (b0 & -17));
+@@ -202,27 +205,23 @@
+
+ @Nullable
+ @Override
+- @Override
+ protected SoundEvent getAmbientSound() {
+ return SoundEvents.SNOW_GOLEM_AMBIENT;
+ }
+
+ @Nullable
+ @Override
+- @Override
+- protected SoundEvent getHurtSound(DamageSource damagesource) {
++ protected SoundEvent getHurtSound(DamageSource damageSource) {
+ return SoundEvents.SNOW_GOLEM_HURT;
+ }
+
+ @Nullable
+ @Override
+- @Override
+ protected SoundEvent getDeathSound() {
+ return SoundEvents.SNOW_GOLEM_DEATH;
+ }
+
+ @Override
+- @Override
+ public Vec3 getLeashOffset() {
+ return new Vec3(0.0D, (double) (0.75F * this.getEyeHeight()), (double) (this.getBbWidth() * 0.4F));
+ }