-
Notifications
You must be signed in to change notification settings - Fork 169
Expand file tree
/
Copy pathEntityItemProjectile.java
More file actions
54 lines (45 loc) · 1.48 KB
/
EntityItemProjectile.java
File metadata and controls
54 lines (45 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package openblocks.common.entity;
import javax.annotation.Nonnull;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.MoverType;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.util.datafix.DataFixer;
import net.minecraft.util.datafix.FixTypes;
import net.minecraft.util.datafix.walkers.ItemStackData;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
/**
* Ugly EntityItem holder thingy with no air resistance. Because physics is hard
* enough as it is
*
*/
public class EntityItemProjectile extends EntityItem {
public EntityItemProjectile(World world, double x, double y, double z) {
super(world, x, y, z);
}
public EntityItemProjectile(World world, double x, double y, double z, @Nonnull ItemStack stack) {
super(world, x, y, z, stack);
}
public EntityItemProjectile(World world) {
super(world);
}
public static void registerFixes(DataFixer fixer) {
fixer.registerWalker(FixTypes.ENTITY, new ItemStackData(EntityItemProjectile.class, "Item"));
}
@Override
public void onUpdate() {
// let vanilla run
super.onUpdate();
// Remove the air drag that EntityItem.onUpdate adds to our velocity
if (!this.onGround) {
double f = 0.98F;
this.motionX = this.motionX / f;
this.motionY = this.motionY / f;
this.motionZ = this.motionZ / f;
}
}
}