mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Fixed particle effect and added a sound effect when apples rot
This commit is contained in:
parent
8e89edfb35
commit
24cd6a9a3b
1 changed files with 12 additions and 10 deletions
|
@ -13,6 +13,7 @@ import net.minecraft.entity.ItemEntity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.particle.ParticleTypes;
|
import net.minecraft.particle.ParticleTypes;
|
||||||
|
import net.minecraft.sound.SoundEvents;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
@ -28,7 +29,7 @@ public class AppleItem extends Item implements ItemImpl.TickableItem {
|
||||||
public ActionResult onGroundTick(IItemEntity item) {
|
public ActionResult onGroundTick(IItemEntity item) {
|
||||||
ItemEntity entity = item.get().getMaster();
|
ItemEntity entity = item.get().getMaster();
|
||||||
|
|
||||||
if (!entity.removed && item.getPickupDelay() == 0 && item.getAge() > 200230 && entity.world.random.nextInt(200) < 10) {
|
if (!entity.removed && item.getPickupDelay() == 0 && item.getAge() > 2030 && entity.world.random.nextInt(150) < 10) {
|
||||||
|
|
||||||
if (!entity.world.isClient) {
|
if (!entity.world.isClient) {
|
||||||
entity.remove();
|
entity.remove();
|
||||||
|
@ -45,7 +46,8 @@ public class AppleItem extends Item implements ItemImpl.TickableItem {
|
||||||
copy.getStack().decrement(1);
|
copy.getStack().decrement(1);
|
||||||
|
|
||||||
entity.world.spawnEntity(copy);
|
entity.world.spawnEntity(copy);
|
||||||
} else {
|
}
|
||||||
|
|
||||||
float bob = MathHelper.sin(((float)item.getAge() + 1) / 10F + entity.hoverHeight) * 0.1F + 0.1F;
|
float bob = MathHelper.sin(((float)item.getAge() + 1) / 10F + entity.hoverHeight) * 0.1F + 0.1F;
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
|
@ -54,7 +56,7 @@ public class AppleItem extends Item implements ItemImpl.TickableItem {
|
||||||
entity.world.random.nextGaussian() - 0.5F,
|
entity.world.random.nextGaussian() - 0.5F,
|
||||||
entity.world.random.nextGaussian() - 0.5F);
|
entity.world.random.nextGaussian() - 0.5F);
|
||||||
}
|
}
|
||||||
}
|
entity.playSound(SoundEvents.ENTITY_ZOMBIE_DESTROY_EGG, 0.5F, 1.5F);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ActionResult.PASS;
|
return ActionResult.PASS;
|
||||||
|
|
Loading…
Reference in a new issue