diff --git a/src/generated/resources/.cache/b69ee8a2655365569b979911c0440daa8c470ac2 b/src/generated/resources/.cache/b69ee8a2655365569b979911c0440daa8c470ac2 index 25776245a..49754392e 100644 --- a/src/generated/resources/.cache/b69ee8a2655365569b979911c0440daa8c470ac2 +++ b/src/generated/resources/.cache/b69ee8a2655365569b979911c0440daa8c470ac2 @@ -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 diff --git a/src/generated/resources/assets/superbwarfare/models/item/large_propeller.json b/src/generated/resources/assets/superbwarfare/models/item/large_propeller.json new file mode 100644 index 000000000..16d9e604a --- /dev/null +++ b/src/generated/resources/assets/superbwarfare/models/item/large_propeller.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "superbwarfare:item/large_propeller" + } +} \ No newline at end of file diff --git a/src/main/java/com/atsuishio/superbwarfare/datagen/ModItemModelProvider.java b/src/main/java/com/atsuishio/superbwarfare/datagen/ModItemModelProvider.java index 5ebf5a45e..2ee738bd5 100644 --- a/src/main/java/com/atsuishio/superbwarfare/datagen/ModItemModelProvider.java +++ b/src/main/java/com/atsuishio/superbwarfare/datagen/ModItemModelProvider.java @@ -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); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/ContainerMobileEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/ContainerMobileEntity.java index 615cee12d..730b18a95 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/ContainerMobileEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/ContainerMobileEntity.java @@ -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) { diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/VehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/VehicleEntity.java index f12248779..500b5f7cb 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/VehicleEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/VehicleEntity.java @@ -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()); diff --git a/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java b/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java index 78de89a09..4b1726477 100644 --- a/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java +++ b/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java @@ -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) { diff --git a/src/main/java/com/atsuishio/superbwarfare/init/ModItems.java b/src/main/java/com/atsuishio/superbwarfare/init/ModItems.java index 10fb76253..b693e9dc6 100644 --- a/src/main/java/com/atsuishio/superbwarfare/init/ModItems.java +++ b/src/main/java/com/atsuishio/superbwarfare/init/ModItems.java @@ -119,6 +119,7 @@ public class ModItems { public static final RegistryObject SENPAI_SPAWN_EGG = ITEMS.register("senpai_spawn_egg", () -> new ForgeSpawnEggItem(ModEntities.SENPAI, -11584987, -14014413, new Item.Properties())); public static final RegistryObject ANCIENT_CPU = ITEMS.register("ancient_cpu", () -> new Item(new Item.Properties().rarity(Rarity.RARE))); public static final RegistryObject PROPELLER = ITEMS.register("propeller", () -> new Item(new Item.Properties())); + public static final RegistryObject LARGE_PROPELLER = ITEMS.register("large_propeller", () -> new Item(new Item.Properties())); public static final RegistryObject MOTOR = ITEMS.register("motor", () -> new Item(new Item.Properties())); public static final RegistryObject LARGE_MOTOR = ITEMS.register("large_motor", () -> new Item(new Item.Properties())); public static final RegistryObject DRONE = ITEMS.register("drone", Drone::new); diff --git a/src/main/java/com/atsuishio/superbwarfare/tools/CustomExplosion.java b/src/main/java/com/atsuishio/superbwarfare/tools/CustomExplosion.java index f4727eccd..ca74e491c 100644 --- a/src/main/java/com/atsuishio/superbwarfare/tools/CustomExplosion.java +++ b/src/main/java/com/atsuishio/superbwarfare/tools/CustomExplosion.java @@ -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 { } } } - } diff --git a/src/main/resources/assets/superbwarfare/lang/en_us.json b/src/main/resources/assets/superbwarfare/lang/en_us.json index 0ff96d63e..934433b9f 100644 --- a/src/main/resources/assets/superbwarfare/lang/en_us.json +++ b/src/main/resources/assets/superbwarfare/lang/en_us.json @@ -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", diff --git a/src/main/resources/assets/superbwarfare/lang/zh_cn.json b/src/main/resources/assets/superbwarfare/lang/zh_cn.json index 432ea5739..7e6246680 100644 --- a/src/main/resources/assets/superbwarfare/lang/zh_cn.json +++ b/src/main/resources/assets/superbwarfare/lang/zh_cn.json @@ -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手榴弹", diff --git a/src/main/resources/assets/superbwarfare/textures/item/large_propeller.png b/src/main/resources/assets/superbwarfare/textures/item/large_propeller.png new file mode 100644 index 000000000..39dc3a97c Binary files /dev/null and b/src/main/resources/assets/superbwarfare/textures/item/large_propeller.png differ diff --git a/src/main/resources/data/superbwarfare/recipes/ah_6_crafting.json b/src/main/resources/data/superbwarfare/recipes/ah_6_crafting.json new file mode 100644 index 000000000..7c71a4809 --- /dev/null +++ b/src/main/resources/data/superbwarfare/recipes/ah_6_crafting.json @@ -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" + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/data/superbwarfare/recipes/grain_crafting.json b/src/main/resources/data/superbwarfare/recipes/grain_crafting.json index 7074c16f4..616dda9ed 100644 --- a/src/main/resources/data/superbwarfare/recipes/grain_crafting.json +++ b/src/main/resources/data/superbwarfare/recipes/grain_crafting.json @@ -19,6 +19,6 @@ }, "result": { "item": "superbwarfare:grain", - "count": 2 + "count": 4 } } \ No newline at end of file diff --git a/src/main/resources/data/superbwarfare/recipes/large_motor_crafting.json b/src/main/resources/data/superbwarfare/recipes/large_motor_crafting.json index aab03db5f..21e3d812e 100644 --- a/src/main/resources/data/superbwarfare/recipes/large_motor_crafting.json +++ b/src/main/resources/data/superbwarfare/recipes/large_motor_crafting.json @@ -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": { diff --git a/src/main/resources/data/superbwarfare/recipes/large_propeller_crafting.json b/src/main/resources/data/superbwarfare/recipes/large_propeller_crafting.json new file mode 100644 index 000000000..24f4e46ff --- /dev/null +++ b/src/main/resources/data/superbwarfare/recipes/large_propeller_crafting.json @@ -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 + } +} \ No newline at end of file diff --git a/src/main/resources/data/superbwarfare/recipes/missile_engine_crafting.json b/src/main/resources/data/superbwarfare/recipes/missile_engine_crafting.json index 239d3a7c8..9caa0889a 100644 --- a/src/main/resources/data/superbwarfare/recipes/missile_engine_crafting.json +++ b/src/main/resources/data/superbwarfare/recipes/missile_engine_crafting.json @@ -25,6 +25,6 @@ }, "result": { "item": "superbwarfare:missile_engine", - "count": 1 + "count": 2 } } \ No newline at end of file diff --git a/src/main/resources/data/superbwarfare/recipes/rocket_70_crafting.json b/src/main/resources/data/superbwarfare/recipes/rocket_70_crafting.json new file mode 100644 index 000000000..0e7a82ae2 --- /dev/null +++ b/src/main/resources/data/superbwarfare/recipes/rocket_70_crafting.json @@ -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 + } +} \ No newline at end of file diff --git a/src/main/resources/data/superbwarfare/recipes/seeker_crafting.json b/src/main/resources/data/superbwarfare/recipes/seeker_crafting.json index 866628654..b9b5e5174 100644 --- a/src/main/resources/data/superbwarfare/recipes/seeker_crafting.json +++ b/src/main/resources/data/superbwarfare/recipes/seeker_crafting.json @@ -25,6 +25,6 @@ }, "result": { "item": "superbwarfare:seeker", - "count": 1 + "count": 2 } } \ No newline at end of file diff --git a/src/main/resources/data/superbwarfare/recipes/speedboat_crafting.json b/src/main/resources/data/superbwarfare/recipes/speedboat_crafting.json index 0d4e8880e..36f5ce0bb 100644 --- a/src/main/resources/data/superbwarfare/recipes/speedboat_crafting.json +++ b/src/main/resources/data/superbwarfare/recipes/speedboat_crafting.json @@ -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": {