Feathers will now float gently to the ground when dropped

This commit is contained in:
Sollace 2021-02-28 12:12:46 +02:00
parent f067e67eca
commit 18393d104d
3 changed files with 31 additions and 2 deletions

View file

@ -14,6 +14,8 @@ public interface UTags {
Tag<Item> FAIRLY_TOXIC = item("fairly_toxic");
Tag<Item> SEVERELY_TOXIC = item("severely_toxic");
Tag<Item> FALLS_SLOWLY = item("falls_slowly");
Tag<Block> FRAGILE = block("fragile");
Tag<Block> INTERESTING = block("interesting");

View file

@ -4,10 +4,12 @@ import java.util.Random;
import com.minelittlepony.unicopia.Owned;
import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.UTags;
import com.minelittlepony.unicopia.item.enchantment.UEnchantments;
import com.minelittlepony.unicopia.util.VecHelper;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.MovementType;
import net.minecraft.entity.data.DataTracker;
@ -51,14 +53,13 @@ public class ItemImpl implements Equine<ItemEntity>, Owned<ItemEntity> {
}
ItemStack stack = owner.getStack();
IItemEntity i = (IItemEntity)owner;
if (!stack.isEmpty()) {
Item item = stack.getItem();
ClingyItem clingy = item instanceof ClingyItem ? (ClingyItem)item : ClingyItem.DEFAULT;
IItemEntity i = (IItemEntity)owner;
if (clingy.isClingy(stack)) {
Random rng = owner.world.random;
@ -84,6 +85,24 @@ public class ItemImpl implements Equine<ItemEntity>, Owned<ItemEntity> {
});
}
if (stack.getItem().isIn(UTags.FALLS_SLOWLY)) {
if (!owner.isOnGround()) {
double ticks = ((Entity)owner).age;
double shift = Math.sin(ticks / 9D) / 9D;
double rise = Math.cos(ticks / 9D) * getPhysics().getGravitySignum();
owner.prevYaw = owner.prevYaw;
owner.yaw += 0.3F;
owner.setVelocity(
owner.getVelocity()
.multiply(0.25, 0, 0.25)
.add(0, rise, 0)
.add(owner.getRotationVec(1)).normalize().multiply(shift)
);
}
}
if (stack.getItem() instanceof TickableItem) {
return ((TickableItem)stack.getItem()).onGroundTick(i) == ActionResult.SUCCESS;
}

View file

@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"minecraft:feather",
"unicopia:pegasus_feather",
"unicopia:gryphon_feather"
]
}