添加C4起爆器
This commit is contained in:
parent
fdc7016c72
commit
a5332a6cac
7 changed files with 352 additions and 1 deletions
|
@ -309,7 +309,7 @@ public class C4Entity extends Projectile implements GeoEntity {
|
|||
this.inGround = true;
|
||||
}
|
||||
|
||||
private void explode() {
|
||||
public void explode() {
|
||||
Vec3 pos = position();
|
||||
|
||||
if (onEntity) {
|
||||
|
|
|
@ -132,6 +132,8 @@ public class ModItems {
|
|||
public static final RegistryObject<Item> DRONE = ITEMS.register("drone", Drone::new);
|
||||
|
||||
public static final RegistryObject<Item> MONITOR = ITEMS.register("monitor", Monitor::new);
|
||||
|
||||
public static final RegistryObject<Item> DETONATOR = ITEMS.register("detonator", Detonator::new);
|
||||
public static final RegistryObject<Item> TARGET_DEPLOYER = ITEMS.register("target_deployer", TargetDeployer::new);
|
||||
public static final RegistryObject<Item> KNIFE = ITEMS.register("knife", Knife::new);
|
||||
public static final RegistryObject<Item> HAMMER = ITEMS.register("hammer", Hammer::new);
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package com.atsuishio.superbwarfare.item;
|
||||
|
||||
import com.atsuishio.superbwarfare.entity.C4Entity;
|
||||
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
public class Detonator extends Item {
|
||||
public Detonator() {
|
||||
super(new Properties().stacksTo(1));
|
||||
}
|
||||
|
||||
public static List<Entity> getC4(Player player, Level level) {
|
||||
return StreamSupport.stream(EntityFindUtil.getEntities(level).getAll().spliterator(), false)
|
||||
.filter(e -> e instanceof C4Entity c4 && c4.getOwner() == player)
|
||||
.toList();
|
||||
}
|
||||
@Override
|
||||
public InteractionResultHolder<ItemStack> use(Level world, Player player, InteractionHand hand) {
|
||||
ItemStack stack = player.getItemInHand(hand);
|
||||
player.getCooldowns().addCooldown(stack.getItem(), 10);
|
||||
|
||||
releaseUsing(stack, player.level(), player, 1);
|
||||
|
||||
List<Entity> entities = getC4(player, player.level());
|
||||
|
||||
for (var e : entities) {
|
||||
if (e instanceof C4Entity c4) {
|
||||
c4.explode();
|
||||
}
|
||||
}
|
||||
|
||||
return super.use(world, player, hand);
|
||||
}
|
||||
}
|
|
@ -197,6 +197,7 @@
|
|||
"item.superbwarfare.large_battery_pack": "Large Battery Pack",
|
||||
"item.superbwarfare.drone": "Drone",
|
||||
"item.superbwarfare.monitor": "Monitor",
|
||||
"item.superbwarfare.detonator": "Detonator",
|
||||
"des.superbwarfare.monitor": "Drone Distance: %1$s",
|
||||
"item.superbwarfare.propeller": "Propeller",
|
||||
"item.superbwarfare.large_propeller": "Large Propeller",
|
||||
|
|
|
@ -197,6 +197,7 @@
|
|||
"item.superbwarfare.large_battery_pack": "大型电池组",
|
||||
"item.superbwarfare.drone": "无人机",
|
||||
"item.superbwarfare.monitor": "遥控器",
|
||||
"item.superbwarfare.detonator": "起爆器",
|
||||
"des.superbwarfare.monitor": "无人机距离你: %1$s",
|
||||
"item.superbwarfare.propeller": "螺旋桨",
|
||||
"item.superbwarfare.large_propeller": "大型螺旋桨",
|
||||
|
|
|
@ -0,0 +1,304 @@
|
|||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"1": "superbwarfare:item/detonator"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "zhu",
|
||||
"from": [7.5, 2.8345, 8.81392],
|
||||
"to": [8.5, 3.74231, 9.56392],
|
||||
"rotation": {"angle": -22.5, "axis": "x", "origin": [8, 3.11732, 9.18892]},
|
||||
"faces": {
|
||||
"east": {"uv": [6, 7, 6.75, 8], "texture": "#1"},
|
||||
"south": {"uv": [6, 6, 7, 7], "texture": "#1"},
|
||||
"west": {"uv": [7, 6, 7.75, 7], "texture": "#1"},
|
||||
"down": {"uv": [8, 7, 7, 7.75], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "zhu",
|
||||
"from": [7.5, 0, 7.9],
|
||||
"to": [8.5, 0.25, 9.66563],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 10, 1, 10.25], "texture": "#1"},
|
||||
"east": {"uv": [9, 4, 10.75, 4.25], "texture": "#1"},
|
||||
"south": {"uv": [10, 0, 11, 0.25], "texture": "#1"},
|
||||
"west": {"uv": [9, 5, 10.75, 5.25], "texture": "#1"},
|
||||
"up": {"uv": [5, 5.75, 4, 4], "texture": "#1"},
|
||||
"down": {"uv": [6, 0, 5, 1.75], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "zhu",
|
||||
"from": [8.5, -0.46875, 7.15],
|
||||
"to": [8.6, -0.36875, 8.16563],
|
||||
"rotation": {"angle": -45, "axis": "x", "origin": [8.55, -0.3, 7.38281]},
|
||||
"faces": {
|
||||
"north": {"uv": [11, 8, 11.25, 8.25], "texture": "#1"},
|
||||
"east": {"uv": [1, 10, 2, 10.25], "texture": "#1"},
|
||||
"south": {"uv": [9, 11, 9.25, 11.25], "texture": "#1"},
|
||||
"west": {"uv": [10, 1, 11, 1.25], "texture": "#1"},
|
||||
"up": {"uv": [2.25, 11, 2, 10], "texture": "#1"},
|
||||
"down": {"uv": [10.25, 2, 10, 3], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "zhu",
|
||||
"from": [7.5, -0.46875, 7.15],
|
||||
"to": [8.5, -0.36875, 7.25],
|
||||
"rotation": {"angle": -45, "axis": "x", "origin": [8.55, -0.3, 7.38281]},
|
||||
"faces": {
|
||||
"north": {"uv": [3, 10, 4, 10.25], "texture": "#1"},
|
||||
"east": {"uv": [11, 9, 11.25, 9.25], "texture": "#1"},
|
||||
"south": {"uv": [10, 3, 11, 3.25], "texture": "#1"},
|
||||
"west": {"uv": [10, 11, 10.25, 11.25], "texture": "#1"},
|
||||
"up": {"uv": [5, 10.25, 4, 10], "texture": "#1"},
|
||||
"down": {"uv": [6, 10, 5, 10.25], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "zhu",
|
||||
"from": [7.4, -0.46875, 7.15],
|
||||
"to": [7.5, -0.36875, 8.16563],
|
||||
"rotation": {"angle": -45, "axis": "x", "origin": [7.45, -0.3, 7.38281]},
|
||||
"faces": {
|
||||
"north": {"uv": [11, 10, 11.25, 10.25], "texture": "#1"},
|
||||
"east": {"uv": [6, 10, 7, 10.25], "texture": "#1"},
|
||||
"south": {"uv": [11, 11, 11.25, 11.25], "texture": "#1"},
|
||||
"west": {"uv": [10, 6, 11, 6.25], "texture": "#1"},
|
||||
"up": {"uv": [7.25, 11, 7, 10], "texture": "#1"},
|
||||
"down": {"uv": [10.25, 7, 10, 8], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "zhu",
|
||||
"from": [7.5, 0.25, 7.75],
|
||||
"to": [8.5, 3, 9.64219],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 3, 1, 5.75], "texture": "#1"},
|
||||
"east": {"uv": [0, 0, 2, 2.75], "texture": "#1"},
|
||||
"south": {"uv": [1, 3, 2, 5.75], "texture": "#1"},
|
||||
"west": {"uv": [2, 0, 4, 2.75], "texture": "#1"},
|
||||
"down": {"uv": [5, 0, 4, 2], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "zhu",
|
||||
"from": [7.5, 3.23824, 7.3462],
|
||||
"to": [8.5, 3.83824, 9.2962],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, -0.00001, 8.00001]},
|
||||
"faces": {
|
||||
"north": {"uv": [8, 7, 9, 7.5], "texture": "#1"},
|
||||
"east": {"uv": [7, 0, 9, 0.5], "texture": "#1"},
|
||||
"west": {"uv": [7, 1, 9, 1.5], "texture": "#1"},
|
||||
"up": {"uv": [5, 4, 4, 2], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "zhu",
|
||||
"from": [7.5, 2.99606, 7.74619],
|
||||
"to": [8.5, 3.23825, 8.94619],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [8, 10, 9, 10.25], "texture": "#1"},
|
||||
"east": {"uv": [9, 8, 10.25, 8.25], "texture": "#1"},
|
||||
"south": {"uv": [9, 10, 10, 10.25], "texture": "#1"},
|
||||
"west": {"uv": [9, 9, 10.25, 9.25], "texture": "#1"},
|
||||
"down": {"uv": [6, 6, 5, 7.25], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "zhu",
|
||||
"from": [7.5, 3.12379, 7.3716],
|
||||
"to": [8.5, 3.36598, 7.9216],
|
||||
"rotation": {"angle": 22.5, "axis": "x", "origin": [8, 3.24489, 7.6466]},
|
||||
"faces": {
|
||||
"east": {"uv": [11, 6, 11.5, 6.25], "texture": "#1"},
|
||||
"west": {"uv": [7, 11, 7.5, 11.25], "texture": "#1"},
|
||||
"down": {"uv": [9, 8, 8, 8.5], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "zhu",
|
||||
"from": [7.7, 3.75, 8.4],
|
||||
"to": [8.3, 6.5, 9],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [6, 0, 6.5, 2.75], "texture": "#1"},
|
||||
"east": {"uv": [1, 6, 1.5, 8.75], "texture": "#1"},
|
||||
"south": {"uv": [6, 3, 6.5, 5.75], "texture": "#1"},
|
||||
"west": {"uv": [4, 6, 4.5, 8.75], "texture": "#1"},
|
||||
"up": {"uv": [10.5, 10.5, 10, 10], "texture": "#1"},
|
||||
"down": {"uv": [0.5, 11, 0, 11.5], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "zhu",
|
||||
"from": [7.75, 0.24428, 7.4373],
|
||||
"to": [8.25, 1.74428, 7.8873],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8.1]},
|
||||
"faces": {
|
||||
"north": {"uv": [8, 2, 8.5, 3.5], "texture": "#1"},
|
||||
"east": {"uv": [8, 4, 8.5, 5.5], "texture": "#1"},
|
||||
"south": {"uv": [5, 8, 5.5, 9.5], "texture": "#1"},
|
||||
"west": {"uv": [6, 8, 6.5, 9.5], "texture": "#1"},
|
||||
"up": {"uv": [11.5, 0.5, 11, 0], "texture": "#1"},
|
||||
"down": {"uv": [1.5, 11, 1, 11.5], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "zhu",
|
||||
"from": [7.55, 2.93166, 7.09493],
|
||||
"to": [8.45, 3.63166, 7.64493],
|
||||
"rotation": {"angle": 45, "axis": "x", "origin": [8, 3.43166, 7.46993]},
|
||||
"faces": {
|
||||
"north": {"uv": [8, 6, 9, 6.75], "texture": "#1"},
|
||||
"east": {"uv": [9, 6, 9.5, 6.75], "texture": "#1"},
|
||||
"south": {"uv": [7, 8, 8, 8.75], "texture": "#1"},
|
||||
"west": {"uv": [7, 9, 7.5, 9.75], "texture": "#1"},
|
||||
"up": {"uv": [10, 0.5, 9, 0], "texture": "#1"},
|
||||
"down": {"uv": [2, 9, 1, 9.5], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "zhu",
|
||||
"from": [7.5, 3.27155, 7.01494],
|
||||
"to": [8.5, 3.47155, 7.21494],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [11, 1, 12, 1.25], "texture": "#1"},
|
||||
"east": {"uv": [0, 12, 0.25, 12.25], "texture": "#1"},
|
||||
"south": {"uv": [2, 11, 3, 11.25], "texture": "#1"},
|
||||
"west": {"uv": [12, 0, 12.25, 0.25], "texture": "#1"},
|
||||
"up": {"uv": [12, 2.25, 11, 2], "texture": "#1"},
|
||||
"down": {"uv": [4, 11, 3, 11.25], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ba",
|
||||
"from": [7.8, 0.12709, 6.61152],
|
||||
"to": [8.2, 1.87709, 7.06152],
|
||||
"rotation": {"angle": 45, "axis": "x", "origin": [8, 1.36928, 6.8373]},
|
||||
"faces": {
|
||||
"north": {"uv": [2, 7, 2.5, 8.75], "texture": "#1"},
|
||||
"east": {"uv": [7, 2, 7.5, 3.75], "texture": "#1"},
|
||||
"south": {"uv": [3, 7, 3.5, 8.75], "texture": "#1"},
|
||||
"west": {"uv": [7, 4, 7.5, 5.75], "texture": "#1"},
|
||||
"up": {"uv": [11.5, 3.5, 11, 3], "texture": "#1"},
|
||||
"down": {"uv": [4.5, 11, 4, 11.5], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ba",
|
||||
"from": [7.8, 0.84173, 6.39688],
|
||||
"to": [8.2, 1.84173, 6.59688],
|
||||
"rotation": {"angle": 45, "axis": "x", "origin": [8, 1.33392, 6.87266]},
|
||||
"faces": {
|
||||
"north": {"uv": [9, 1, 9.5, 2], "texture": "#1"},
|
||||
"east": {"uv": [11, 4, 11.25, 5], "texture": "#1"},
|
||||
"south": {"uv": [2, 9, 2.5, 10], "texture": "#1"},
|
||||
"west": {"uv": [5, 11, 5.25, 12], "texture": "#1"},
|
||||
"up": {"uv": [11.5, 7.25, 11, 7], "texture": "#1"},
|
||||
"down": {"uv": [8.5, 11, 8, 11.25], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ba",
|
||||
"from": [7.65, 0.09818, 6.1459],
|
||||
"to": [8.35, 3.29818, 6.6459],
|
||||
"rotation": {"angle": 22.5, "axis": "x", "origin": [8, 1.36928, 6.8373]},
|
||||
"faces": {
|
||||
"north": {"uv": [2, 3, 2.75, 6.25], "texture": "#1"},
|
||||
"east": {"uv": [5, 2, 5.5, 5.25], "texture": "#1"},
|
||||
"south": {"uv": [3, 3, 3.75, 6.25], "texture": "#1"},
|
||||
"west": {"uv": [0, 6, 0.5, 9.25], "texture": "#1"},
|
||||
"up": {"uv": [9.75, 7.5, 9, 7], "texture": "#1"},
|
||||
"down": {"uv": [8.75, 9, 8, 9.5], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "tanhuang",
|
||||
"from": [7.75, 2.2, 6.7],
|
||||
"to": [8.25, 2.7, 7.81563],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [11, 5, 11.5, 5.5], "texture": "#1"},
|
||||
"east": {"uv": [9, 2, 10, 2.5], "texture": "#1"},
|
||||
"south": {"uv": [6, 11, 6.5, 11.5], "texture": "#1"},
|
||||
"west": {"uv": [3, 9, 4, 9.5], "texture": "#1"},
|
||||
"up": {"uv": [9.5, 4, 9, 3], "texture": "#1"},
|
||||
"down": {"uv": [4.5, 9, 4, 10], "texture": "#1"}
|
||||
}
|
||||
}
|
||||
],
|
||||
"gui_light": "front",
|
||||
"display": {
|
||||
"thirdperson_righthand": {
|
||||
"translation": [-1, 4.5, 0]
|
||||
},
|
||||
"thirdperson_lefthand": {
|
||||
"translation": [-1, 4.5, 0]
|
||||
},
|
||||
"firstperson_righthand": {
|
||||
"rotation": [0, 0, -17],
|
||||
"translation": [-1.5, 10.5, 4.25]
|
||||
},
|
||||
"firstperson_lefthand": {
|
||||
"rotation": [0, 0, -17],
|
||||
"translation": [-1.5, 10.5, 4.25]
|
||||
},
|
||||
"ground": {
|
||||
"translation": [0, 5, 0]
|
||||
},
|
||||
"gui": {
|
||||
"rotation": [90, 45, -90],
|
||||
"translation": [8, 8.75, 0.5],
|
||||
"scale": [2.2, 2.2, 2.2]
|
||||
},
|
||||
"head": {
|
||||
"translation": [0, 14.75, 0]
|
||||
},
|
||||
"fixed": {
|
||||
"rotation": [90, -45, 90],
|
||||
"translation": [-9, 9.75, 0.5],
|
||||
"scale": [2.5, 2.5, 2.5]
|
||||
}
|
||||
},
|
||||
"groups": [
|
||||
{
|
||||
"name": "bone",
|
||||
"origin": [8, 10, 8],
|
||||
"color": 0,
|
||||
"children": [
|
||||
{
|
||||
"name": "0",
|
||||
"origin": [8, 0, 8],
|
||||
"color": 1,
|
||||
"children": [
|
||||
{
|
||||
"name": "zhu",
|
||||
"origin": [8, 3.41452, 7.379],
|
||||
"color": 3,
|
||||
"children": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
|
||||
},
|
||||
{
|
||||
"name": "ba",
|
||||
"origin": [8, 3.35, 7.07],
|
||||
"color": 4,
|
||||
"children": [13, 14, 15]
|
||||
},
|
||||
{
|
||||
"name": "tanhuang",
|
||||
"origin": [8, 2.45, 7.25781],
|
||||
"color": 5,
|
||||
"children": [16]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
Loading…
Add table
Reference in a new issue