Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ModItemEntity extends ProjectileItemEntity {
- private ItemStack currentItem = new ItemStack(getDefaultItem(), 1);
- private int tickCount = 0;
- private boolean tickCheck = true;
- public ModItemEntity(EntityType<? extends ModItemEntity> type, World worldIn) {
- super(type, worldIn);
- }
- public ModItemEntity(LivingEntity livingEntityIn, World worldIn, ItemStack stack) {
- super(ModEntities.MOD_ITEM, livingEntityIn, worldIn);
- this.currentItem = stack;
- this.setItem(stack);
- }
- @Override
- protected Item getDefaultItem() { return ModItems.MOD_ITEM; }
- private void updateTag(int offset) {
- ModItem.setTag(this.currentItem, ModItem.LAYER_KEY, offset);
- }
- @Override
- public IPacket<?> createSpawnPacket() {
- return NetworkHooks.getEntitySpawningPacket(this);
- }
- @Override
- public void tick() {
- if (this.tickCheck) {
- if (this.tickCount == 5) {
- this.setVelocity(0, 0, 0);
- this.velocityChanged = true;
- this.setNoGravity(true);
- } else if (this.tickCount == 20) {
- updateTag(8);
- } else if (this.tickCount == 40) {
- updateTag(-8);
- this.tickCheck = false;
- }
- this.tickCount++;
- }
- super.tick();
- }
- }
Add Comment
Please, Sign In to add comment