aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/animal/Fox.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/animal/Fox.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/animal/Fox.java.patch106
1 files changed, 106 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/animal/Fox.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/animal/Fox.java.patch
new file mode 100644
index 0000000000..d9ce3fc633
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/animal/Fox.java.patch
@@ -0,0 +1,106 @@
+--- a/net/minecraft/world/entity/animal/Fox.java
++++ b/net/minecraft/world/entity/animal/Fox.java
+@@ -508,11 +521,14 @@
+
+ @Override
+ protected void pickUpItem(ItemEntity itemEntity) {
+- ItemStack item = itemEntity.getItem();
+- if (this.canHoldItem(item)) {
+- int count = item.getCount();
+- if (count > 1) {
+- this.dropItemStack(item.split(count - 1));
++ ItemStack itemstack = itemEntity.getItem();
++
++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, itemEntity, itemstack.getCount() - 1, !this.canHoldItem(itemstack)).isCancelled()) { // CraftBukkit - call EntityPickupItemEvent
++ itemstack = itemEntity.getItem(); // CraftBukkit - update ItemStack from event
++ int i = itemstack.getCount();
++
++ if (i > 1) {
++ this.dropItemStack(itemstack.split(i - 1));
+ }
+
+ this.spitOutItem(this.getItemBySlot(EquipmentSlot.MAINHAND));
+@@ -874,6 +884,16 @@
+ if (loveCause1 != null && loveCause != loveCause1) {
+ fox.addTrustedUUID(loveCause1.getUUID());
+ }
++ // CraftBukkit start - call EntityBreedEvent
++ entityfox.setAge(-24000);
++ entityfox.moveTo(this.animal.getX(), this.animal.getY(), this.animal.getZ(), 0.0F, 0.0F);
++ int experience = this.animal.getRandom().nextInt(7) + 1;
++ org.bukkit.event.entity.EntityBreedEvent entityBreedEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(entityfox, animal, partner, entityplayer, this.animal.breedItem, experience);
++ if (entityBreedEvent.isCancelled()) {
++ return;
++ }
++ experience = entityBreedEvent.getExperience();
++ // CraftBukkit end
+
+ if (serverPlayer != null) {
+ serverPlayer.awardStat(Stats.ANIMALS_BRED);
+@@ -884,15 +904,14 @@
+ this.partner.setAge(6000);
+ this.animal.resetLove();
+ this.partner.resetLove();
+- fox.setAge(-24000);
+- fox.moveTo(this.animal.getX(), this.animal.getY(), this.animal.getZ(), 0.0F, 0.0F);
+- serverLevel.addFreshEntityWithPassengers(fox);
+- this.level.broadcastEntityEvent(this.animal, (byte)18);
++ worldserver.addFreshEntityWithPassengers(entityfox, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
++ this.level.broadcastEntityEvent(this.animal, (byte) 18);
+ if (this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
+- this.level
+- .addFreshEntity(
+- new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), this.animal.getRandom().nextInt(7) + 1)
+- );
++ // CraftBukkit start - use event experience
++ if (experience > 0) {
++ this.level.addFreshEntity(new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), experience));
++ }
++ // CraftBukkit end
+ }
+ }
+ }
+@@ -1203,16 +1299,34 @@
+ }
+ }
+
+- if (target != null && Fox.this.distanceTo(target) <= 2.0F) {
+- Fox.this.doHurtTarget(target);
+- } else if (Fox.this.getXRot() > 0.0F
+- && Fox.this.onGround()
+- && (float)Fox.this.getDeltaMovement().y != 0.0F
+- && Fox.this.level().getBlockState(Fox.this.blockPosition()).is(Blocks.SNOW)) {
+- Fox.this.setXRot(60.0F);
+- Fox.this.setTarget(null);
+- Fox.this.setFaceplanted(true);
++ private void pickGlowBerry(IBlockData state) {
++ CaveVines.use(Fox.this, state, Fox.this.level(), this.blockPos);
++ }
++
++ private void pickSweetBerries(IBlockData state) {
++ int i = (Integer) state.getValue(SweetBerryBushBlock.AGE);
++
++ state.setValue(SweetBerryBushBlock.AGE, 1);
++ // CraftBukkit start - call EntityChangeBlockEvent
++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(Fox.this, this.blockPos, state.setValue(SweetBerryBushBlock.AGE, 1))) {
++ return;
+ }
++ // CraftBukkit end
++ int j = 1 + Fox.this.level().random.nextInt(2) + (i == 3 ? 1 : 0);
++ ItemStack itemstack = Fox.this.getItemBySlot(EquipmentSlot.MAINHAND);
++
++ if (itemstack.isEmpty()) {
++ Fox.this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(Items.SWEET_BERRIES));
++ --j;
++ }
++
++ if (j > 0) {
++ Block.popResource(Fox.this.level(), this.blockPos, new ItemStack(Items.SWEET_BERRIES, j));
++ }
++
++ Fox.this.playSound(SoundEvents.SWEET_BERRY_BUSH_PICK_BERRIES, 1.0F, 1.0F);
++ Fox.this.level().setBlock(this.blockPos, (IBlockData) state.setValue(SweetBerryBushBlock.AGE, 1), 2);
++ Fox.this.level().gameEvent(GameEvent.BLOCK_CHANGE, this.blockPos, GameEvent.Context.of((Entity) Fox.this));
+ }
+ }
+