添加63的上弹功能
This commit is contained in:
parent
889d0d67e7
commit
94a0e76973
3 changed files with 97 additions and 9 deletions
|
@ -77,6 +77,8 @@ public class ModItemTagProvider extends ItemTagsProvider {
|
|||
|
||||
this.tag(cTag("tools/crowbar")).add(ModItems.CROWBAR.get());
|
||||
|
||||
this.tag(ModTags.Items.MEDIUM_ROCKET).add(ModItems.MEDIUM_ROCKET_AP.get(), ModItems.MEDIUM_ROCKET_HE.get(), ModItems.MEDIUM_ROCKET_CM.get());
|
||||
|
||||
// TODO 清理枪械Tag
|
||||
ModItems.GUNS.getEntries().forEach(registryObject -> this.tag(ModTags.Items.GUN).add(registryObject.get()));
|
||||
|
||||
|
|
|
@ -4,10 +4,7 @@ import com.atsuishio.superbwarfare.Mod;
|
|||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||
import com.atsuishio.superbwarfare.entity.OBBEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||
import com.atsuishio.superbwarfare.init.ModSerializers;
|
||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||
import com.atsuishio.superbwarfare.init.ModTags;
|
||||
import com.atsuishio.superbwarfare.init.*;
|
||||
import com.atsuishio.superbwarfare.item.common.container.ContainerBlockItem;
|
||||
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
||||
import com.atsuishio.superbwarfare.tools.OBB;
|
||||
|
@ -77,6 +74,11 @@ public class Type63Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
|||
|
||||
public Type63Entity(EntityType<Type63Entity> type, Level world) {
|
||||
super(type, world);
|
||||
this.wheel1 = new OBB(this.position().toVector3f(), new Vector3f(0.125f, 0.390625f, 0.390625f), new Quaternionf(), OBB.Part.WHEEL_LEFT);
|
||||
this.wheel2 = new OBB(this.position().toVector3f(), new Vector3f(0.125f, 0.390625f, 0.390625f), new Quaternionf(), OBB.Part.WHEEL_RIGHT);
|
||||
this.body1 = new OBB(this.position().toVector3f(), new Vector3f(0.4765625f, 0.3515625f, 0.7578125f), new Quaternionf(), OBB.Part.BODY);
|
||||
this.body2 = new OBB(this.position().toVector3f(), new Vector3f(0.771875f, 0.109375f, 0.296875f), new Quaternionf(), OBB.Part.BODY);
|
||||
|
||||
this.barrel0 = new OBB(this.position().toVector3f(), new Vector3f(0.09375f, 0.09375f, 0.0625f), new Quaternionf(), OBB.Part.INTERACTIVE);
|
||||
this.barrel1 = new OBB(this.position().toVector3f(), new Vector3f(0.09375f, 0.09375f, 0.0625f), new Quaternionf(), OBB.Part.INTERACTIVE);
|
||||
this.barrel2 = new OBB(this.position().toVector3f(), new Vector3f(0.09375f, 0.09375f, 0.0625f), new Quaternionf(), OBB.Part.INTERACTIVE);
|
||||
|
@ -93,11 +95,6 @@ public class Type63Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
|||
this.yawController = new OBB(this.position().toVector3f(), new Vector3f(0.125f, 0.125f, 0.125f), new Quaternionf(), OBB.Part.INTERACTIVE);
|
||||
this.hoe1 = new OBB(this.position().toVector3f(), new Vector3f(0.125f, 0.125f, 0.875f), new Quaternionf(), OBB.Part.INTERACTIVE);
|
||||
this.hoe2 = new OBB(this.position().toVector3f(), new Vector3f(0.125f, 0.125f, 0.875f), new Quaternionf(), OBB.Part.INTERACTIVE);
|
||||
|
||||
this.wheel1 = new OBB(this.position().toVector3f(), new Vector3f(0.125f, 0.390625f, 0.390625f), new Quaternionf(), OBB.Part.WHEEL_LEFT);
|
||||
this.wheel2 = new OBB(this.position().toVector3f(), new Vector3f(0.125f, 0.390625f, 0.390625f), new Quaternionf(), OBB.Part.WHEEL_RIGHT);
|
||||
this.body1 = new OBB(this.position().toVector3f(), new Vector3f(0.4765625f, 0.3515625f, 0.7578125f), new Quaternionf(), OBB.Part.BODY);
|
||||
this.body2 = new OBB(this.position().toVector3f(), new Vector3f(0.771875f, 0.109375f, 0.296875f), new Quaternionf(), OBB.Part.BODY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -164,6 +161,94 @@ public class Type63Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
|||
}
|
||||
}
|
||||
|
||||
if (stack.is(ModItems.MEDIUM_ROCKET_AP.get()) || stack.is(ModItems.MEDIUM_ROCKET_HE.get()) || stack.is(ModItems.MEDIUM_ROCKET_CM.get())) {
|
||||
if (OBB.getLookingObb(player, player.entityInteractionRange()) == this.barrel3 && items.get(0).isEmpty()) {
|
||||
this.setItem(0, stack.copyWithCount(1));
|
||||
if (!player.isCreative()) {
|
||||
stack.shrink(1);
|
||||
}
|
||||
player.swing(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
if (OBB.getLookingObb(player, player.entityInteractionRange()) == this.barrel2 && items.get(1).isEmpty()) {
|
||||
this.setItem(1, stack.copyWithCount(1));
|
||||
if (!player.isCreative()) {
|
||||
stack.shrink(1);
|
||||
}
|
||||
player.swing(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
if (OBB.getLookingObb(player, player.entityInteractionRange()) == this.barrel1 && items.get(2).isEmpty()) {
|
||||
this.setItem(2, stack.copyWithCount(1));
|
||||
if (!player.isCreative()) {
|
||||
stack.shrink(1);
|
||||
}
|
||||
player.swing(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
if (OBB.getLookingObb(player, player.entityInteractionRange()) == this.barrel0 && items.get(3).isEmpty()) {
|
||||
this.setItem(3, stack.copyWithCount(1));
|
||||
if (!player.isCreative()) {
|
||||
stack.shrink(1);
|
||||
}
|
||||
player.swing(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
if (OBB.getLookingObb(player, player.entityInteractionRange()) == this.barrel4 && items.get(4).isEmpty()) {
|
||||
this.setItem(4, stack.copyWithCount(1));
|
||||
if (!player.isCreative()) {
|
||||
stack.shrink(1);
|
||||
}
|
||||
player.swing(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
if (OBB.getLookingObb(player, player.entityInteractionRange()) == this.barrel5 && items.get(5).isEmpty()) {
|
||||
this.setItem(5, stack.copyWithCount(1));
|
||||
if (!player.isCreative()) {
|
||||
stack.shrink(1);
|
||||
}
|
||||
player.swing(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
if (OBB.getLookingObb(player, player.entityInteractionRange()) == this.barrel6 && items.get(6).isEmpty()) {
|
||||
this.setItem(6, stack.copyWithCount(1));
|
||||
if (!player.isCreative()) {
|
||||
stack.shrink(1);
|
||||
}
|
||||
player.swing(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
if (OBB.getLookingObb(player, player.entityInteractionRange()) == this.barrel7 && items.get(7).isEmpty()) {
|
||||
this.setItem(7, stack.copyWithCount(1));
|
||||
if (!player.isCreative()) {
|
||||
stack.shrink(1);
|
||||
}
|
||||
player.swing(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
if (OBB.getLookingObb(player, player.entityInteractionRange()) == this.barrel11 && items.get(8).isEmpty()) {
|
||||
this.setItem(8, stack.copyWithCount(1));
|
||||
if (!player.isCreative()) {
|
||||
stack.shrink(1);
|
||||
}
|
||||
player.swing(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
if (OBB.getLookingObb(player, player.entityInteractionRange()) == this.barrel10 && items.get(9).isEmpty()) {
|
||||
this.setItem(9, stack.copyWithCount(1));
|
||||
if (!player.isCreative()) {
|
||||
stack.shrink(1);
|
||||
}
|
||||
player.swing(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
if (OBB.getLookingObb(player, player.entityInteractionRange()) == this.barrel9 && items.get(10).isEmpty()) {
|
||||
this.setItem(10, stack.copyWithCount(10));
|
||||
if (!player.isCreative()) {
|
||||
stack.shrink(1);
|
||||
}
|
||||
player.swing(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
if (OBB.getLookingObb(player, player.entityInteractionRange()) == this.barrel8 && items.get(11).isEmpty()) {
|
||||
this.setItem(11, stack.copyWithCount(11));
|
||||
if (!player.isCreative()) {
|
||||
stack.shrink(1);
|
||||
}
|
||||
player.swing(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
setChanged();
|
||||
}
|
||||
|
||||
if (player.isShiftKeyDown() && stack.is(ModTags.Items.CROWBAR) && this.getPassengers().isEmpty()) {
|
||||
ItemStack container = ContainerBlockItem.createInstance(this);
|
||||
if (!player.addItem(container)) {
|
||||
|
|
|
@ -42,6 +42,7 @@ public class ModTags {
|
|||
public static final TagKey<Item> EPIC_BLUEPRINT = tag("blueprint/epic");
|
||||
public static final TagKey<Item> LEGENDARY_BLUEPRINT = tag("blueprint/legendary");
|
||||
public static final TagKey<Item> CANNON_BLUEPRINT = tag("blueprint/cannon");
|
||||
public static final TagKey<Item> MEDIUM_ROCKET = tag("medium_rocket");
|
||||
|
||||
public static final TagKey<Item> WRENCHES = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "wrenches"));
|
||||
public static final TagKey<Item> WRENCH = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "tools/wrench"));
|
||||
|
|
Loading…
Add table
Reference in a new issue