规范命名ContainerMobileEntity
This commit is contained in:
parent
4fd964a1c1
commit
42954d80cb
6 changed files with 12 additions and 12 deletions
|
@ -60,7 +60,7 @@ import java.util.List;
|
||||||
|
|
||||||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
||||||
|
|
||||||
public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHelicopterEntity, MultiWeaponVehicleEntity {
|
public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity, IHelicopterEntity, MultiWeaponVehicleEntity {
|
||||||
|
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
public static final float MAX_HEALTH = VehicleConfig.AH_6_HP.get();
|
public static final float MAX_HEALTH = VehicleConfig.AH_6_HP.get();
|
||||||
|
|
|
@ -63,7 +63,7 @@ import java.util.List;
|
||||||
|
|
||||||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
||||||
|
|
||||||
public class Bmp2Entity extends ContainerMobileEntity implements GeoEntity, ILandArmorEntity, MultiWeaponVehicleEntity {
|
public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntity, ILandArmorEntity, MultiWeaponVehicleEntity {
|
||||||
|
|
||||||
public static final EntityDataAccessor<Integer> FIRE_ANIM = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> FIRE_ANIM = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.INT);
|
||||||
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.FLOAT);
|
||||||
|
|
|
@ -26,14 +26,14 @@ import net.minecraftforge.items.wrapper.InvWrapper;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.joml.Math;
|
import org.joml.Math;
|
||||||
|
|
||||||
public class ContainerMobileEntity extends MobileVehicleEntity implements HasCustomInventoryScreen, ContainerEntity {
|
public class ContainerMobileVehicleEntity extends MobileVehicleEntity implements HasCustomInventoryScreen, ContainerEntity {
|
||||||
|
|
||||||
public static final int CONTAINER_SIZE = 102;
|
public static final int CONTAINER_SIZE = 102;
|
||||||
|
|
||||||
private NonNullList<ItemStack> items = NonNullList.withSize(CONTAINER_SIZE, ItemStack.EMPTY);
|
private NonNullList<ItemStack> items = NonNullList.withSize(CONTAINER_SIZE, ItemStack.EMPTY);
|
||||||
private LazyOptional<?> itemHandler = LazyOptional.of(() -> new InvWrapper(this));
|
private LazyOptional<?> itemHandler = LazyOptional.of(() -> new InvWrapper(this));
|
||||||
|
|
||||||
public ContainerMobileEntity(EntityType<?> pEntityType, Level pLevel) {
|
public ContainerMobileVehicleEntity(EntityType<?> pEntityType, Level pLevel) {
|
||||||
super(pEntityType, pLevel);
|
super(pEntityType, pLevel);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ import java.util.List;
|
||||||
|
|
||||||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
||||||
|
|
||||||
public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, ILandArmorEntity, MultiWeaponVehicleEntity {
|
public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEntity, ILandArmorEntity, MultiWeaponVehicleEntity {
|
||||||
|
|
||||||
public static final EntityDataAccessor<Integer> FIRE_ANIM = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> FIRE_ANIM = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
|
||||||
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.FLOAT);
|
||||||
|
|
|
@ -52,7 +52,7 @@ import java.util.List;
|
||||||
|
|
||||||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
||||||
|
|
||||||
public class SpeedboatEntity extends ContainerMobileEntity implements GeoEntity, IArmedVehicleEntity {
|
public class SpeedboatEntity extends ContainerMobileVehicleEntity implements GeoEntity, IArmedVehicleEntity {
|
||||||
|
|
||||||
public static final EntityDataAccessor<Integer> FIRE_ANIM = SynchedEntityData.defineId(SpeedboatEntity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> FIRE_ANIM = SynchedEntityData.defineId(SpeedboatEntity.class, EntityDataSerializers.INT);
|
||||||
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(SpeedboatEntity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(SpeedboatEntity.class, EntityDataSerializers.FLOAT);
|
||||||
|
|
|
@ -7,7 +7,7 @@ import com.atsuishio.superbwarfare.config.common.GameplayConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.ICustomKnockback;
|
import com.atsuishio.superbwarfare.entity.ICustomKnockback;
|
||||||
import com.atsuishio.superbwarfare.entity.TargetEntity;
|
import com.atsuishio.superbwarfare.entity.TargetEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.ContainerMobileEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.ContainerMobileVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
|
@ -736,10 +736,10 @@ public class LivingEventHandler {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onPickup(EntityItemPickupEvent event) {
|
public static void onPickup(EntityItemPickupEvent event) {
|
||||||
if (event.getEntity().getVehicle() instanceof ContainerMobileEntity containerMobileEntity) {
|
if (event.getEntity().getVehicle() instanceof ContainerMobileVehicleEntity containerMobileVehicleEntity) {
|
||||||
var pickUp = event.getItem();
|
var pickUp = event.getItem();
|
||||||
if (!containerMobileEntity.level().isClientSide) {
|
if (!containerMobileVehicleEntity.level().isClientSide) {
|
||||||
HopperBlockEntity.addItem(containerMobileEntity, pickUp);
|
HopperBlockEntity.addItem(containerMobileVehicleEntity, pickUp);
|
||||||
}
|
}
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
|
@ -753,11 +753,11 @@ public class LivingEventHandler {
|
||||||
if (!(sourceEntity instanceof Player player)) return;
|
if (!(sourceEntity instanceof Player player)) return;
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
|
|
||||||
if (player.getVehicle() instanceof ContainerMobileEntity containerMobileEntity && source.is(ModDamageTypes.VEHICLE_STRIKE)) {
|
if (player.getVehicle() instanceof ContainerMobileVehicleEntity containerMobileVehicleEntity && source.is(ModDamageTypes.VEHICLE_STRIKE)) {
|
||||||
var drops = event.getDrops();
|
var drops = event.getDrops();
|
||||||
drops.forEach(itemEntity -> {
|
drops.forEach(itemEntity -> {
|
||||||
ItemStack item = itemEntity.getItem();
|
ItemStack item = itemEntity.getItem();
|
||||||
if (!HopperBlockEntity.addItem(containerMobileEntity, itemEntity)) {
|
if (!HopperBlockEntity.addItem(containerMobileVehicleEntity, itemEntity)) {
|
||||||
player.drop(item, false);
|
player.drop(item, false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue