内联所有inventoryTickProcedure
This commit is contained in:
parent
337708ac06
commit
906206cf3f
49 changed files with 1130 additions and 1430 deletions
|
@ -92,8 +92,8 @@ public class GunGrenadeEntity extends AbstractArrow implements ItemSupplier {
|
||||||
if (this.level() instanceof ServerLevel level) {
|
if (this.level() instanceof ServerLevel level) {
|
||||||
level.explode(this, (this.getX()), (this.getY()), (this.getZ()), 5.5f, Level.ExplosionInteraction.NONE);
|
level.explode(this, (this.getX()), (this.getY()), (this.getZ()), 5.5f, Level.ExplosionInteraction.NONE);
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "target:mediumexp");
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "target:mediumexp");
|
||||||
}
|
}
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,7 @@ import net.minecraft.commands.CommandSource;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.network.protocol.Packet;
|
import net.minecraft.network.protocol.Packet;
|
||||||
import net.minecraft.network.protocol.game.ClientGamePacketListener;
|
import net.minecraft.network.protocol.game.ClientGamePacketListener;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundSource;
|
|
||||||
import net.minecraft.util.RandomSource;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
@ -23,7 +20,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.network.NetworkHooks;
|
import net.minecraftforge.network.NetworkHooks;
|
||||||
import net.minecraftforge.network.PlayMessages;
|
import net.minecraftforge.network.PlayMessages;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
|
|
||||||
@OnlyIn(value = Dist.CLIENT, _interface = ItemSupplier.class)
|
@OnlyIn(value = Dist.CLIENT, _interface = ItemSupplier.class)
|
||||||
public class MortarShellEntity extends AbstractArrow implements ItemSupplier {
|
public class MortarShellEntity extends AbstractArrow implements ItemSupplier {
|
||||||
|
@ -75,8 +71,8 @@ public class MortarShellEntity extends AbstractArrow implements ItemSupplier {
|
||||||
if (this.level() instanceof ServerLevel level) {
|
if (this.level() instanceof ServerLevel level) {
|
||||||
level.explode(this, (this.getX()), (this.getY()), (this.getZ()), 10, Level.ExplosionInteraction.NONE);
|
level.explode(this, (this.getX()), (this.getY()), (this.getZ()), 10, Level.ExplosionInteraction.NONE);
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "target:mediumexp");
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "target:mediumexp");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.discard();
|
this.discard();
|
||||||
|
|
|
@ -100,8 +100,8 @@ public class RpgRocketEntity extends AbstractArrow implements ItemSupplier {
|
||||||
level.explode(this, this.getX(), this.getY(), this.getZ(), 4, Level.ExplosionInteraction.NONE);
|
level.explode(this, this.getX(), this.getY(), this.getZ(), 4, Level.ExplosionInteraction.NONE);
|
||||||
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "target:mediumexp");
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "target:mediumexp");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.discard();
|
this.discard();
|
||||||
|
|
|
@ -308,7 +308,7 @@ public class GunEventHandler {
|
||||||
|
|
||||||
if (!player.level().isClientSide()) {
|
if (!player.level().isClientSide()) {
|
||||||
float headshot = (float) heldItem.getOrCreateTag().getDouble("headshot");
|
float headshot = (float) heldItem.getOrCreateTag().getDouble("headshot");
|
||||||
float damage = (float) (heldItem.getOrCreateTag().getDouble("damage") + heldItem.getOrCreateTag().getDouble("adddamage")) * (float) heldItem.getOrCreateTag().getDouble("damageadd");
|
float damage = (float) (heldItem.getOrCreateTag().getDouble("damage") + heldItem.getOrCreateTag().getDouble("add_damage")) * (float) heldItem.getOrCreateTag().getDouble("damageadd");
|
||||||
|
|
||||||
ProjectileEntity projectile = new ProjectileEntity(player.level())
|
ProjectileEntity projectile = new ProjectileEntity(player.level())
|
||||||
.shooter(player)
|
.shooter(player)
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class Rocket extends Item implements GeoItem, AnimatedItem {
|
||||||
|
|
||||||
if (!sourceentity.level().isClientSide() && sourceentity.getServer() != null) {
|
if (!sourceentity.level().isClientSide() && sourceentity.getServer() != null) {
|
||||||
sourceentity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, sourceentity.position(), sourceentity.getRotationVector(), sourceentity.level() instanceof ServerLevel ? (ServerLevel) sourceentity.level() : null, 4,
|
sourceentity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, sourceentity.position(), sourceentity.getRotationVector(), sourceentity.level() instanceof ServerLevel ? (ServerLevel) sourceentity.level() : null, 4,
|
||||||
sourceentity.getName().getString(), sourceentity.getDisplayName(), sourceentity.level().getServer(), sourceentity), "playsound target:target:mediumexp");
|
sourceentity.getName().getString(), sourceentity.getDisplayName(), sourceentity.getServer(), sourceentity), "playsound target:target:mediumexp");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sourceentity instanceof Player player) {
|
if (sourceentity instanceof Player player) {
|
||||||
|
|
|
@ -7,15 +7,19 @@ import net.mcreator.target.client.renderer.item.AK47ItemRenderer;
|
||||||
import net.mcreator.target.init.TargetModItems;
|
import net.mcreator.target.init.TargetModItems;
|
||||||
import net.mcreator.target.init.TargetModSounds;
|
import net.mcreator.target.init.TargetModSounds;
|
||||||
import net.mcreator.target.item.AnimatedItem;
|
import net.mcreator.target.item.AnimatedItem;
|
||||||
import net.mcreator.target.procedures.AK47WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure;
|
import net.mcreator.target.tools.GunInfo;
|
||||||
|
import net.mcreator.target.tools.GunReload;
|
||||||
import net.mcreator.target.tools.GunsTool;
|
import net.mcreator.target.tools.GunsTool;
|
||||||
import net.mcreator.target.tools.TooltipTool;
|
import net.mcreator.target.tools.TooltipTool;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.HumanoidModel;
|
import net.minecraft.client.model.HumanoidModel;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
||||||
|
import net.minecraft.commands.CommandSource;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
@ -24,6 +28,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.*;
|
import net.minecraft.world.item.*;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
||||||
|
@ -172,9 +177,61 @@ public class AK47Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
super.inventoryTick(itemStack, world, entity, slot, selected);
|
||||||
AK47WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure.execute(entity, itemstack);
|
|
||||||
|
if (entity instanceof Player player) {
|
||||||
|
var tag = itemStack.getOrCreateTag();
|
||||||
|
double id = tag.getDouble("id");
|
||||||
|
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 57) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:ak_47_reload_empty player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
||||||
|
}
|
||||||
|
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 41) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:ak_47_reload_normal player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.RIFLE, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getGunInstance() {
|
public static ItemStack getGunInstance() {
|
||||||
|
|
|
@ -7,16 +7,16 @@ import net.mcreator.target.client.renderer.item.Aa12ItemRenderer;
|
||||||
import net.mcreator.target.init.TargetModItems;
|
import net.mcreator.target.init.TargetModItems;
|
||||||
import net.mcreator.target.init.TargetModSounds;
|
import net.mcreator.target.init.TargetModSounds;
|
||||||
import net.mcreator.target.item.AnimatedItem;
|
import net.mcreator.target.item.AnimatedItem;
|
||||||
import net.mcreator.target.procedures.Aa12WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure;
|
import net.mcreator.target.tools.*;
|
||||||
import net.mcreator.target.tools.GunsTool;
|
|
||||||
import net.mcreator.target.tools.RarityTool;
|
|
||||||
import net.mcreator.target.tools.TooltipTool;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.HumanoidModel;
|
import net.minecraft.client.model.HumanoidModel;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
||||||
|
import net.minecraft.commands.CommandSource;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
@ -25,6 +25,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.ItemDisplayContext;
|
import net.minecraft.world.item.ItemDisplayContext;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
@ -172,9 +173,63 @@ public class Aa12Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
super.inventoryTick(itemStack, world, entity, slot, selected);
|
||||||
Aa12WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure.execute(entity, itemstack);
|
|
||||||
|
var tag = itemStack.getOrCreateTag();
|
||||||
|
double id = tag.getDouble("id");
|
||||||
|
if (entity instanceof Player player) {
|
||||||
|
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 55) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:aa_12_reload_empty player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", tag.getDouble("reload_time") - 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.SHOTGUN);
|
||||||
|
}
|
||||||
|
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 44) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
{
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:aa_12_reload_normal player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.SHOTGUN, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,15 +7,19 @@ import net.mcreator.target.client.renderer.item.AbekiriItemRenderer;
|
||||||
import net.mcreator.target.init.TargetModItems;
|
import net.mcreator.target.init.TargetModItems;
|
||||||
import net.mcreator.target.init.TargetModSounds;
|
import net.mcreator.target.init.TargetModSounds;
|
||||||
import net.mcreator.target.item.AnimatedItem;
|
import net.mcreator.target.item.AnimatedItem;
|
||||||
import net.mcreator.target.procedures.AbekiriWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure;
|
import net.mcreator.target.tools.GunInfo;
|
||||||
|
import net.mcreator.target.tools.GunReload;
|
||||||
import net.mcreator.target.tools.GunsTool;
|
import net.mcreator.target.tools.GunsTool;
|
||||||
import net.mcreator.target.tools.TooltipTool;
|
import net.mcreator.target.tools.TooltipTool;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.HumanoidModel;
|
import net.minecraft.client.model.HumanoidModel;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
||||||
|
import net.minecraft.commands.CommandSource;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
@ -24,6 +28,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.*;
|
import net.minecraft.world.item.*;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
||||||
|
@ -163,9 +168,61 @@ public class Abekiri extends GunItem implements GeoItem, AnimatedItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
super.inventoryTick(itemStack, world, entity, slot, selected);
|
||||||
AbekiriWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure.execute(entity, itemstack);
|
|
||||||
|
if (entity instanceof Player player) {
|
||||||
|
var tag = itemStack.getOrCreateTag();
|
||||||
|
double id = tag.getDouble("id");
|
||||||
|
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 99) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:abekiri_reload_empty player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.SHOTGUN);
|
||||||
|
}
|
||||||
|
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") == 1) {
|
||||||
|
if (tag.getDouble("reload_time") == 83) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:abekiri_reload_normal player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.SHOTGUN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getGunInstance() {
|
public static ItemStack getGunInstance() {
|
||||||
|
|
|
@ -179,8 +179,8 @@ public class Devotion extends GunItem implements GeoItem, AnimatedItem {
|
||||||
if (itemTag.getDouble("reload_time") == 71) {
|
if (itemTag.getDouble("reload_time") == 71) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:devotion_reload_empty player @s ~ ~ ~ 100 1");
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:devotion_reload_empty player @s ~ ~ ~ 100 1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mainHandItem.getItem() == itemstack.getItem()
|
if (mainHandItem.getItem() == itemstack.getItem()
|
||||||
|
@ -200,8 +200,8 @@ public class Devotion extends GunItem implements GeoItem, AnimatedItem {
|
||||||
if (itemTag.getDouble("reload_time") == 51) {
|
if (itemTag.getDouble("reload_time") == 51) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:devotion_reload_normal player @s ~ ~ ~ 100 1");
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:devotion_reload_normal player @s ~ ~ ~ 100 1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mainHandItem.getItem() == itemstack.getItem()
|
if (mainHandItem.getItem() == itemstack.getItem()
|
||||||
|
|
|
@ -7,15 +7,19 @@ import net.mcreator.target.client.renderer.item.Hk416ItemRenderer;
|
||||||
import net.mcreator.target.init.TargetModItems;
|
import net.mcreator.target.init.TargetModItems;
|
||||||
import net.mcreator.target.init.TargetModSounds;
|
import net.mcreator.target.init.TargetModSounds;
|
||||||
import net.mcreator.target.item.AnimatedItem;
|
import net.mcreator.target.item.AnimatedItem;
|
||||||
import net.mcreator.target.procedures.Hk416WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure;
|
import net.mcreator.target.tools.GunInfo;
|
||||||
|
import net.mcreator.target.tools.GunReload;
|
||||||
import net.mcreator.target.tools.GunsTool;
|
import net.mcreator.target.tools.GunsTool;
|
||||||
import net.mcreator.target.tools.TooltipTool;
|
import net.mcreator.target.tools.TooltipTool;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.HumanoidModel;
|
import net.minecraft.client.model.HumanoidModel;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
||||||
|
import net.minecraft.commands.CommandSource;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
@ -24,6 +28,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.*;
|
import net.minecraft.world.item.*;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
||||||
|
@ -167,9 +172,66 @@ public class Hk416Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
super.inventoryTick(itemStack, world, entity, slot, selected);
|
||||||
Hk416WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure.execute(entity, itemstack);
|
|
||||||
|
if (entity instanceof Player player) {
|
||||||
|
double id;
|
||||||
|
var tag = itemStack.getOrCreateTag();
|
||||||
|
id = tag.getDouble("id");
|
||||||
|
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 55) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
{
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:hk_416_reload_empty player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
||||||
|
}
|
||||||
|
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 41) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
{
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:hk_416_reload_normal player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.RIFLE, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -180,8 +180,8 @@ public class HuntingRifle extends GunItem implements GeoItem, AnimatedItem {
|
||||||
if (itemTag.getDouble("reload_time") == 61) {
|
if (itemTag.getDouble("reload_time") == 61) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:hunting_rifle_reload player @s ~ ~ ~ 100 1");
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:hunting_rifle_reload player @s ~ ~ ~ 100 1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mainHandItem.getItem() == itemstack.getItem()
|
if (mainHandItem.getItem() == itemstack.getItem()
|
||||||
|
|
|
@ -7,16 +7,16 @@ import net.mcreator.target.client.renderer.item.KraberItemRenderer;
|
||||||
import net.mcreator.target.init.TargetModItems;
|
import net.mcreator.target.init.TargetModItems;
|
||||||
import net.mcreator.target.init.TargetModSounds;
|
import net.mcreator.target.init.TargetModSounds;
|
||||||
import net.mcreator.target.item.AnimatedItem;
|
import net.mcreator.target.item.AnimatedItem;
|
||||||
import net.mcreator.target.procedures.KraberWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure;
|
import net.mcreator.target.tools.*;
|
||||||
import net.mcreator.target.tools.GunsTool;
|
|
||||||
import net.mcreator.target.tools.RarityTool;
|
|
||||||
import net.mcreator.target.tools.TooltipTool;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.HumanoidModel;
|
import net.minecraft.client.model.HumanoidModel;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
||||||
|
import net.minecraft.commands.CommandSource;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
@ -25,6 +25,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.ItemDisplayContext;
|
import net.minecraft.world.item.ItemDisplayContext;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
@ -164,9 +165,63 @@ public class Kraber extends GunItem implements GeoItem, AnimatedItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
super.inventoryTick(itemStack, world, entity, slot, selected);
|
||||||
KraberWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure.execute(entity, itemstack);
|
|
||||||
|
if (entity instanceof Player player) {
|
||||||
|
var tag = itemStack.getOrCreateTag();
|
||||||
|
double id = tag.getDouble("id");
|
||||||
|
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 83) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:kraber_reload_empty player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.SNIPER);
|
||||||
|
}
|
||||||
|
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 65) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
{
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:kraber_reload_normal player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.SNIPER, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,15 +7,19 @@ import net.mcreator.target.client.renderer.item.M4ItemRenderer;
|
||||||
import net.mcreator.target.init.TargetModItems;
|
import net.mcreator.target.init.TargetModItems;
|
||||||
import net.mcreator.target.init.TargetModSounds;
|
import net.mcreator.target.init.TargetModSounds;
|
||||||
import net.mcreator.target.item.AnimatedItem;
|
import net.mcreator.target.item.AnimatedItem;
|
||||||
import net.mcreator.target.procedures.M4WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure;
|
import net.mcreator.target.tools.GunInfo;
|
||||||
|
import net.mcreator.target.tools.GunReload;
|
||||||
import net.mcreator.target.tools.GunsTool;
|
import net.mcreator.target.tools.GunsTool;
|
||||||
import net.mcreator.target.tools.TooltipTool;
|
import net.mcreator.target.tools.TooltipTool;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.HumanoidModel;
|
import net.minecraft.client.model.HumanoidModel;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
||||||
|
import net.minecraft.commands.CommandSource;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
@ -24,6 +28,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.*;
|
import net.minecraft.world.item.*;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
||||||
|
@ -167,9 +172,61 @@ public class M4Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
super.inventoryTick(itemStack, world, entity, slot, selected);
|
||||||
M4WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure.execute(entity, itemstack);
|
|
||||||
|
if (entity instanceof Player player) {
|
||||||
|
var tag = itemStack.getOrCreateTag();
|
||||||
|
double id = tag.getDouble("id");
|
||||||
|
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 55) {
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:m_4_reload_empty player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", tag.getDouble("reload_time") - 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
||||||
|
}
|
||||||
|
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 41) {
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:m_4_reload_normal player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", tag.getDouble("reload_time") - 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.RIFLE, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,15 +7,19 @@ import net.mcreator.target.client.renderer.item.M60ItemRenderer;
|
||||||
import net.mcreator.target.init.TargetModItems;
|
import net.mcreator.target.init.TargetModItems;
|
||||||
import net.mcreator.target.init.TargetModSounds;
|
import net.mcreator.target.init.TargetModSounds;
|
||||||
import net.mcreator.target.item.AnimatedItem;
|
import net.mcreator.target.item.AnimatedItem;
|
||||||
import net.mcreator.target.procedures.M60WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure;
|
import net.mcreator.target.tools.GunInfo;
|
||||||
|
import net.mcreator.target.tools.GunReload;
|
||||||
import net.mcreator.target.tools.GunsTool;
|
import net.mcreator.target.tools.GunsTool;
|
||||||
import net.mcreator.target.tools.TooltipTool;
|
import net.mcreator.target.tools.TooltipTool;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.HumanoidModel;
|
import net.minecraft.client.model.HumanoidModel;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
||||||
|
import net.minecraft.commands.CommandSource;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
@ -24,6 +28,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.*;
|
import net.minecraft.world.item.*;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
||||||
|
@ -149,9 +154,64 @@ public class M60Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
super.inventoryTick(itemStack, world, entity, slot, selected);
|
||||||
M60WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure.execute(entity, itemstack);
|
|
||||||
|
if (entity instanceof Player player) {
|
||||||
|
var tag = itemStack.getOrCreateTag();
|
||||||
|
double id = tag.getDouble("id");
|
||||||
|
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 129) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:m_60_reload_empty player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") <= 55) {
|
||||||
|
tag.putDouble("empty", 0);
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
||||||
|
}
|
||||||
|
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 111) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:m_60_reload_normal player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,15 +7,17 @@ import net.mcreator.target.client.renderer.item.M79ItemRenderer;
|
||||||
import net.mcreator.target.init.TargetModItems;
|
import net.mcreator.target.init.TargetModItems;
|
||||||
import net.mcreator.target.init.TargetModSounds;
|
import net.mcreator.target.init.TargetModSounds;
|
||||||
import net.mcreator.target.item.AnimatedItem;
|
import net.mcreator.target.item.AnimatedItem;
|
||||||
import net.mcreator.target.procedures.M79WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure;
|
|
||||||
import net.mcreator.target.tools.GunsTool;
|
import net.mcreator.target.tools.GunsTool;
|
||||||
import net.mcreator.target.tools.TooltipTool;
|
import net.mcreator.target.tools.TooltipTool;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.HumanoidModel;
|
import net.minecraft.client.model.HumanoidModel;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
||||||
|
import net.minecraft.commands.CommandSource;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
@ -170,12 +172,44 @@ public class M79Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
super.inventoryTick(itemStack, world, entity, slot, selected);
|
||||||
if (entity instanceof Player player) {
|
if (entity instanceof Player player) {
|
||||||
itemstack.getOrCreateTag().putInt("max_ammo", getAmmoCount(player));
|
itemStack.getOrCreateTag().putInt("max_ammo", getAmmoCount(player));
|
||||||
|
var tag = itemStack.getOrCreateTag();
|
||||||
|
double id = tag.getDouble("id");
|
||||||
|
int ammo1 = 1 - tag.getInt("ammo");
|
||||||
|
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getBoolean("reloading")) {
|
||||||
|
if (tag.getDouble("reload_time") == 86) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:m_79_reload player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", tag.getDouble("reload_time") - 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
tag.putInt("ammo", tag.getInt("ammo") + Math.min(ammo1, tag.getInt("max_ammo")));
|
||||||
|
player.getInventory().clearOrCountMatchingItems(p -> TargetModItems.GRENADE_40MM.get() == p.getItem(), 1, player.inventoryMenu.getCraftSlots());
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
M79WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure.execute(entity, itemstack);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static boolean check(ItemStack stack) {
|
protected static boolean check(ItemStack stack) {
|
||||||
|
|
|
@ -7,15 +7,18 @@ import net.mcreator.target.client.renderer.item.M870ItemRenderer;
|
||||||
import net.mcreator.target.init.TargetModItems;
|
import net.mcreator.target.init.TargetModItems;
|
||||||
import net.mcreator.target.init.TargetModSounds;
|
import net.mcreator.target.init.TargetModSounds;
|
||||||
import net.mcreator.target.item.AnimatedItem;
|
import net.mcreator.target.item.AnimatedItem;
|
||||||
import net.mcreator.target.procedures.M870WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure;
|
import net.mcreator.target.network.TargetModVariables;
|
||||||
import net.mcreator.target.tools.GunsTool;
|
import net.mcreator.target.tools.GunsTool;
|
||||||
import net.mcreator.target.tools.TooltipTool;
|
import net.mcreator.target.tools.TooltipTool;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.HumanoidModel;
|
import net.minecraft.client.model.HumanoidModel;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
||||||
|
import net.minecraft.commands.CommandSource;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
@ -24,6 +27,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.*;
|
import net.minecraft.world.item.*;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
||||||
|
@ -156,7 +160,74 @@ public class M870Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
@Override
|
@Override
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
super.inventoryTick(itemstack, world, entity, slot, selected);
|
||||||
M870WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure.execute(entity, itemstack);
|
if (entity instanceof Player player) {
|
||||||
|
var tag = itemstack.getOrCreateTag();
|
||||||
|
double id = tag.getDouble("id");
|
||||||
|
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
||||||
|
tag.putDouble("finish", 0);
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putDouble("prepare", 0);
|
||||||
|
tag.putDouble("loading", 0);
|
||||||
|
tag.putDouble("force_stop", 0);
|
||||||
|
tag.putDouble("stop", 0);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("prepare") > 0) {
|
||||||
|
tag.putDouble("prepare", tag.getDouble("prepare") - 1);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("loading") > 0) {
|
||||||
|
tag.putDouble("loading", tag.getDouble("loading") - 1);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("finish") > 0 && tag.getDouble("loading") == 0) {
|
||||||
|
tag.putDouble("finish", tag.getDouble("finish") - 1);
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
}
|
||||||
|
if (tag.getBoolean("reloading") && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("prepare") == 10 && tag.getBoolean("empty_reload")) {
|
||||||
|
tag.putInt("ammo", (tag.getInt("ammo") + 1));
|
||||||
|
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||||
|
capability.shotgunAmmo = capability.shotgunAmmo - 1;
|
||||||
|
capability.syncPlayerVariables(entity);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (tag.getDouble("prepare") == 0 && tag.getDouble("loading") == 0
|
||||||
|
&& !(tag.getInt("ammo") >= 8 || entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).map(c -> c.shotgunAmmo).orElse(0) == 0)) {
|
||||||
|
if (tag.getDouble("force_stop") == 1) {
|
||||||
|
tag.putDouble("stop", 1);
|
||||||
|
} else {
|
||||||
|
tag.putDouble("loading", 16);
|
||||||
|
|
||||||
|
player.getCooldowns().addCooldown(itemstack.getItem(), 16);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:m_870_reloadloop player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
tag.putBoolean("load_index", tag.getBoolean("load_index"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tag.getDouble("loading") == 9) {
|
||||||
|
tag.putInt("ammo", tag.getInt("ammo") + 1);
|
||||||
|
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||||
|
capability.shotgunAmmo = capability.shotgunAmmo - 1;
|
||||||
|
capability.syncPlayerVariables(entity);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if ((tag.getInt("ammo") >= 8 || (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo == 0)
|
||||||
|
&& tag.getDouble("loading") == 0 || tag.getDouble("stop") == 1) {
|
||||||
|
tag.putDouble("force_stop", 0);
|
||||||
|
tag.putDouble("stop", 0);
|
||||||
|
tag.putDouble("finish", 12);
|
||||||
|
player.getCooldowns().addCooldown(itemstack.getItem(), 12);
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tag.getDouble("firing") > 0) {
|
||||||
|
tag.putDouble("firing", tag.getDouble("firing") - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,15 +7,19 @@ import net.mcreator.target.client.renderer.item.M98bItemRenderer;
|
||||||
import net.mcreator.target.init.TargetModItems;
|
import net.mcreator.target.init.TargetModItems;
|
||||||
import net.mcreator.target.init.TargetModSounds;
|
import net.mcreator.target.init.TargetModSounds;
|
||||||
import net.mcreator.target.item.AnimatedItem;
|
import net.mcreator.target.item.AnimatedItem;
|
||||||
import net.mcreator.target.procedures.M98bWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure;
|
import net.mcreator.target.tools.GunInfo;
|
||||||
|
import net.mcreator.target.tools.GunReload;
|
||||||
import net.mcreator.target.tools.GunsTool;
|
import net.mcreator.target.tools.GunsTool;
|
||||||
import net.mcreator.target.tools.TooltipTool;
|
import net.mcreator.target.tools.TooltipTool;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.HumanoidModel;
|
import net.minecraft.client.model.HumanoidModel;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
||||||
|
import net.minecraft.commands.CommandSource;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
@ -24,6 +28,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.*;
|
import net.minecraft.world.item.*;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
||||||
|
@ -163,9 +168,61 @@ public class M98bItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
super.inventoryTick(itemStack, world, entity, slot, selected);
|
||||||
M98bWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure.execute(entity, itemstack);
|
|
||||||
|
if (entity instanceof Player player) {
|
||||||
|
var tag = itemStack.getOrCreateTag();
|
||||||
|
double id = tag.getDouble("id");
|
||||||
|
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 79) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:m_98b_reload_empty player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", tag.getDouble("reload_time") - 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.SNIPER);
|
||||||
|
}
|
||||||
|
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 57) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:m_98b_reload_normal player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.SNIPER, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,15 +7,18 @@ import net.mcreator.target.client.renderer.item.MarlinItemRenderer;
|
||||||
import net.mcreator.target.init.TargetModItems;
|
import net.mcreator.target.init.TargetModItems;
|
||||||
import net.mcreator.target.init.TargetModSounds;
|
import net.mcreator.target.init.TargetModSounds;
|
||||||
import net.mcreator.target.item.AnimatedItem;
|
import net.mcreator.target.item.AnimatedItem;
|
||||||
import net.mcreator.target.procedures.MarlinWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure;
|
import net.mcreator.target.network.TargetModVariables;
|
||||||
import net.mcreator.target.tools.GunsTool;
|
import net.mcreator.target.tools.GunsTool;
|
||||||
import net.mcreator.target.tools.TooltipTool;
|
import net.mcreator.target.tools.TooltipTool;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.HumanoidModel;
|
import net.minecraft.client.model.HumanoidModel;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
||||||
|
import net.minecraft.commands.CommandSource;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
@ -24,6 +27,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.*;
|
import net.minecraft.world.item.*;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
||||||
|
@ -163,7 +167,69 @@ public class MarlinItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
@Override
|
@Override
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
super.inventoryTick(itemstack, world, entity, slot, selected);
|
||||||
MarlinWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure.execute(entity, itemstack);
|
if (entity instanceof Player player) {
|
||||||
|
var tag = itemstack.getOrCreateTag();
|
||||||
|
double id = tag.getDouble("id");
|
||||||
|
tag.getInt("ammo");
|
||||||
|
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
||||||
|
tag.putDouble("finish", 0);
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putDouble("prepare", 0);
|
||||||
|
tag.putDouble("loading", 0);
|
||||||
|
tag.putDouble("force_stop", 0);
|
||||||
|
tag.putDouble("stop", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("prepare") > 0) {
|
||||||
|
tag.putDouble("prepare", tag.getDouble("prepare") - 1);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("loading") > 0) {
|
||||||
|
tag.putDouble("loading", tag.getDouble("loading") - 1);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("finish") > 0 && tag.getDouble("loading") == 0) {
|
||||||
|
tag.putDouble("finish", tag.getDouble("finish") - 1);
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
}
|
||||||
|
if (tag.getBoolean("reloading") && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("prepare") == 0 && tag.getDouble("loading") == 0
|
||||||
|
&& !(tag.getInt("ammo") >= 8 || (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo == 0)) {
|
||||||
|
if (tag.getDouble("force_stop") == 1) {
|
||||||
|
tag.putDouble("stop", 1);
|
||||||
|
} else {
|
||||||
|
tag.putDouble("loading", 16);
|
||||||
|
player.getCooldowns().addCooldown(itemstack.getItem(), 16);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:marlin_loop player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
tag.putBoolean("load_index", tag.getBoolean("load_index"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tag.getDouble("loading") == 9) {
|
||||||
|
tag.putInt("ammo", (tag.getInt("ammo") + 1));
|
||||||
|
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||||
|
capability.rifleAmmo = entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).map(c -> c.rifleAmmo).orElse(0) - 1;
|
||||||
|
capability.syncPlayerVariables(entity);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if ((tag.getInt("ammo") >= 8 || entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).map(c -> c.rifleAmmo).orElse(0) == 0)
|
||||||
|
&& tag.getDouble("loading") == 0 || tag.getDouble("stop") == 1) {
|
||||||
|
tag.putDouble("force_stop", 0);
|
||||||
|
tag.putDouble("stop", 0);
|
||||||
|
tag.putDouble("finish", 19);
|
||||||
|
player.getCooldowns().addCooldown(itemstack.getItem(), 19);
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:marlin_end player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tag.getDouble("firing") > 0) {
|
||||||
|
tag.putDouble("firing", (tag.getDouble("firing") - 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,15 +7,19 @@ import net.mcreator.target.client.renderer.item.Mk14ItemRenderer;
|
||||||
import net.mcreator.target.init.TargetModItems;
|
import net.mcreator.target.init.TargetModItems;
|
||||||
import net.mcreator.target.init.TargetModSounds;
|
import net.mcreator.target.init.TargetModSounds;
|
||||||
import net.mcreator.target.item.AnimatedItem;
|
import net.mcreator.target.item.AnimatedItem;
|
||||||
import net.mcreator.target.procedures.Mk14WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure;
|
import net.mcreator.target.tools.GunInfo;
|
||||||
|
import net.mcreator.target.tools.GunReload;
|
||||||
import net.mcreator.target.tools.GunsTool;
|
import net.mcreator.target.tools.GunsTool;
|
||||||
import net.mcreator.target.tools.TooltipTool;
|
import net.mcreator.target.tools.TooltipTool;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.HumanoidModel;
|
import net.minecraft.client.model.HumanoidModel;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
||||||
|
import net.minecraft.commands.CommandSource;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
@ -24,6 +28,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.*;
|
import net.minecraft.world.item.*;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
||||||
|
@ -145,9 +150,63 @@ public class Mk14Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
super.inventoryTick(itemStack, world, entity, slot, selected);
|
||||||
Mk14WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure.execute(entity, itemstack);
|
if (entity instanceof Player player) {
|
||||||
|
var tag = itemStack.getOrCreateTag();
|
||||||
|
double id = tag.getDouble("id");
|
||||||
|
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 55) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:mk_14_reload_empty player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", tag.getDouble("reload_time") - 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 5 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
tag.putDouble("gj", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
||||||
|
}
|
||||||
|
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 45) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:mk_14_reload_normal player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", tag.getDouble("reload_time") - 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.RIFLE, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,15 +7,17 @@ import net.mcreator.target.client.renderer.item.RpgItemRenderer;
|
||||||
import net.mcreator.target.init.TargetModItems;
|
import net.mcreator.target.init.TargetModItems;
|
||||||
import net.mcreator.target.init.TargetModSounds;
|
import net.mcreator.target.init.TargetModSounds;
|
||||||
import net.mcreator.target.item.AnimatedItem;
|
import net.mcreator.target.item.AnimatedItem;
|
||||||
import net.mcreator.target.procedures.RpgWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure;
|
|
||||||
import net.mcreator.target.tools.GunsTool;
|
import net.mcreator.target.tools.GunsTool;
|
||||||
import net.mcreator.target.tools.TooltipTool;
|
import net.mcreator.target.tools.TooltipTool;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.HumanoidModel;
|
import net.minecraft.client.model.HumanoidModel;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
||||||
|
import net.minecraft.commands.CommandSource;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
@ -78,16 +80,16 @@ public class RpgItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
|
|
||||||
if (this.animationProcedure.equals("empty")) {
|
if (this.animationProcedure.equals("empty")) {
|
||||||
|
var tag = stack.getOrCreateTag();
|
||||||
if (stack.getOrCreateTag().getInt("draw_time") < 16) {
|
if (tag.getInt("draw_time") < 16) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.rpg.draw"));
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.rpg.draw"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getInt("fire_animation") > 0) {
|
if (tag.getInt("fire_animation") > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.rpg.fire"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.rpg.fire"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (tag.getBoolean("reloading") && tag.getBoolean("empty_reload")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.rpg.reload"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.rpg.reload"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,9 +119,9 @@ public class RpgItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
|
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
|
||||||
AnimationController procedureController = new AnimationController(this, "procedureController", 0, this::procedurePredicate);
|
var procedureController = new AnimationController<>(this, "procedureController", 0, this::procedurePredicate);
|
||||||
data.add(procedureController);
|
data.add(procedureController);
|
||||||
AnimationController idleController = new AnimationController(this, "idleController", 4, this::idlePredicate);
|
var idleController = new AnimationController<>(this, "idleController", 4, this::idlePredicate);
|
||||||
data.add(idleController);
|
data.add(idleController);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,12 +174,51 @@ public class RpgItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
super.inventoryTick(itemStack, world, entity, slot, selected);
|
||||||
|
|
||||||
if (entity instanceof Player player) {
|
if (entity instanceof Player player) {
|
||||||
itemstack.getOrCreateTag().putInt("max_ammo", getAmmoCount(player));
|
var tag = itemStack.getOrCreateTag();
|
||||||
|
tag.putInt("max_ammo", getAmmoCount(player));
|
||||||
|
|
||||||
|
double id = tag.getDouble("id");
|
||||||
|
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getBoolean("reloading")) {
|
||||||
|
if (tag.getDouble("reload_time") == 91) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
if (entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:rpg_reload player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", tag.getDouble("reload_time") - 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 84) {
|
||||||
|
tag.putDouble("empty", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getInt("max_ammo") >= 0) {
|
||||||
|
tag.putInt("ammo", 1);
|
||||||
|
player.getInventory().clearOrCountMatchingItems(p -> TargetModItems.ROCKET.get() == p.getItem(), 1, player.inventoryMenu.getCraftSlots());
|
||||||
|
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
RpgWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure.execute(entity, itemstack);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static boolean check(ItemStack stack) {
|
protected static boolean check(ItemStack stack) {
|
||||||
|
|
|
@ -7,15 +7,19 @@ import net.mcreator.target.client.renderer.item.RpkItemRenderer;
|
||||||
import net.mcreator.target.init.TargetModItems;
|
import net.mcreator.target.init.TargetModItems;
|
||||||
import net.mcreator.target.init.TargetModSounds;
|
import net.mcreator.target.init.TargetModSounds;
|
||||||
import net.mcreator.target.item.AnimatedItem;
|
import net.mcreator.target.item.AnimatedItem;
|
||||||
import net.mcreator.target.procedures.RpkWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure;
|
import net.mcreator.target.tools.GunInfo;
|
||||||
|
import net.mcreator.target.tools.GunReload;
|
||||||
import net.mcreator.target.tools.GunsTool;
|
import net.mcreator.target.tools.GunsTool;
|
||||||
import net.mcreator.target.tools.TooltipTool;
|
import net.mcreator.target.tools.TooltipTool;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.HumanoidModel;
|
import net.minecraft.client.model.HumanoidModel;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
||||||
|
import net.minecraft.commands.CommandSource;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
@ -24,6 +28,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.*;
|
import net.minecraft.world.item.*;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
||||||
|
@ -169,7 +174,60 @@ public class RpkItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
@Override
|
@Override
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
super.inventoryTick(itemstack, world, entity, slot, selected);
|
||||||
RpkWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure.execute(entity, itemstack);
|
|
||||||
|
if (entity instanceof Player player) {
|
||||||
|
var tag = itemstack.getOrCreateTag();
|
||||||
|
double id = tag.getDouble("id");
|
||||||
|
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 83) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:rpk_reload_empty player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemstack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
||||||
|
}
|
||||||
|
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 66) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:rpk_reload_normal player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemstack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", tag.getDouble("reload_time") - 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.RIFLE, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,17 +7,16 @@ import net.mcreator.target.client.renderer.item.SentinelItemRenderer;
|
||||||
import net.mcreator.target.init.TargetModItems;
|
import net.mcreator.target.init.TargetModItems;
|
||||||
import net.mcreator.target.init.TargetModSounds;
|
import net.mcreator.target.init.TargetModSounds;
|
||||||
import net.mcreator.target.item.AnimatedItem;
|
import net.mcreator.target.item.AnimatedItem;
|
||||||
import net.mcreator.target.procedures.SentinelWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure;
|
import net.mcreator.target.tools.*;
|
||||||
import net.mcreator.target.tools.GunsTool;
|
|
||||||
import net.mcreator.target.tools.ItemNBTTool;
|
|
||||||
import net.mcreator.target.tools.RarityTool;
|
|
||||||
import net.mcreator.target.tools.TooltipTool;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.HumanoidModel;
|
import net.minecraft.client.model.HumanoidModel;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
||||||
|
import net.minecraft.commands.CommandSource;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
@ -26,6 +25,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.ItemDisplayContext;
|
import net.minecraft.world.item.ItemDisplayContext;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
@ -174,9 +174,106 @@ public class SentinelItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
super.inventoryTick(itemStack, world, entity, slot, selected);
|
||||||
SentinelWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure.execute(entity, itemstack);
|
if (entity instanceof Player player) {
|
||||||
|
double cid;
|
||||||
|
var tag = itemStack.getOrCreateTag();
|
||||||
|
double id = tag.getDouble("id");
|
||||||
|
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 73) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:sentinel_reload_empty player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.SNIPER);
|
||||||
|
}
|
||||||
|
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 53) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:sentinel_reload_normal player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.SNIPER, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tag.getDouble("firing") > 0) {
|
||||||
|
tag.putDouble("firing", tag.getDouble("firing") - 1);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("zoom_firing") > 0) {
|
||||||
|
tag.putDouble("zoom_firing", tag.getDouble("zoom_firing") - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
cid = tag.getDouble("cid");
|
||||||
|
if (player.getMainHandItem().getOrCreateTag().getDouble("cid") != tag.getDouble("cid")) {
|
||||||
|
tag.putDouble("charging", 0);
|
||||||
|
tag.putDouble("charging_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("charging") == 1) {
|
||||||
|
if (tag.getDouble("charging_time") == 127) {
|
||||||
|
entity.getPersistentData().putDouble("cid", cid);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:sentinel_charge player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("cid") == cid) {
|
||||||
|
if (tag.getDouble("charging_time") > 0) {
|
||||||
|
tag.putDouble("charging_time", tag.getDouble("charging_time") - 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putDouble("charging", 0);
|
||||||
|
tag.putDouble("charging_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("charging_time") == 16 && player.getMainHandItem().getOrCreateTag().getDouble("cid") == cid) {
|
||||||
|
tag.putDouble("power", 100);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("charging_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("cid") == cid) {
|
||||||
|
tag.putDouble("charging", 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tag.getDouble("power") > 0) {
|
||||||
|
tag.putDouble("add_damage", 10);
|
||||||
|
tag.putDouble("power", tag.getDouble("power") - 0.025);
|
||||||
|
} else {
|
||||||
|
tag.putDouble("add_damage", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("crot") > 0) {
|
||||||
|
tag.putDouble("crot", tag.getDouble("crot") - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -226,6 +323,7 @@ public class SentinelItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
public ResourceLocation getGunIcon() {
|
public ResourceLocation getGunIcon() {
|
||||||
return new ResourceLocation(TargetMod.MODID, "textures/gun_icon/sentinel_icon.png");
|
return new ResourceLocation(TargetMod.MODID, "textures/gun_icon/sentinel_icon.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGunDisplayName() {
|
public String getGunDisplayName() {
|
||||||
return "SENTINEL";
|
return "SENTINEL";
|
||||||
|
|
|
@ -7,15 +7,19 @@ import net.mcreator.target.client.renderer.item.SksItemRenderer;
|
||||||
import net.mcreator.target.init.TargetModItems;
|
import net.mcreator.target.init.TargetModItems;
|
||||||
import net.mcreator.target.init.TargetModSounds;
|
import net.mcreator.target.init.TargetModSounds;
|
||||||
import net.mcreator.target.item.AnimatedItem;
|
import net.mcreator.target.item.AnimatedItem;
|
||||||
import net.mcreator.target.procedures.SksWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure;
|
import net.mcreator.target.tools.GunInfo;
|
||||||
|
import net.mcreator.target.tools.GunReload;
|
||||||
import net.mcreator.target.tools.GunsTool;
|
import net.mcreator.target.tools.GunsTool;
|
||||||
import net.mcreator.target.tools.TooltipTool;
|
import net.mcreator.target.tools.TooltipTool;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.HumanoidModel;
|
import net.minecraft.client.model.HumanoidModel;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
||||||
|
import net.minecraft.commands.CommandSource;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
@ -24,6 +28,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.*;
|
import net.minecraft.world.item.*;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
||||||
|
@ -164,9 +169,63 @@ public class SksItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
super.inventoryTick(itemStack, world, entity, slot, selected);
|
||||||
SksWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure.execute(entity, itemstack);
|
if (entity instanceof Player player) {
|
||||||
|
var tag = itemStack.getOrCreateTag();
|
||||||
|
double id = tag.getDouble("id");
|
||||||
|
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 57) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:sks_reload_empty player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 14 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
tag.putDouble("gj", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
||||||
|
}
|
||||||
|
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 41) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:sks_reload_normal player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", tag.getDouble("reload_time") - 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.RIFLE, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getGunInstance() {
|
public static ItemStack getGunInstance() {
|
||||||
|
|
|
@ -7,15 +7,19 @@ import net.mcreator.target.client.renderer.item.SvdItemRenderer;
|
||||||
import net.mcreator.target.init.TargetModItems;
|
import net.mcreator.target.init.TargetModItems;
|
||||||
import net.mcreator.target.init.TargetModSounds;
|
import net.mcreator.target.init.TargetModSounds;
|
||||||
import net.mcreator.target.item.AnimatedItem;
|
import net.mcreator.target.item.AnimatedItem;
|
||||||
import net.mcreator.target.procedures.SvdWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure;
|
import net.mcreator.target.tools.GunInfo;
|
||||||
|
import net.mcreator.target.tools.GunReload;
|
||||||
import net.mcreator.target.tools.GunsTool;
|
import net.mcreator.target.tools.GunsTool;
|
||||||
import net.mcreator.target.tools.TooltipTool;
|
import net.mcreator.target.tools.TooltipTool;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.HumanoidModel;
|
import net.minecraft.client.model.HumanoidModel;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
||||||
|
import net.minecraft.commands.CommandSource;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
@ -24,6 +28,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.*;
|
import net.minecraft.world.item.*;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
||||||
|
@ -138,9 +143,63 @@ public class SvdItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
super.inventoryTick(itemStack, world, entity, slot, selected);
|
||||||
SvdWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure.execute(entity, itemstack);
|
if (entity instanceof Player player) {
|
||||||
|
var tag = itemStack.getOrCreateTag();
|
||||||
|
double id = tag.getDouble("id");
|
||||||
|
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 66) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:svd_reload_empty player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 14 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
tag.putDouble("gj", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.SNIPER);
|
||||||
|
}
|
||||||
|
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
|
||||||
|
if (tag.getDouble("reload_time") == 55) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:svd_reload_normal player @s ~ ~ ~ 100 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||||
|
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
if (tag.getDouble("reload_time") > 0) {
|
||||||
|
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tag.putBoolean("reloading", false);
|
||||||
|
tag.putBoolean("empty_reload", false);
|
||||||
|
tag.putDouble("reload_time", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.SNIPER, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -176,8 +176,8 @@ public class Trachelium extends GunItem implements GeoItem, AnimatedItem {
|
||||||
if (itemTag.getDouble("reload_time") == 57) {
|
if (itemTag.getDouble("reload_time") == 57) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:trachelium_reload player @s ~ ~ ~ 100 1");
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:trachelium_reload player @s ~ ~ ~ 100 1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mainHandItem.getItem() == itemstack.getItem()
|
if (mainHandItem.getItem() == itemstack.getItem()
|
||||||
|
|
|
@ -1,71 +0,0 @@
|
||||||
package net.mcreator.target.procedures;
|
|
||||||
|
|
||||||
import net.mcreator.target.tools.GunInfo;
|
|
||||||
import net.mcreator.target.tools.GunReload;
|
|
||||||
import net.minecraft.commands.CommandSource;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
|
|
||||||
public class AK47WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
|
||||||
public static void execute(Entity entity, ItemStack itemstack) {
|
|
||||||
if (entity == null)
|
|
||||||
return;
|
|
||||||
double id = 0;
|
|
||||||
id = itemstack.getOrCreateTag().getDouble("id");
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 57) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
{
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:ak_47_reload_empty player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
|
||||||
}
|
|
||||||
} else if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") > 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 41) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
{
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:ak_47_reload_normal player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.RIFLE, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,68 +0,0 @@
|
||||||
package net.mcreator.target.procedures;
|
|
||||||
|
|
||||||
import net.mcreator.target.tools.GunInfo;
|
|
||||||
import net.mcreator.target.tools.GunReload;
|
|
||||||
import net.minecraft.commands.CommandSource;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
|
|
||||||
public class Aa12WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
|
||||||
public static void execute(Entity entity, ItemStack itemstack) {
|
|
||||||
double id = itemstack.getOrCreateTag().getDouble("id");
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 55) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
{
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:aa_12_reload_empty player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.SHOTGUN);
|
|
||||||
}
|
|
||||||
} else if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") > 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 44) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
{
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:aa_12_reload_normal player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.SHOTGUN, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,73 +0,0 @@
|
||||||
package net.mcreator.target.procedures;
|
|
||||||
|
|
||||||
import net.mcreator.target.tools.GunInfo;
|
|
||||||
import net.mcreator.target.tools.GunReload;
|
|
||||||
import net.minecraft.commands.CommandSource;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
|
|
||||||
public class AbekiriWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
|
||||||
public static void execute(Entity entity, ItemStack itemstack) {
|
|
||||||
if (entity == null)
|
|
||||||
return;
|
|
||||||
int ammo1 = 0;
|
|
||||||
double id = 0;
|
|
||||||
id = itemstack.getOrCreateTag().getDouble("id");
|
|
||||||
ammo1 = 2 - itemstack.getOrCreateTag().getInt("ammo");
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 99) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
{
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:abekiri_reload_empty player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.SHOTGUN);
|
|
||||||
}
|
|
||||||
} else if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") == 1) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 83) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
{
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:abekiri_reload_normal player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.SHOTGUN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,71 +0,0 @@
|
||||||
package net.mcreator.target.procedures;
|
|
||||||
|
|
||||||
import net.mcreator.target.tools.GunInfo;
|
|
||||||
import net.mcreator.target.tools.GunReload;
|
|
||||||
import net.minecraft.commands.CommandSource;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
|
|
||||||
public class Hk416WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
|
||||||
public static void execute(Entity entity, ItemStack itemstack) {
|
|
||||||
if (entity == null)
|
|
||||||
return;
|
|
||||||
double id;
|
|
||||||
id = itemstack.getOrCreateTag().getDouble("id");
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 55) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
{
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:hk_416_reload_empty player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
|
||||||
}
|
|
||||||
} else if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") > 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 41) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
{
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:hk_416_reload_normal player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.RIFLE, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,71 +0,0 @@
|
||||||
package net.mcreator.target.procedures;
|
|
||||||
|
|
||||||
import net.mcreator.target.tools.GunInfo;
|
|
||||||
import net.mcreator.target.tools.GunReload;
|
|
||||||
import net.minecraft.commands.CommandSource;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
|
|
||||||
public class KraberWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
|
||||||
public static void execute(Entity entity, ItemStack itemstack) {
|
|
||||||
if (entity == null)
|
|
||||||
return;
|
|
||||||
double id = 0;
|
|
||||||
id = itemstack.getOrCreateTag().getDouble("id");
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 83) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
{
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:kraber_reload_empty player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.SNIPER);
|
|
||||||
}
|
|
||||||
} else if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") > 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 65) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
{
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:kraber_reload_normal player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.SNIPER, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,71 +0,0 @@
|
||||||
package net.mcreator.target.procedures;
|
|
||||||
|
|
||||||
import net.mcreator.target.tools.GunInfo;
|
|
||||||
import net.mcreator.target.tools.GunReload;
|
|
||||||
import net.minecraft.commands.CommandSource;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
|
|
||||||
public class M4WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
|
||||||
public static void execute(Entity entity, ItemStack itemstack) {
|
|
||||||
if (entity == null)
|
|
||||||
return;
|
|
||||||
double id;
|
|
||||||
id = itemstack.getOrCreateTag().getDouble("id");
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 55) {
|
|
||||||
{
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:m_4_reload_empty player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
|
||||||
}
|
|
||||||
} else if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") > 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 41) {
|
|
||||||
{
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:m_4_reload_normal player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.RIFLE, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,74 +0,0 @@
|
||||||
package net.mcreator.target.procedures;
|
|
||||||
|
|
||||||
import net.mcreator.target.tools.GunInfo;
|
|
||||||
import net.mcreator.target.tools.GunReload;
|
|
||||||
import net.minecraft.commands.CommandSource;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
|
|
||||||
public class M60WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
|
||||||
public static void execute(Entity entity, ItemStack itemstack) {
|
|
||||||
if (entity == null)
|
|
||||||
return;
|
|
||||||
double id = 0;
|
|
||||||
id = itemstack.getOrCreateTag().getDouble("id");
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 129) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
{
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:m_60_reload_empty player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") <= 55) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("empty", 0);
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
|
||||||
}
|
|
||||||
} else if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") > 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 111) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
{
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:m_60_reload_normal player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,64 +0,0 @@
|
||||||
package net.mcreator.target.procedures;
|
|
||||||
|
|
||||||
import net.mcreator.target.init.TargetModItems;
|
|
||||||
import net.minecraft.commands.CommandSource;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
|
|
||||||
public class M79WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
|
||||||
public static void execute(Entity entity, ItemStack itemstack) {
|
|
||||||
if (entity == null)
|
|
||||||
return;
|
|
||||||
double id = itemstack.getOrCreateTag().getDouble("id");
|
|
||||||
int ammo1 = 1 - itemstack.getOrCreateTag().getInt("ammo");
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getBoolean("reloading")) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 86) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
{
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:m_79_reload player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getInt("max_ammo") >= ammo1) {
|
|
||||||
itemstack.getOrCreateTag().putInt("ammo", (itemstack.getOrCreateTag().getInt("ammo") + ammo1));
|
|
||||||
if (entity instanceof Player _player) {
|
|
||||||
ItemStack _stktoremove = new ItemStack(TargetModItems.GRENADE_40MM.get());
|
|
||||||
_player.getInventory().clearOrCountMatchingItems(p -> _stktoremove.getItem() == p.getItem(), 1, _player.inventoryMenu.getCraftSlots());
|
|
||||||
}
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putInt("ammo", (itemstack.getOrCreateTag().getInt("ammo") + itemstack.getOrCreateTag().getInt("max_ammo")));
|
|
||||||
if (entity instanceof Player _player) {
|
|
||||||
ItemStack _stktoremove = new ItemStack(TargetModItems.GRENADE_40MM.get());
|
|
||||||
_player.getInventory().clearOrCountMatchingItems(p -> _stktoremove.getItem() == p.getItem(), 1, _player.inventoryMenu.getCraftSlots());
|
|
||||||
}
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -50,22 +50,22 @@ public class M79fireProcedure {
|
||||||
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
entity.getServer().getCommands().performPrefixedCommand(
|
entity.getServer().getCommands().performPrefixedCommand(
|
||||||
new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4, entity.getName().getString(), entity.getDisplayName(),
|
new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4, entity.getName().getString(), entity.getDisplayName(),
|
||||||
entity.level().getServer(), entity),
|
entity.getServer(), entity),
|
||||||
("particle minecraft:cloud" + (" " + (entity.getX() + 1.8 * entity.getLookAngle().x)) + (" " + (entity.getY() + entity.getBbHeight() - 0.1 + 1.8 * entity.getLookAngle().y))
|
("particle minecraft:cloud" + (" " + (entity.getX() + 1.8 * entity.getLookAngle().x)) + (" " + (entity.getY() + entity.getBbHeight() - 0.1 + 1.8 * entity.getLookAngle().y))
|
||||||
+ (" " + (entity.getZ() + 1.8 * entity.getLookAngle().z)) + " 0.1 0.1 0.1 0.002 4 force @s"));
|
+ (" " + (entity.getZ() + 1.8 * entity.getLookAngle().z)) + " 0.1 0.1 0.1 0.002 4 force @s"));
|
||||||
}
|
}
|
||||||
player.getCooldowns().addCooldown(usehand.getItem(), 15);
|
player.getCooldowns().addCooldown(usehand.getItem(), 15);
|
||||||
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:m_79_fire_1p player @s ~ ~ ~ 2 1");
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:m_79_fire_1p player @s ~ ~ ~ 2 1");
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:m_79_fire_3p player @a ~ ~ ~ 4 1");
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:m_79_fire_3p player @a ~ ~ ~ 4 1");
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:m_79_far player @s ~ ~ ~ 6 1");
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:m_79_far player @s ~ ~ ~ 6 1");
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:m_79_veryfar player @a ~ ~ ~ 12 1");
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:m_79_veryfar player @a ~ ~ ~ 12 1");
|
||||||
}
|
}
|
||||||
usehand.getOrCreateTag().putInt("fire_animation", 2);
|
usehand.getOrCreateTag().putInt("fire_animation", 2);
|
||||||
usehand.getOrCreateTag().putInt("ammo", (usehand.getOrCreateTag().getInt("ammo") - 1));
|
usehand.getOrCreateTag().putInt("ammo", (usehand.getOrCreateTag().getInt("ammo") - 1));
|
||||||
|
|
|
@ -1,98 +0,0 @@
|
||||||
package net.mcreator.target.procedures;
|
|
||||||
|
|
||||||
import net.mcreator.target.network.TargetModVariables;
|
|
||||||
import net.minecraft.commands.CommandSource;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
|
|
||||||
public class M870WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
|
||||||
public static void execute(Entity entity, ItemStack itemstack) {
|
|
||||||
if (entity == null)
|
|
||||||
return;
|
|
||||||
double ammo1 = 0;
|
|
||||||
double id = 0;
|
|
||||||
id = itemstack.getOrCreateTag().getDouble("id");
|
|
||||||
ammo1 = 8 - itemstack.getOrCreateTag().getInt("ammo");
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("finish", 0);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("prepare", 0);
|
|
||||||
itemstack.getOrCreateTag().putDouble("loading", 0);
|
|
||||||
itemstack.getOrCreateTag().putDouble("forcestop", 0);
|
|
||||||
itemstack.getOrCreateTag().putDouble("stop", 0);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("prepare") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("prepare", (itemstack.getOrCreateTag().getDouble("prepare") - 1));
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("loading") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("loading", (itemstack.getOrCreateTag().getDouble("loading") - 1));
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("finish") > 0 && itemstack.getOrCreateTag().getDouble("loading") == 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("finish", (itemstack.getOrCreateTag().getDouble("finish") - 1));
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getBoolean("reloading") && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("prepare") == 10 && itemstack.getOrCreateTag().getBoolean("empty_reload")) {
|
|
||||||
itemstack.getOrCreateTag().putInt("ammo", (itemstack.getOrCreateTag().getInt("ammo") + 1));
|
|
||||||
{
|
|
||||||
int _setval = (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo - 1;
|
|
||||||
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
|
||||||
capability.shotgunAmmo = _setval;
|
|
||||||
capability.syncPlayerVariables(entity);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("prepare") == 0 && itemstack.getOrCreateTag().getDouble("loading") == 0
|
|
||||||
&& !(itemstack.getOrCreateTag().getInt("ammo") >= 8 || (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo == 0)) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("forcestop") == 1) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("stop", 1);
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putDouble("loading", 16);
|
|
||||||
if (entity instanceof Player _player)
|
|
||||||
_player.getCooldowns().addCooldown(itemstack.getItem(), 16);
|
|
||||||
{
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:m_870_reloadloop player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getBoolean("load_index")) {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("load_index", true);
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("load_index", false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("loading") == 9) {
|
|
||||||
itemstack.getOrCreateTag().putInt("ammo", (itemstack.getOrCreateTag().getInt("ammo") + 1));
|
|
||||||
{
|
|
||||||
int _setval = (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo - 1;
|
|
||||||
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
|
||||||
capability.shotgunAmmo = _setval;
|
|
||||||
capability.syncPlayerVariables(entity);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((itemstack.getOrCreateTag().getInt("ammo") >= 8 || (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo == 0)
|
|
||||||
&& itemstack.getOrCreateTag().getDouble("loading") == 0 || itemstack.getOrCreateTag().getDouble("stop") == 1) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("forcestop", 0);
|
|
||||||
itemstack.getOrCreateTag().putDouble("stop", 0);
|
|
||||||
itemstack.getOrCreateTag().putDouble("finish", 12);
|
|
||||||
if (entity instanceof Player _player)
|
|
||||||
_player.getCooldowns().addCooldown(itemstack.getItem(), 12);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("firing") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("firing", (itemstack.getOrCreateTag().getDouble("firing") - 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -14,7 +14,7 @@ public class M870fireProcedure {
|
||||||
|
|
||||||
ItemStack usehand = player.getMainHandItem();
|
ItemStack usehand = player.getMainHandItem();
|
||||||
if (usehand.getOrCreateTag().getBoolean("reloading") && usehand.getOrCreateTag().getDouble("prepare") == 0 && usehand.getOrCreateTag().getInt("ammo") > 0) {
|
if (usehand.getOrCreateTag().getBoolean("reloading") && usehand.getOrCreateTag().getDouble("prepare") == 0 && usehand.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
usehand.getOrCreateTag().putDouble("forcestop", 1);
|
usehand.getOrCreateTag().putDouble("force_stop", 1);
|
||||||
}
|
}
|
||||||
if (usehand.getItem() == TargetModItems.M_870.get() && !usehand.getOrCreateTag().getBoolean("reloading") && !player.getCooldowns().isOnCooldown(usehand.getItem())
|
if (usehand.getItem() == TargetModItems.M_870.get() && !usehand.getOrCreateTag().getBoolean("reloading") && !player.getCooldowns().isOnCooldown(usehand.getItem())
|
||||||
&& usehand.getOrCreateTag().getInt("ammo") > 0) {
|
&& usehand.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
|
|
|
@ -1,75 +0,0 @@
|
||||||
package net.mcreator.target.procedures;
|
|
||||||
|
|
||||||
import net.mcreator.target.tools.GunInfo;
|
|
||||||
import net.mcreator.target.tools.GunReload;
|
|
||||||
import net.minecraft.commands.CommandSource;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
|
|
||||||
public class M98bWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
|
||||||
public static void execute(Entity entity, ItemStack itemstack) {
|
|
||||||
if (entity == null)
|
|
||||||
return;
|
|
||||||
double ammo1 = 0;
|
|
||||||
double id = 0;
|
|
||||||
double ammo2 = 0;
|
|
||||||
id = itemstack.getOrCreateTag().getDouble("id");
|
|
||||||
ammo1 = 5 - itemstack.getOrCreateTag().getInt("ammo");
|
|
||||||
ammo2 = 6 - itemstack.getOrCreateTag().getInt("ammo");
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 79) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
{
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:m_98b_reload_empty player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.SNIPER);
|
|
||||||
}
|
|
||||||
} else if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") > 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 57) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
{
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:m_98b_reload_normal player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.SNIPER, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,90 +0,0 @@
|
||||||
package net.mcreator.target.procedures;
|
|
||||||
|
|
||||||
import net.mcreator.target.network.TargetModVariables;
|
|
||||||
import net.minecraft.commands.CommandSource;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
|
|
||||||
public class MarlinWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
|
||||||
public static void execute(Entity entity, ItemStack itemstack) {
|
|
||||||
if (entity == null)
|
|
||||||
return;
|
|
||||||
double id = itemstack.getOrCreateTag().getDouble("id");
|
|
||||||
itemstack.getOrCreateTag().getInt("ammo");
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("finish", 0);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("prepare", 0);
|
|
||||||
itemstack.getOrCreateTag().putDouble("loading", 0);
|
|
||||||
itemstack.getOrCreateTag().putDouble("forcestop", 0);
|
|
||||||
itemstack.getOrCreateTag().putDouble("stop", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("prepare") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("prepare", (itemstack.getOrCreateTag().getDouble("prepare") - 1));
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("loading") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("loading", (itemstack.getOrCreateTag().getDouble("loading") - 1));
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("finish") > 0 && itemstack.getOrCreateTag().getDouble("loading") == 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("finish", (itemstack.getOrCreateTag().getDouble("finish") - 1));
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getBoolean("reloading") && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("prepare") == 0 && itemstack.getOrCreateTag().getDouble("loading") == 0
|
|
||||||
&& !(itemstack.getOrCreateTag().getInt("ammo") >= 8 || (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo == 0)) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("forcestop") == 1) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("stop", 1);
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putDouble("loading", 16);
|
|
||||||
if (entity instanceof Player _player)
|
|
||||||
_player.getCooldowns().addCooldown(itemstack.getItem(), 16);
|
|
||||||
{
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:marlin_loop player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getBoolean("load_index")) {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("load_index", true);
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("load_index", false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("loading") == 9) {
|
|
||||||
itemstack.getOrCreateTag().putInt("ammo", (itemstack.getOrCreateTag().getInt("ammo") + 1));
|
|
||||||
{
|
|
||||||
int _setval = (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo - 1;
|
|
||||||
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
|
||||||
capability.rifleAmmo = _setval;
|
|
||||||
capability.syncPlayerVariables(entity);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((itemstack.getOrCreateTag().getInt("ammo") >= 8 || (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo == 0)
|
|
||||||
&& itemstack.getOrCreateTag().getDouble("loading") == 0 || itemstack.getOrCreateTag().getDouble("stop") == 1) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("forcestop", 0);
|
|
||||||
itemstack.getOrCreateTag().putDouble("stop", 0);
|
|
||||||
itemstack.getOrCreateTag().putDouble("finish", 19);
|
|
||||||
if (entity instanceof Player _player)
|
|
||||||
_player.getCooldowns().addCooldown(itemstack.getItem(), 19);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
{
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:marlin_end player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("firing") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("firing", (itemstack.getOrCreateTag().getDouble("firing") - 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -15,7 +15,7 @@ public class MarlinfireProcedure {
|
||||||
|
|
||||||
ItemStack usehand = player.getMainHandItem();
|
ItemStack usehand = player.getMainHandItem();
|
||||||
if (usehand.getOrCreateTag().getBoolean("reloading") && usehand.getOrCreateTag().getDouble("prepare") == 0 && usehand.getOrCreateTag().getInt("ammo") > 0) {
|
if (usehand.getOrCreateTag().getBoolean("reloading") && usehand.getOrCreateTag().getDouble("prepare") == 0 && usehand.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
usehand.getOrCreateTag().putDouble("forcestop", 1);
|
usehand.getOrCreateTag().putDouble("force_stop", 1);
|
||||||
}
|
}
|
||||||
if (usehand.getItem() == TargetModItems.MARLIN.get() && !usehand.getOrCreateTag().getBoolean("reloading") && !player.getCooldowns().isOnCooldown(usehand.getItem())
|
if (usehand.getItem() == TargetModItems.MARLIN.get() && !usehand.getOrCreateTag().getBoolean("reloading") && !player.getCooldowns().isOnCooldown(usehand.getItem())
|
||||||
&& usehand.getOrCreateTag().getInt("ammo") > 0) {
|
&& usehand.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
|
|
|
@ -1,74 +0,0 @@
|
||||||
package net.mcreator.target.procedures;
|
|
||||||
|
|
||||||
import net.mcreator.target.tools.GunInfo;
|
|
||||||
import net.mcreator.target.tools.GunReload;
|
|
||||||
import net.minecraft.commands.CommandSource;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
|
|
||||||
public class Mk14WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
|
||||||
public static void execute(Entity entity, ItemStack itemstack) {
|
|
||||||
if (entity == null)
|
|
||||||
return;
|
|
||||||
double id = 0;
|
|
||||||
id = itemstack.getOrCreateTag().getDouble("id");
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 55) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
{
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:mk_14_reload_empty player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 5 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("gj", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
|
||||||
}
|
|
||||||
} else if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") > 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 45) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
{
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:mk_14_reload_normal player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.RIFLE, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -316,8 +316,8 @@ public class PlayerReloadProcedure {
|
||||||
player.getCooldowns().addCooldown(player.getMainHandItem().getItem(), 5);
|
player.getCooldowns().addCooldown(player.getMainHandItem().getItem(), 5);
|
||||||
tag.putDouble("prepare", 5);
|
tag.putDouble("prepare", 5);
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:marlin_start player @s ~ ~ ~ 100 1");
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:marlin_start player @s ~ ~ ~ 100 1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.M_870.get()
|
if (player.getMainHandItem().getItem() == TargetModItems.M_870.get()
|
||||||
|
@ -333,8 +333,8 @@ public class PlayerReloadProcedure {
|
||||||
tag.putDouble("prepare", 36);
|
tag.putDouble("prepare", 36);
|
||||||
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:m_870_preparealt player @s ~ ~ ~ 100 1");
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:m_870_preparealt player @s ~ ~ ~ 100 1");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tag.putBoolean("reloading", true);
|
tag.putBoolean("reloading", true);
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
package net.mcreator.target.procedures;
|
|
||||||
|
|
||||||
import net.mcreator.target.init.TargetModItems;
|
|
||||||
import net.minecraft.commands.CommandSource;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
|
|
||||||
public class RpgWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
|
||||||
public static void execute(Entity entity, ItemStack itemstack) {
|
|
||||||
if (entity == null) return;
|
|
||||||
CompoundTag tag = itemstack.getOrCreateTag();
|
|
||||||
double id = tag.getDouble("id");
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getBoolean("reloading")) {
|
|
||||||
if (tag.getDouble("reload_time") == 91) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:rpg_reload player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 84) {
|
|
||||||
tag.putDouble("empty", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getInt("max_ammo") >= 0) {
|
|
||||||
tag.putInt("ammo", 1);
|
|
||||||
if (entity instanceof Player _player) {
|
|
||||||
_player.getInventory().clearOrCountMatchingItems(p -> TargetModItems.ROCKET.get() == p.getItem(), 1, _player.inventoryMenu.getCraftSlots());
|
|
||||||
}
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,65 +0,0 @@
|
||||||
package net.mcreator.target.procedures;
|
|
||||||
|
|
||||||
import net.mcreator.target.tools.GunInfo;
|
|
||||||
import net.mcreator.target.tools.GunReload;
|
|
||||||
import net.minecraft.commands.CommandSource;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
|
|
||||||
public class RpkWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
|
||||||
public static void execute(Entity entity, ItemStack itemstack) {
|
|
||||||
if (entity == null) return;
|
|
||||||
double id = itemstack.getOrCreateTag().getDouble("id");
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 83) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:rpk_reload_empty player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
|
||||||
}
|
|
||||||
} else if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") > 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 66) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:rpk_reload_normal player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.RIFLE, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,122 +0,0 @@
|
||||||
package net.mcreator.target.procedures;
|
|
||||||
|
|
||||||
import net.mcreator.target.tools.GunInfo;
|
|
||||||
import net.mcreator.target.tools.GunReload;
|
|
||||||
import net.minecraft.commands.CommandSource;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
|
|
||||||
public class SentinelWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
|
||||||
public static void execute(Entity entity, ItemStack itemstack) {
|
|
||||||
if (entity == null)
|
|
||||||
return;
|
|
||||||
double id = 0;
|
|
||||||
double cid = 0;
|
|
||||||
id = itemstack.getOrCreateTag().getDouble("id");
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 73) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
{
|
|
||||||
Entity _ent = entity;
|
|
||||||
if (!_ent.level().isClientSide() && _ent.getServer() != null) {
|
|
||||||
_ent.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, _ent.position(), _ent.getRotationVector(), _ent.level() instanceof ServerLevel ? (ServerLevel) _ent.level() : null, 4,
|
|
||||||
_ent.getName().getString(), _ent.getDisplayName(), _ent.level().getServer(), _ent), "playsound target:sentinel_reload_empty player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.SNIPER);
|
|
||||||
}
|
|
||||||
} else if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") > 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 53) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
{
|
|
||||||
Entity _ent = entity;
|
|
||||||
if (!_ent.level().isClientSide() && _ent.getServer() != null) {
|
|
||||||
_ent.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, _ent.position(), _ent.getRotationVector(), _ent.level() instanceof ServerLevel ? (ServerLevel) _ent.level() : null, 4,
|
|
||||||
_ent.getName().getString(), _ent.getDisplayName(), _ent.level().getServer(), _ent), "playsound target:sentinel_reload_normal player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.SNIPER, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("firing") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("firing", (itemstack.getOrCreateTag().getDouble("firing") - 1));
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("zoom_firing") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("zoom_firing", (itemstack.getOrCreateTag().getDouble("zoom_firing") - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
cid = itemstack.getOrCreateTag().getDouble("cid");
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("cid") != itemstack.getOrCreateTag().getDouble("cid")) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("charging", 0);
|
|
||||||
itemstack.getOrCreateTag().putDouble("charging_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("charging") == 1) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("charging_time") == 127) {
|
|
||||||
entity.getPersistentData().putDouble("cid", cid);
|
|
||||||
{
|
|
||||||
Entity _ent = entity;
|
|
||||||
if (!_ent.level().isClientSide() && _ent.getServer() != null) {
|
|
||||||
_ent.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, _ent.position(), _ent.getRotationVector(), _ent.level() instanceof ServerLevel ? (ServerLevel) _ent.level() : null, 4,
|
|
||||||
_ent.getName().getString(), _ent.getDisplayName(), _ent.level().getServer(), _ent), "playsound target:sentinel_charge player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("cid") == cid) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("charging_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("charging_time", (itemstack.getOrCreateTag().getDouble("charging_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putDouble("charging", 0);
|
|
||||||
itemstack.getOrCreateTag().putDouble("charging_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("charging_time") == 16 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("cid") == cid) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("power", 100);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("charging_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("cid") == cid) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("charging", 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("power") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("adddamage", 10);
|
|
||||||
itemstack.getOrCreateTag().putDouble("power", (itemstack.getOrCreateTag().getDouble("power") - 0.025));
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putDouble("adddamage", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("crot") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("crot", (itemstack.getOrCreateTag().getDouble("crot") - 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,76 +0,0 @@
|
||||||
package net.mcreator.target.procedures;
|
|
||||||
|
|
||||||
import net.mcreator.target.tools.GunInfo;
|
|
||||||
import net.mcreator.target.tools.GunReload;
|
|
||||||
import net.minecraft.commands.CommandSource;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
|
|
||||||
public class SksWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
|
||||||
public static void execute(Entity entity, ItemStack itemstack) {
|
|
||||||
if (entity == null)
|
|
||||||
return;
|
|
||||||
double id = 0;
|
|
||||||
id = itemstack.getOrCreateTag().getDouble("id");
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 57) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
{
|
|
||||||
Entity _ent = entity;
|
|
||||||
if (!_ent.level().isClientSide() && _ent.getServer() != null) {
|
|
||||||
_ent.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, _ent.position(), _ent.getRotationVector(), _ent.level() instanceof ServerLevel ? (ServerLevel) _ent.level() : null, 4,
|
|
||||||
_ent.getName().getString(), _ent.getDisplayName(), _ent.level().getServer(), _ent), "playsound target:sks_reload_empty player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 14 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("gj", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
|
||||||
}
|
|
||||||
} else if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") > 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 41) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
{
|
|
||||||
Entity _ent = entity;
|
|
||||||
if (!_ent.level().isClientSide() && _ent.getServer() != null) {
|
|
||||||
_ent.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, _ent.position(), _ent.getRotationVector(), _ent.level() instanceof ServerLevel ? (ServerLevel) _ent.level() : null, 4,
|
|
||||||
_ent.getName().getString(), _ent.getDisplayName(), _ent.level().getServer(), _ent), "playsound target:sks_reload_normal player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.RIFLE, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,76 +0,0 @@
|
||||||
package net.mcreator.target.procedures;
|
|
||||||
|
|
||||||
import net.mcreator.target.tools.GunInfo;
|
|
||||||
import net.mcreator.target.tools.GunReload;
|
|
||||||
import net.minecraft.commands.CommandSource;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
|
|
||||||
public class SvdWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
|
||||||
public static void execute(Entity entity, ItemStack itemstack) {
|
|
||||||
if (entity == null)
|
|
||||||
return;
|
|
||||||
double id = 0;
|
|
||||||
id = itemstack.getOrCreateTag().getDouble("id");
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 66) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
{
|
|
||||||
Entity _ent = entity;
|
|
||||||
if (!_ent.level().isClientSide() && _ent.getServer() != null) {
|
|
||||||
_ent.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, _ent.position(), _ent.getRotationVector(), _ent.level() instanceof ServerLevel ? (ServerLevel) _ent.level() : null, 4,
|
|
||||||
_ent.getName().getString(), _ent.getDisplayName(), _ent.level().getServer(), _ent), "playsound target:svd_reload_empty player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 14 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("gj", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.SNIPER);
|
|
||||||
}
|
|
||||||
} else if (itemstack.getOrCreateTag().getBoolean("reloading") && itemstack.getOrCreateTag().getInt("ammo") > 0) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 55) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
{
|
|
||||||
Entity _ent = entity;
|
|
||||||
if (!_ent.level().isClientSide() && _ent.getServer() != null) {
|
|
||||||
_ent.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, _ent.position(), _ent.getRotationVector(), _ent.level() instanceof ServerLevel ? (ServerLevel) _ent.level() : null, 4,
|
|
||||||
_ent.getName().getString(), _ent.getDisplayName(), _ent.level().getServer(), _ent), "playsound target:svd_reload_normal player @s ~ ~ ~ 100 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()
|
|
||||||
&& (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", (itemstack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemstack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
itemstack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.SNIPER, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -32,23 +32,17 @@ public class TaserfireProcedure {
|
||||||
});
|
});
|
||||||
player.getCooldowns().addCooldown(usehand.getItem(), 5);
|
player.getCooldowns().addCooldown(usehand.getItem(), 5);
|
||||||
|
|
||||||
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), (ServerLevel) entity.level(), 4,
|
||||||
|
entity.getName().getString(), entity.getDisplayName(), entity.getServer(), entity), "playsound target:taser_fire_1p player @s ~ ~ ~ 1 1");
|
||||||
|
}
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:taser_fire_1p player @s ~ ~ ~ 1 1");
|
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:taser_fire_3p player @a ~ ~ ~ 1 1");
|
||||||
}
|
}
|
||||||
{
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
Entity _ent = entity;
|
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
||||||
if (!_ent.level().isClientSide() && _ent.getServer() != null) {
|
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "stopsound @s player target:taser_fire_3p");
|
||||||
_ent.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, _ent.position(), _ent.getRotationVector(), _ent.level() instanceof ServerLevel ? (ServerLevel) _ent.level() : null, 4,
|
|
||||||
_ent.getName().getString(), _ent.getDisplayName(), _ent.level().getServer(), _ent), "playsound target:taser_fire_3p player @a ~ ~ ~ 1 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
Entity _ent = entity;
|
|
||||||
if (!_ent.level().isClientSide() && _ent.getServer() != null) {
|
|
||||||
_ent.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, _ent.position(), _ent.getRotationVector(), _ent.level() instanceof ServerLevel ? (ServerLevel) _ent.level() : null, 4,
|
|
||||||
_ent.getName().getString(), _ent.getDisplayName(), _ent.level().getServer(), _ent), "stopsound @s player target:taser_fire_3p");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Level projectileLevel = entity.level();
|
Level projectileLevel = entity.level();
|
||||||
|
|
|
@ -5,8 +5,8 @@ import net.mcreator.target.TargetMod;
|
||||||
import net.mcreator.target.entity.ProjectileEntity;
|
import net.mcreator.target.entity.ProjectileEntity;
|
||||||
import net.mcreator.target.init.TargetModAttributes;
|
import net.mcreator.target.init.TargetModAttributes;
|
||||||
import net.mcreator.target.init.TargetModItems;
|
import net.mcreator.target.init.TargetModItems;
|
||||||
import net.mcreator.target.network.message.GunsDataMessage;
|
|
||||||
import net.mcreator.target.network.TargetModVariables;
|
import net.mcreator.target.network.TargetModVariables;
|
||||||
|
import net.mcreator.target.network.message.GunsDataMessage;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.server.packs.resources.ResourceManager;
|
import net.minecraft.server.packs.resources.ResourceManager;
|
||||||
|
@ -120,7 +120,7 @@ public class GunsTool {
|
||||||
damage = 0.008333333 * tag.getDouble("damage") * tag.getDouble("speed") * tag.getDouble("damageadd");
|
damage = 0.008333333 * tag.getDouble("damage") * tag.getDouble("speed") * tag.getDouble("damageadd");
|
||||||
projectile.shoot(player.getLookAngle().x, player.getLookAngle().y, player.getLookAngle().z, velocity, 2.5f);
|
projectile.shoot(player.getLookAngle().x, player.getLookAngle().y, player.getLookAngle().z, velocity, 2.5f);
|
||||||
} else {
|
} else {
|
||||||
damage = (tag.getDouble("damage") + tag.getDouble("adddamage")) * tag.getDouble("damageadd");
|
damage = tag.getDouble("damage") + tag.getDouble("add_damage") * tag.getDouble("damageadd");
|
||||||
|
|
||||||
projectile.shoot(player.getLookAngle().x,
|
projectile.shoot(player.getLookAngle().x,
|
||||||
player.getLookAngle().y,
|
player.getLookAngle().y,
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class TooltipTool {
|
||||||
tooltip.add(Component.literal(""));
|
tooltip.add(Component.literal(""));
|
||||||
|
|
||||||
double damage = (ItemNBTTool.getDouble(stack, "damage", 0) +
|
double damage = (ItemNBTTool.getDouble(stack, "damage", 0) +
|
||||||
ItemNBTTool.getDouble(stack, "adddamage", 0))
|
ItemNBTTool.getDouble(stack, "add_damage", 0))
|
||||||
* ItemNBTTool.getDouble(stack, "damageadd", 1);
|
* ItemNBTTool.getDouble(stack, "damageadd", 1);
|
||||||
|
|
||||||
tooltip.add(Component.translatable("des.target.tips.damage").withStyle(ChatFormatting.GRAY)
|
tooltip.add(Component.translatable("des.target.tips.damage").withStyle(ChatFormatting.GRAY)
|
||||||
|
@ -34,7 +34,7 @@ public class TooltipTool {
|
||||||
tooltip.add(Component.literal(""));
|
tooltip.add(Component.literal(""));
|
||||||
|
|
||||||
double damage = (ItemNBTTool.getDouble(stack, "damage", 0) +
|
double damage = (ItemNBTTool.getDouble(stack, "damage", 0) +
|
||||||
ItemNBTTool.getDouble(stack, "adddamage", 0))
|
ItemNBTTool.getDouble(stack, "add_damage", 0))
|
||||||
* ItemNBTTool.getDouble(stack, "damageadd", 1);
|
* ItemNBTTool.getDouble(stack, "damageadd", 1);
|
||||||
|
|
||||||
tooltip.add(Component.translatable("des.target.tips.damage").withStyle(ChatFormatting.GRAY)
|
tooltip.add(Component.translatable("des.target.tips.damage").withStyle(ChatFormatting.GRAY)
|
||||||
|
@ -88,7 +88,7 @@ public class TooltipTool {
|
||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
double damage = (ItemNBTTool.getDouble(stack, "damage", 0) +
|
double damage = (ItemNBTTool.getDouble(stack, "damage", 0) +
|
||||||
ItemNBTTool.getDouble(stack, "adddamage", 0))
|
ItemNBTTool.getDouble(stack, "add_damage", 0))
|
||||||
* ItemNBTTool.getDouble(stack, "damageadd", 1);
|
* ItemNBTTool.getDouble(stack, "damageadd", 1);
|
||||||
|
|
||||||
tooltip.add(Component.translatable("des.target.tips.damage").withStyle(ChatFormatting.GRAY)
|
tooltip.add(Component.translatable("des.target.tips.damage").withStyle(ChatFormatting.GRAY)
|
||||||
|
|
Loading…
Add table
Reference in a new issue