添加大型螺旋桨,火箭弹,直升机的配方。修复交互bug
This commit is contained in:
parent
080f7ed625
commit
926298a1bf
19 changed files with 192 additions and 37 deletions
|
@ -1,4 +1,4 @@
|
|||
// 1.20.1 2025-01-07T02:18:22.6361822 Item Models: superbwarfare
|
||||
// 1.20.1 2025-01-07T03:38:49.7324927 Item Models: superbwarfare
|
||||
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/aa_12_blueprint.json
|
||||
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/ak_12_blueprint.json
|
||||
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/ak_47_blueprint.json
|
||||
|
@ -47,6 +47,7 @@ e04bbd61e716fc5d53c9425aba508fc3287bfd57 assets/superbwarfare/models/item/iron_p
|
|||
195c1b7cbcce9b0ac42ecbfc21a8cafff8c78372 assets/superbwarfare/models/item/jump_pad.json
|
||||
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/k_98_blueprint.json
|
||||
4c9b6c2911ae5e6e2a026d2ae9d3c0564cdba0b3 assets/superbwarfare/models/item/large_motor.json
|
||||
95c0f92c4a4b3adff9c95878540071b04a921792 assets/superbwarfare/models/item/large_propeller.json
|
||||
ce9e4fd8ea92cfdbdda158776c1b6e1b482a3f2a assets/superbwarfare/models/item/lead_ingot.json
|
||||
f66c351b4843ad4d4e086ccfb7d4d0221227d196 assets/superbwarfare/models/item/legendary_material_pack.json
|
||||
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/m2hb_blueprint.json
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "superbwarfare:item/large_propeller"
|
||||
}
|
||||
}
|
|
@ -28,6 +28,7 @@ public class ModItemModelProvider extends ItemModelProvider {
|
|||
// misc
|
||||
simpleItem(ModItems.ANCIENT_CPU);
|
||||
simpleItem(ModItems.PROPELLER);
|
||||
simpleItem(ModItems.LARGE_PROPELLER);
|
||||
simpleItem(ModItems.MOTOR);
|
||||
simpleItem(ModItems.LARGE_MOTOR);
|
||||
simpleItem(ModItems.DRONE);
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
package com.atsuishio.superbwarfare.entity.vehicle;
|
||||
|
||||
import com.atsuishio.superbwarfare.init.ModItems;
|
||||
import com.atsuishio.superbwarfare.item.ContainerBlockItem;
|
||||
import com.atsuishio.superbwarfare.menu.VehicleMenu;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.world.ContainerHelper;
|
||||
import net.minecraft.world.Containers;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.HasCustomInventoryScreen;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
|
@ -16,6 +20,7 @@ import net.minecraft.world.entity.player.Player;
|
|||
import net.minecraft.world.entity.vehicle.ContainerEntity;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.entity.HopperBlockEntity;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
|
@ -25,6 +30,7 @@ import net.minecraftforge.common.util.LazyOptional;
|
|||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
import net.minecraftforge.items.wrapper.InvWrapper;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.joml.Math;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -56,6 +62,47 @@ public class ContainerMobileEntity extends MobileVehicleEntity implements HasCus
|
|||
ContainerHelper.loadAllItems(compound, this.getItemStacks());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResult interact(Player player, InteractionHand hand) {
|
||||
if (player.getVehicle() == this) return InteractionResult.PASS;
|
||||
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
if (player.isShiftKeyDown() && stack.is(ModItems.CROWBAR.get())) {
|
||||
ItemStack container = ContainerBlockItem.createInstance(this);
|
||||
if (!player.addItem(container)) {
|
||||
player.drop(container, false);
|
||||
}
|
||||
this.remove(RemovalReason.DISCARDED);
|
||||
this.discard();
|
||||
return InteractionResult.SUCCESS;
|
||||
} else if (player.isShiftKeyDown()) {
|
||||
player.openMenu(this);
|
||||
return !player.level().isClientSide ? InteractionResult.CONSUME : InteractionResult.SUCCESS;
|
||||
} else if (this.getHealth() < this.getMaxHealth() && stack.is(Items.IRON_INGOT)) {
|
||||
this.heal(Math.min(50, this.getMaxHealth()));
|
||||
stack.shrink(1);
|
||||
if (!this.level().isClientSide) {
|
||||
this.level().playSound(null, this, SoundEvents.IRON_GOLEM_REPAIR, this.getSoundSource(), 0.5f, 1);
|
||||
}
|
||||
return InteractionResult.SUCCESS;
|
||||
} else if (!player.isShiftKeyDown()) {
|
||||
if (this.getFirstPassenger() == null) {
|
||||
player.setXRot(this.getXRot());
|
||||
player.setYRot(this.getYRot());
|
||||
return player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS;
|
||||
} else if (!(this.getFirstPassenger() instanceof Player)) {
|
||||
this.getFirstPassenger().stopRiding();
|
||||
player.setXRot(this.getXRot());
|
||||
player.setYRot(this.getYRot());
|
||||
return player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS;
|
||||
}
|
||||
if (this.getPassengers().size() < this.getMaxPassengers()) {
|
||||
return player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS;
|
||||
}
|
||||
}
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(RemovalReason pReason) {
|
||||
if (!this.level().isClientSide && pReason != RemovalReason.DISCARDED) {
|
||||
|
|
|
@ -96,7 +96,7 @@ public class VehicleEntity extends Entity {
|
|||
public InteractionResult interact(Player player, InteractionHand hand) {
|
||||
if (player.getVehicle() == this) return InteractionResult.PASS;
|
||||
|
||||
ItemStack stack = player.getItemInHand(hand);
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
if (player.isShiftKeyDown() && stack.is(ModItems.CROWBAR.get())) {
|
||||
ItemStack container = ContainerBlockItem.createInstance(this);
|
||||
if (!player.addItem(container)) {
|
||||
|
@ -104,29 +104,15 @@ public class VehicleEntity extends Entity {
|
|||
}
|
||||
this.remove(RemovalReason.DISCARDED);
|
||||
this.discard();
|
||||
} else if (stack.is(Items.IRON_INGOT)) {
|
||||
if (this.getHealth() < this.getMaxHealth()) {
|
||||
this.heal(Math.min(50, this.getMaxHealth()));
|
||||
stack.shrink(1);
|
||||
if (!this.level().isClientSide) {
|
||||
this.level().playSound(null, this, SoundEvents.IRON_GOLEM_REPAIR, this.getSoundSource(), 0.5f, 1);
|
||||
}
|
||||
} else if (!this.level().isClientSide) {
|
||||
if (this.getFirstPassenger() == null) {
|
||||
player.setXRot(this.getXRot());
|
||||
player.setYRot(this.getYRot());
|
||||
return player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS;
|
||||
} else if (!(this.getFirstPassenger() instanceof Player)) {
|
||||
this.getFirstPassenger().stopRiding();
|
||||
player.setXRot(this.getXRot());
|
||||
player.setYRot(this.getYRot());
|
||||
return player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS;
|
||||
}
|
||||
if (this.getPassengers().size() < this.getMaxPassengers()) {
|
||||
return player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS;
|
||||
}
|
||||
return InteractionResult.SUCCESS;
|
||||
} else if (this.getHealth() < this.getMaxHealth() && stack.is(Items.IRON_INGOT)) {
|
||||
this.heal(Math.min(50, this.getMaxHealth()));
|
||||
stack.shrink(1);
|
||||
if (!this.level().isClientSide) {
|
||||
this.level().playSound(null, this, SoundEvents.IRON_GOLEM_REPAIR, this.getSoundSource(), 0.5f, 1);
|
||||
}
|
||||
} else if (!this.level().isClientSide) {
|
||||
return InteractionResult.SUCCESS;
|
||||
} else if (!player.isShiftKeyDown()) {
|
||||
if (this.getFirstPassenger() == null) {
|
||||
player.setXRot(this.getXRot());
|
||||
player.setYRot(this.getYRot());
|
||||
|
|
|
@ -44,6 +44,7 @@ import net.minecraft.world.item.ItemStack;
|
|||
import net.minecraft.world.level.GameRules;
|
||||
import net.minecraft.world.level.block.entity.HopperBlockEntity;
|
||||
import net.minecraftforge.event.entity.living.*;
|
||||
import net.minecraftforge.event.level.ExplosionEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.network.PacketDistributor;
|
||||
|
@ -54,6 +55,13 @@ import java.util.Objects;
|
|||
@Mod.EventBusSubscriber
|
||||
public class LivingEventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onExplode(ExplosionEvent.Detonate event) {
|
||||
event.getExplosion().clearToBlow();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onEntityAttacked(LivingAttackEvent event) {
|
||||
if (event.getEntity().getVehicle() != null && event.getEntity().getVehicle() instanceof ICannonEntity) {
|
||||
|
|
|
@ -119,6 +119,7 @@ public class ModItems {
|
|||
public static final RegistryObject<Item> SENPAI_SPAWN_EGG = ITEMS.register("senpai_spawn_egg", () -> new ForgeSpawnEggItem(ModEntities.SENPAI, -11584987, -14014413, new Item.Properties()));
|
||||
public static final RegistryObject<Item> ANCIENT_CPU = ITEMS.register("ancient_cpu", () -> new Item(new Item.Properties().rarity(Rarity.RARE)));
|
||||
public static final RegistryObject<Item> PROPELLER = ITEMS.register("propeller", () -> new Item(new Item.Properties()));
|
||||
public static final RegistryObject<Item> LARGE_PROPELLER = ITEMS.register("large_propeller", () -> new Item(new Item.Properties()));
|
||||
public static final RegistryObject<Item> MOTOR = ITEMS.register("motor", () -> new Item(new Item.Properties()));
|
||||
public static final RegistryObject<Item> LARGE_MOTOR = ITEMS.register("large_motor", () -> new Item(new Item.Properties()));
|
||||
public static final RegistryObject<Item> DRONE = ITEMS.register("drone", Drone::new);
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.atsuishio.superbwarfare.tools;
|
|||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||
import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity;
|
||||
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
||||
import com.google.common.collect.Sets;
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
@ -201,8 +202,11 @@ public class CustomExplosion extends Explosion {
|
|||
zDistance *= d11;
|
||||
|
||||
Vec3 knockbackVec = new Vec3(0.2 * xDistance, 0.2 * yDistance, 0.2 * zDistance);
|
||||
entity.setDeltaMovement(entity.getDeltaMovement().add(knockbackVec));
|
||||
|
||||
if (entity instanceof VehicleEntity vehicle) {
|
||||
vehicle.setDeltaMovement(vehicle.getDeltaMovement().add(knockbackVec.scale(0.05f)));
|
||||
} else {
|
||||
entity.setDeltaMovement(entity.getDeltaMovement().add(knockbackVec));
|
||||
}
|
||||
if (entity instanceof Player player) {
|
||||
if (!player.isSpectator() && (!player.isCreative() || !player.getAbilities().flying)) {
|
||||
this.getHitPlayers().put(player, knockbackVec);
|
||||
|
@ -213,5 +217,4 @@ public class CustomExplosion extends Explosion {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -184,6 +184,7 @@
|
|||
"item.superbwarfare.monitor": "Monitor",
|
||||
"des.superbwarfare.monitor": "Drone Distance: %1$s",
|
||||
"item.superbwarfare.propeller": "Propeller",
|
||||
"item.superbwarfare.large_propeller": "Large_Propeller",
|
||||
"item.superbwarfare.motor": "Motor",
|
||||
"item.superbwarfare.large_motor": "Large Motor",
|
||||
"item.superbwarfare.hand_grenade": "Hand Grenade",
|
||||
|
|
|
@ -183,6 +183,7 @@
|
|||
"item.superbwarfare.monitor": "遥控器",
|
||||
"des.superbwarfare.monitor": "无人机距离你: %1$s",
|
||||
"item.superbwarfare.propeller": "螺旋桨",
|
||||
"item.superbwarfare.large_propeller": "大型螺旋桨",
|
||||
"item.superbwarfare.motor": "马达",
|
||||
"item.superbwarfare.large_motor": "大型电动机",
|
||||
"item.superbwarfare.hand_grenade": "M67手榴弹",
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 256 B |
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"category": "misc",
|
||||
"pattern": [
|
||||
"abc",
|
||||
"def",
|
||||
"hgh"
|
||||
],
|
||||
"key": {
|
||||
"a": {
|
||||
"item": "superbwarfare:large_propeller"
|
||||
},
|
||||
"b": {
|
||||
"item": "superbwarfare:large_motor"
|
||||
},
|
||||
"c": {
|
||||
"item": "superbwarfare:propeller"
|
||||
},
|
||||
"d": {
|
||||
"item": "minecraft:compass"
|
||||
},
|
||||
"e": {
|
||||
"item":"superbwarfare:steel_block"
|
||||
},
|
||||
"f": {
|
||||
"item": "minecraft:chest"
|
||||
},
|
||||
"g": {
|
||||
"item": "superbwarfare:cell"
|
||||
},
|
||||
"h": {
|
||||
"item": "minecraft:dispenser"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "superbwarfare:container",
|
||||
"nbt": {
|
||||
"BlockEntityTag": {
|
||||
"EntityType": "superbwarfare:ah_6"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,6 +19,6 @@
|
|||
},
|
||||
"result": {
|
||||
"item": "superbwarfare:grain",
|
||||
"count": 2
|
||||
"count": 4
|
||||
}
|
||||
}
|
|
@ -1,14 +1,23 @@
|
|||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"category": "equipment",
|
||||
"category": "misc",
|
||||
"pattern": [
|
||||
"aaa",
|
||||
"aaa",
|
||||
"aaa"
|
||||
" a ",
|
||||
"bcd",
|
||||
"bcd"
|
||||
],
|
||||
"key": {
|
||||
"a": {
|
||||
"item": "superbwarfare:motor"
|
||||
"item": "minecraft:iron_ingot"
|
||||
},
|
||||
"b": {
|
||||
"item": "minecraft:lapis_block"
|
||||
},
|
||||
"c": {
|
||||
"item": "minecraft:copper_block"
|
||||
},
|
||||
"d": {
|
||||
"item": "minecraft:redstone_block"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"category": "misc",
|
||||
"pattern": [
|
||||
" a ",
|
||||
"aba",
|
||||
" a "
|
||||
],
|
||||
"key": {
|
||||
"a": {
|
||||
"item": "minecraft:iron_ingot"
|
||||
},
|
||||
"b": {
|
||||
"item": "superbwarfare:cemented_carbide_ingot"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "superbwarfare:large_propeller",
|
||||
"count": 1
|
||||
}
|
||||
}
|
|
@ -25,6 +25,6 @@
|
|||
},
|
||||
"result": {
|
||||
"item": "superbwarfare:missile_engine",
|
||||
"count": 1
|
||||
"count": 2
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"category": "equipment",
|
||||
"pattern": [
|
||||
" a ",
|
||||
"bcb",
|
||||
" d "
|
||||
],
|
||||
"key": {
|
||||
"a": {
|
||||
"item": "superbwarfare:fusee"
|
||||
},
|
||||
"b": {
|
||||
"item": "minecraft:copper_ingot"
|
||||
},
|
||||
"c": {
|
||||
"item": "superbwarfare:high_energy_explosives"
|
||||
},
|
||||
"d": {
|
||||
"item": "superbwarfare:grain"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "superbwarfare:rocket_70",
|
||||
"count": 4
|
||||
}
|
||||
}
|
|
@ -25,6 +25,6 @@
|
|||
},
|
||||
"result": {
|
||||
"item": "superbwarfare:seeker",
|
||||
"count": 1
|
||||
"count": 2
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@
|
|||
"item": "superbwarfare:m2hb_blueprint"
|
||||
},
|
||||
"b": {
|
||||
"item": "superbwarfare:epic_material_pack"
|
||||
"item": "superbwarfare:rare_material_pack"
|
||||
},
|
||||
"c": {
|
||||
"tag":"forge:ingots/steel"
|
||||
|
@ -32,7 +32,7 @@
|
|||
"item": "superbwarfare:large_motor"
|
||||
},
|
||||
"i": {
|
||||
"tag":"forge:ingots/copper"
|
||||
"item": "superbwarfare:large_propeller"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
|
|
Loading…
Add table
Reference in a new issue