允许发射器发射70mm火箭弹
This commit is contained in:
parent
53748fad73
commit
b5b658027d
3 changed files with 43 additions and 2 deletions
|
@ -44,6 +44,11 @@ public class HeliRocketEntity extends FastThrowableProjectile implements GeoEnti
|
|||
this.noCulling = true;
|
||||
}
|
||||
|
||||
public HeliRocketEntity(EntityType<? extends ThrowableItemProjectile> pEntityType, double pX, double pY, double pZ, Level pLevel) {
|
||||
super(pEntityType, pX, pY, pZ, pLevel);
|
||||
this.noCulling = true;
|
||||
}
|
||||
|
||||
public HeliRocketEntity(LivingEntity entity, Level level, float damage, float explosionDamage, float explosionRadius) {
|
||||
super(ModEntities.HELI_ROCKET.get(), entity, level);
|
||||
this.damage = damage;
|
||||
|
@ -145,7 +150,7 @@ public class HeliRocketEntity extends FastThrowableProjectile implements GeoEnti
|
|||
|
||||
@Override
|
||||
protected double getDefaultGravity() {
|
||||
return 0.002f;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -116,7 +116,7 @@ public class ModItems {
|
|||
public static final DeferredHolder<Item, ClaymoreMine> CLAYMORE_MINE = AMMO.register("claymore_mine", ClaymoreMine::new);
|
||||
public static final DeferredHolder<Item, C4Bomb> C4_BOMB = AMMO.register("c4_bomb", C4Bomb::new);
|
||||
public static final DeferredHolder<Item, Item> SMALL_SHELL = AMMO.register("small_shell", SmallShellItem::new);
|
||||
public static final DeferredHolder<Item, Item> ROCKET_70 = AMMO.register("rocket_70", () -> new Item(new Item.Properties()));
|
||||
public static final DeferredHolder<Item, Item> ROCKET_70 = AMMO.register("rocket_70", Rocket70::new);
|
||||
public static final DeferredHolder<Item, Item> WIRE_GUIDE_MISSILE = AMMO.register("wire_guide_missile", () -> new Item(new Item.Properties()));
|
||||
public static final DeferredHolder<Item, Item> SWARM_DRONE = AMMO.register("swarm_drone", () -> new Item(new Item.Properties()));
|
||||
public static final DeferredHolder<Item, BeamTest> BEAM_TEST = AMMO.register("beam_test", BeamTest::new);
|
||||
|
|
36
src/main/java/com/atsuishio/superbwarfare/item/Rocket70.java
Normal file
36
src/main/java/com/atsuishio/superbwarfare/item/Rocket70.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
package com.atsuishio.superbwarfare.item;
|
||||
|
||||
import com.atsuishio.superbwarfare.entity.projectile.HeliRocketEntity;
|
||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Position;
|
||||
import net.minecraft.world.entity.projectile.Projectile;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.ProjectileItem;
|
||||
import net.minecraft.world.level.Level;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
public class Rocket70 extends Item implements ProjectileItem {
|
||||
|
||||
public Rocket70() {
|
||||
super(new Properties());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ParametersAreNonnullByDefault
|
||||
public @NotNull Projectile asProjectile(Level level, Position pos, ItemStack stack, Direction direction) {
|
||||
return new HeliRocketEntity(ModEntities.HELI_ROCKET.get(), pos.x(), pos.y(), pos.z(), level);
|
||||
}
|
||||
|
||||
// TODO 发射音效
|
||||
@Override
|
||||
public @NotNull DispenseConfig createDispenseConfig() {
|
||||
return DispenseConfig.builder()
|
||||
.uncertainty(1)
|
||||
.power(4)
|
||||
.build();
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue