mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Feathers will now float gently to the ground when dropped
This commit is contained in:
parent
f067e67eca
commit
18393d104d
3 changed files with 31 additions and 2 deletions
|
@ -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");
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:feather",
|
||||
"unicopia:pegasus_feather",
|
||||
"unicopia:gryphon_feather"
|
||||
]
|
||||
}
|
Loading…
Reference in a new issue