v1.6.0
This commit is contained in:
1 parent
bab35652d4
commit
5758839e77
78 files changed
+1065
-262
No files matched your search
@@ -37,8 +37,8 @@ public class ModKeyBindings {
|
|||||||
"key.categories.lzxnoneterraria"
|
"key.categories.lzxnoneterraria"
|
||||||
);
|
);
|
||||||
|
|
||||||
public static final KeyMapping TOGGLE_SUMMON_FREE_TARGETING = new KeyMapping(
|
public static final KeyMapping TOGGLE_SUMMON_ATTACK_MODE = new KeyMapping(
|
||||||
"key.lzxnoneterraria.toggle_summon_free_targeting",
|
"key.lzxnoneterraria.toggle_summon_attack_mode",
|
||||||
KeyConflictContext.IN_GAME,
|
KeyConflictContext.IN_GAME,
|
||||||
KeyModifier.NONE,
|
KeyModifier.NONE,
|
||||||
InputConstants.Type.KEYSYM,
|
InputConstants.Type.KEYSYM,
|
||||||
@@ -51,6 +51,6 @@ public class ModKeyBindings {
|
|||||||
event.register(KILL_MODE);
|
event.register(KILL_MODE);
|
||||||
event.register(CLEAR_SUMMON);
|
event.register(CLEAR_SUMMON);
|
||||||
event.register(CLEAR_ALL_SUMMONS);
|
event.register(CLEAR_ALL_SUMMONS);
|
||||||
event.register(TOGGLE_SUMMON_FREE_TARGETING);
|
event.register(TOGGLE_SUMMON_ATTACK_MODE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ public class ModAttachments {
|
|||||||
public static final Supplier<AttachmentType<List<UUID>>> SUMMON_WEAPON_SUMMONS =
|
public static final Supplier<AttachmentType<List<UUID>>> SUMMON_WEAPON_SUMMONS =
|
||||||
ATTACHMENT_TYPES.register("summon_weapon_summons", () -> AttachmentType.<List<UUID>>builder((Supplier<List<UUID>>) ArrayList::new).serialize(Codec.list(Codec.STRING.xmap(UUID::fromString, UUID::toString))).build());
|
ATTACHMENT_TYPES.register("summon_weapon_summons", () -> AttachmentType.<List<UUID>>builder((Supplier<List<UUID>>) ArrayList::new).serialize(Codec.list(Codec.STRING.xmap(UUID::fromString, UUID::toString))).build());
|
||||||
|
|
||||||
public static final Supplier<AttachmentType<Boolean>> SUMMON_FREE_TARGETING =
|
public static final Supplier<AttachmentType<Integer>> SUMMON_ATTACK_MODE =
|
||||||
ATTACHMENT_TYPES.register("summon_free_targeting", () -> AttachmentType.builder(() -> true).serialize(Codec.BOOL).build());
|
ATTACHMENT_TYPES.register("summon_attack_mode", () -> AttachmentType.builder(() -> 2).serialize(Codec.INT).build());
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -13,7 +13,7 @@ import com.lzxnone.terraria.item.weapon.ranged.SniperRifle;
|
|||||||
import com.lzxnone.terraria.network.payload.ClearSummonPayload;
|
import com.lzxnone.terraria.network.payload.ClearSummonPayload;
|
||||||
import com.lzxnone.terraria.network.payload.DevilsDevastationKillModePayload;
|
import com.lzxnone.terraria.network.payload.DevilsDevastationKillModePayload;
|
||||||
import com.lzxnone.terraria.network.payload.FirstFractalScrollPayload;
|
import com.lzxnone.terraria.network.payload.FirstFractalScrollPayload;
|
||||||
import com.lzxnone.terraria.network.payload.ToggleSummonFreeTargetingPayload;
|
import com.lzxnone.terraria.network.payload.ToggleSummonAttackModePayload;
|
||||||
import com.lzxnone.terraria.network.payload.ZenithScrollPayload;
|
import com.lzxnone.terraria.network.payload.ZenithScrollPayload;
|
||||||
import com.lzxnone.terraria.utils.SoundUtil;
|
import com.lzxnone.terraria.utils.SoundUtil;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
@@ -149,8 +149,8 @@ public class InputHandler {
|
|||||||
while(ModKeyBindings.CLEAR_ALL_SUMMONS.consumeClick()) {
|
while(ModKeyBindings.CLEAR_ALL_SUMMONS.consumeClick()) {
|
||||||
PacketDistributor.sendToServer(new ClearSummonPayload(""));
|
PacketDistributor.sendToServer(new ClearSummonPayload(""));
|
||||||
}
|
}
|
||||||
while(ModKeyBindings.TOGGLE_SUMMON_FREE_TARGETING.consumeClick()) {
|
while(ModKeyBindings.TOGGLE_SUMMON_ATTACK_MODE.consumeClick()) {
|
||||||
PacketDistributor.sendToServer(new ToggleSummonFreeTargetingPayload(true));
|
PacketDistributor.sendToServer(new ToggleSummonAttackModePayload());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@ package com.lzxnone.terraria.entity.summon;
|
|||||||
|
|
||||||
import com.lzxnone.terraria.item.weapon.melee.BeeKeeper;
|
import com.lzxnone.terraria.item.weapon.melee.BeeKeeper;
|
||||||
import com.lzxnone.terraria.utils.DamageUtil;
|
import com.lzxnone.terraria.utils.DamageUtil;
|
||||||
|
import com.lzxnone.terraria.utils.FilterUtil;
|
||||||
import com.lzxnone.terraria.utils.MathUtil;
|
import com.lzxnone.terraria.utils.MathUtil;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
@@ -15,7 +16,6 @@ import net.minecraft.world.entity.ai.control.FlyingMoveControl;
|
|||||||
import net.minecraft.world.entity.ai.control.LookControl;
|
import net.minecraft.world.entity.ai.control.LookControl;
|
||||||
import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal;
|
import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal;
|
||||||
import net.minecraft.world.entity.animal.Bee;
|
import net.minecraft.world.entity.animal.Bee;
|
||||||
import net.minecraft.world.entity.monster.Monster;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
@@ -118,7 +118,7 @@ public class BeeSummon extends Bee {
|
|||||||
super.registerGoals();
|
super.registerGoals();
|
||||||
this.goalSelector.removeAllGoals(goal -> true);
|
this.goalSelector.removeAllGoals(goal -> true);
|
||||||
this.targetSelector.removeAllGoals(goal -> true);
|
this.targetSelector.removeAllGoals(goal -> true);
|
||||||
this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Monster.class, false));
|
this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, LivingEntity.class, false, FilterUtil.createEnemyFilter(this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import com.lzxnone.terraria.ui.config.IConfigData;
|
|||||||
import com.lzxnone.terraria.utils.*;
|
import com.lzxnone.terraria.utils.*;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.monster.Monster;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.ClipContext;
|
import net.minecraft.world.level.ClipContext;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
@@ -164,11 +163,7 @@ public class ChlorophyteBullet extends BulletAmmo {
|
|||||||
|
|
||||||
private static Entity findTarget(StaticSummon summon) {
|
private static Entity findTarget(StaticSummon summon) {
|
||||||
AABB searchBox = summon.getBoundingBox().inflate(getTargetRange());
|
AABB searchBox = summon.getBoundingBox().inflate(getTargetRange());
|
||||||
List<Monster> targets = summon.level().getEntitiesOfClass(
|
List<Entity> targets = CollisionUtil.searchEnemies(summon.level(), searchBox, summon, summon.getOwner());
|
||||||
Monster.class,
|
|
||||||
searchBox,
|
|
||||||
FilterUtil.createTargetFilter(summon, summon.getOwner())
|
|
||||||
);
|
|
||||||
Entity bestTarget = null;
|
Entity bestTarget = null;
|
||||||
double bestDistance = Double.MAX_VALUE;
|
double bestDistance = Double.MAX_VALUE;
|
||||||
for(Entity target : targets) {
|
for(Entity target : targets) {
|
||||||
|
|||||||
@@ -6,26 +6,59 @@ import com.lzxnone.terraria.effect.SummonEffect;
|
|||||||
import com.lzxnone.terraria.enchantment.ModEnchantments;
|
import com.lzxnone.terraria.enchantment.ModEnchantments;
|
||||||
import com.lzxnone.terraria.enchantment.ModEnchantmentConfigs;
|
import com.lzxnone.terraria.enchantment.ModEnchantmentConfigs;
|
||||||
import com.lzxnone.terraria.entity.summon.StaticSummon;
|
import com.lzxnone.terraria.entity.summon.StaticSummon;
|
||||||
|
import com.lzxnone.terraria.utils.CollisionUtil;
|
||||||
|
import com.lzxnone.terraria.utils.FilterUtil;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.core.registries.Registries;
|
import net.minecraft.core.registries.Registries;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.effect.MobEffectInstance;
|
import net.minecraft.world.effect.MobEffectInstance;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
import net.minecraft.world.entity.boss.EnderDragonPart;
|
||||||
|
import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Tier;
|
import net.minecraft.world.item.Tier;
|
||||||
import net.minecraft.world.item.enchantment.Enchantment;
|
import net.minecraft.world.item.enchantment.Enchantment;
|
||||||
|
import net.minecraft.world.level.ClipContext;
|
||||||
|
import net.minecraft.world.phys.AABB;
|
||||||
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
|
import net.minecraft.world.phys.HitResult;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class SummonWeapon extends Weapon {
|
public class SummonWeapon extends Weapon {
|
||||||
private static final double MAX_RANGE = 256;
|
private static final double MAX_RANGE = 256;
|
||||||
|
|
||||||
|
public enum SummonAttackMode {
|
||||||
|
PASSIVE("message.lzxnoneterraria.summon_attack_mode.passive", ChatFormatting.GREEN),
|
||||||
|
NEUTRAL("message.lzxnoneterraria.summon_attack_mode.neutral", ChatFormatting.YELLOW),
|
||||||
|
AGGRESSIVE("message.lzxnoneterraria.summon_attack_mode.aggressive", ChatFormatting.RED),
|
||||||
|
ATTACK_TARGET("message.lzxnoneterraria.summon_attack_mode.attack_target", ChatFormatting.BLUE);
|
||||||
|
|
||||||
|
private final String translationKey;
|
||||||
|
private final ChatFormatting color;
|
||||||
|
|
||||||
|
SummonAttackMode(String translationKey, ChatFormatting color) {
|
||||||
|
this.translationKey = translationKey;
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Component getDisplayName() {
|
||||||
|
return Component.translatable(translationKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChatFormatting getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public SummonWeapon(Tier tier, Properties properties) {
|
public SummonWeapon(Tier tier, Properties properties) {
|
||||||
super(tier, properties);
|
super(tier, properties);
|
||||||
}
|
}
|
||||||
@@ -47,6 +80,99 @@ public class SummonWeapon extends Weapon {
|
|||||||
return new ArrayList<>(player.getData(ModAttachments.SUMMON_WEAPON_SUMMONS));
|
return new ArrayList<>(player.getData(ModAttachments.SUMMON_WEAPON_SUMMONS));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SummonAttackMode getAttackMode(Player player) {
|
||||||
|
int mode = player.getData(ModAttachments.SUMMON_ATTACK_MODE);
|
||||||
|
SummonAttackMode[] modes = SummonAttackMode.values();
|
||||||
|
if(mode < 0 || mode >= modes.length) return SummonAttackMode.AGGRESSIVE;
|
||||||
|
return modes[mode];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SummonAttackMode cycleAttackMode(Player player) {
|
||||||
|
SummonAttackMode[] modes = SummonAttackMode.values();
|
||||||
|
int next = (getAttackMode(player).ordinal() + 1) % modes.length;
|
||||||
|
player.setData(ModAttachments.SUMMON_ATTACK_MODE, next);
|
||||||
|
return modes[next];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Entity findSummonTarget(StaticSummon summon, Player player, double range) {
|
||||||
|
SummonAttackMode mode = getAttackMode(player);
|
||||||
|
if(mode == SummonAttackMode.PASSIVE) return null;
|
||||||
|
|
||||||
|
if(mode == SummonAttackMode.NEUTRAL) {
|
||||||
|
LivingEntity target = player.getLastHurtByMob();
|
||||||
|
return isValidSummonTarget(summon, player, target, range) ? target : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mode == SummonAttackMode.ATTACK_TARGET) {
|
||||||
|
return findPlayerRelatedTarget(summon, player, range);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean ignoreBlockOcclusion = hasBarrenLand(summon, player);
|
||||||
|
Entity playerRelatedTarget = findPlayerRelatedTarget(summon, player, range);
|
||||||
|
if(playerRelatedTarget != null) return playerRelatedTarget;
|
||||||
|
|
||||||
|
AABB searchBox = AABB.ofSize(summon.position(), range * 2.0D, range * 2.0D, range * 2.0D);
|
||||||
|
List<Entity> targets = ignoreBlockOcclusion ? CollisionUtil.searchEntities(
|
||||||
|
summon.level(),
|
||||||
|
searchBox,
|
||||||
|
summon,
|
||||||
|
player
|
||||||
|
) : CollisionUtil.searchEnemies(
|
||||||
|
summon.level(),
|
||||||
|
searchBox,
|
||||||
|
summon,
|
||||||
|
player
|
||||||
|
);
|
||||||
|
targets.removeIf(target -> !isValidSummonTarget(summon, player, target, range)
|
||||||
|
|| (!ignoreBlockOcclusion && !isValidEnemySummonTarget(summon, player, target, range))
|
||||||
|
|| (!ignoreBlockOcclusion && !canPlayerSeeTarget(player, target)));
|
||||||
|
targets.sort(Comparator.comparingDouble(target -> target.distanceToSqr(summon.position())));
|
||||||
|
return targets.isEmpty() ? null : targets.getFirst();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void storeSummonTarget(StaticSummon summon, Entity target) {
|
||||||
|
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA).copy();
|
||||||
|
customData.remove("target");
|
||||||
|
customData.remove("targetId");
|
||||||
|
customData.remove("targetPart");
|
||||||
|
|
||||||
|
if(target instanceof EnderDragonPart dragonPart) {
|
||||||
|
customData.putUUID("target", dragonPart.parentMob.getUUID());
|
||||||
|
customData.putString("targetPart", dragonPart.name);
|
||||||
|
}else if(target != null) {
|
||||||
|
customData.putUUID("target", target.getUUID());
|
||||||
|
}
|
||||||
|
|
||||||
|
summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Entity getStoredSummonTarget(StaticSummon summon) {
|
||||||
|
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA);
|
||||||
|
if(!customData.contains("target") || !(summon.level() instanceof ServerLevel serverLevel)) return null;
|
||||||
|
|
||||||
|
Entity target = serverLevel.getEntity(customData.getUUID("target"));
|
||||||
|
if(target instanceof EnderDragon dragon) {
|
||||||
|
if(!dragon.isAlive()) return null;
|
||||||
|
|
||||||
|
if(customData.contains("targetPart")) {
|
||||||
|
String targetPart = customData.getString("targetPart");
|
||||||
|
for(EnderDragonPart part : dragon.getSubEntities()) {
|
||||||
|
if(part.name.equals(targetPart) && CollisionUtil.isEnemySearchTarget(part, summon, summon.getOwner())) {
|
||||||
|
return part;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity owner = summon.getOwner();
|
||||||
|
EnderDragonPart nearestPart = List.of(dragon.getSubEntities()).stream()
|
||||||
|
.filter(part -> CollisionUtil.isEnemySearchTarget(part, summon, owner))
|
||||||
|
.min(Comparator.comparingDouble(part -> part.distanceToSqr(summon.position())))
|
||||||
|
.orElse(null);
|
||||||
|
return nearestPart != null ? nearestPart : dragon;
|
||||||
|
}
|
||||||
|
return target != null && target.isAlive() ? target : null;
|
||||||
|
}
|
||||||
|
|
||||||
public static void registerSummon(Player player, Entity summon) {
|
public static void registerSummon(Player player, Entity summon) {
|
||||||
if(!(player.level() instanceof ServerLevel serverLevel)) return;
|
if(!(player.level() instanceof ServerLevel serverLevel)) return;
|
||||||
|
|
||||||
@@ -95,4 +221,52 @@ public class SummonWeapon extends Weapon {
|
|||||||
.map(stack::getEnchantmentLevel)
|
.map(stack::getEnchantmentLevel)
|
||||||
.orElse(0);
|
.orElse(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Entity findPlayerRelatedTarget(StaticSummon summon, Player player, double range) {
|
||||||
|
LivingEntity playerTarget = player.getLastHurtMob();
|
||||||
|
if(isValidSummonTarget(summon, player, playerTarget, range)) return playerTarget;
|
||||||
|
|
||||||
|
LivingEntity attacker = player.getLastHurtByMob();
|
||||||
|
if(isValidSummonTarget(summon, player, attacker, range)) return attacker;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isValidSummonTarget(StaticSummon summon, Player player, Entity target, double range) {
|
||||||
|
return target != null
|
||||||
|
&& target.level() == summon.level()
|
||||||
|
&& target.distanceToSqr(summon) <= range * range
|
||||||
|
&& FilterUtil.createTargetFilter(summon, player).test(target);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isValidEnemySummonTarget(StaticSummon summon, Player player, Entity target, double range) {
|
||||||
|
return target != null
|
||||||
|
&& target.level() == summon.level()
|
||||||
|
&& target.distanceToSqr(summon) <= range * range
|
||||||
|
&& CollisionUtil.isEnemySearchTarget(target, summon, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean canPlayerSeeTarget(Player player, Entity target) {
|
||||||
|
BlockHitResult hitResult = player.level().clip(new ClipContext(
|
||||||
|
player.getEyePosition(),
|
||||||
|
target.getEyePosition(),
|
||||||
|
ClipContext.Block.COLLIDER,
|
||||||
|
ClipContext.Fluid.NONE,
|
||||||
|
player
|
||||||
|
));
|
||||||
|
return hitResult.getType() == HitResult.Type.MISS;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean hasBarrenLand(StaticSummon summon, Player player) {
|
||||||
|
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
|
||||||
|
if(sourceStack.isEmpty()) sourceStack = player.getWeaponItem();
|
||||||
|
if(sourceStack.isEmpty()) return false;
|
||||||
|
|
||||||
|
return player.registryAccess()
|
||||||
|
.lookupOrThrow(Registries.ENCHANTMENT)
|
||||||
|
.get(ModEnchantments.BARREN_LAND)
|
||||||
|
.map(sourceStack::getEnchantmentLevel)
|
||||||
|
.orElse(0) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,6 @@ import net.minecraft.world.entity.EquipmentSlotGroup;
|
|||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
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.monster.Monster;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
@@ -210,10 +209,11 @@ public class BladeOfGrass extends MeleeWeapon {
|
|||||||
ItemStack stack = player.getItemInHand(hand);
|
ItemStack stack = player.getItemInHand(hand);
|
||||||
|
|
||||||
if(!level.isClientSide()) {
|
if(!level.isClientSide()) {
|
||||||
List<Monster> targets = player.level().getEntitiesOfClass(
|
List<Entity> targets = CollisionUtil.searchEnemies(
|
||||||
Monster.class,
|
player.level(),
|
||||||
AABB.ofSize(player.getBoundingBox().getCenter(), getTargetRange() * 2, getTargetRange() * 2, getTargetRange() * 2),
|
AABB.ofSize(player.getBoundingBox().getCenter(), getTargetRange() * 2, getTargetRange() * 2, getTargetRange() * 2),
|
||||||
FilterUtil.createMonsterFilter(player)
|
player,
|
||||||
|
player
|
||||||
);
|
);
|
||||||
targets.sort(Comparator.comparingDouble(e -> e.distanceToSqr(player.position())));
|
targets.sort(Comparator.comparingDouble(e -> e.distanceToSqr(player.position())));
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import net.minecraft.world.entity.LivingEntity;
|
|||||||
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.ai.targeting.TargetingConditions;
|
import net.minecraft.world.entity.ai.targeting.TargetingConditions;
|
||||||
import net.minecraft.world.entity.monster.Monster;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.*;
|
import net.minecraft.world.item.*;
|
||||||
import net.minecraft.world.item.component.CustomData;
|
import net.minecraft.world.item.component.CustomData;
|
||||||
@@ -219,7 +218,7 @@ public class InfluxWaver extends MeleeWeapon {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(checkEntity) {
|
if(checkEntity) {
|
||||||
EntityHitResult entityHitResult = CollisionUtil.checkEntityHit(summon, summon.position().add(motion));
|
EntityHitResult entityHitResult = CollisionUtil.checkEntityHit(summon, summon.position().add(motion), 1.0);
|
||||||
if(entityHitResult != null) {
|
if(entityHitResult != null) {
|
||||||
Entity hitTarget = entityHitResult.getEntity();
|
Entity hitTarget = entityHitResult.getEntity();
|
||||||
Entity target = customData.contains("target") ? summon.level().getEntity(customData.getInt("target")) : null;
|
Entity target = customData.contains("target") ? summon.level().getEntity(customData.getInt("target")) : null;
|
||||||
@@ -296,12 +295,8 @@ public class InfluxWaver extends MeleeWeapon {
|
|||||||
pos.x - getTargetRange(), pos.y - getTargetRange(), pos.z - getTargetRange(),
|
pos.x - getTargetRange(), pos.y - getTargetRange(), pos.z - getTargetRange(),
|
||||||
pos.x + getTargetRange(), pos.y + getTargetRange(), pos.z + getTargetRange()
|
pos.x + getTargetRange(), pos.y + getTargetRange(), pos.z + getTargetRange()
|
||||||
);
|
);
|
||||||
List<Monster> entities = player.level().getEntitiesOfClass(
|
List<Entity> entities = CollisionUtil.searchEnemies(player.level(), searchBox, player, player);
|
||||||
Monster.class,
|
Entity target = null;
|
||||||
searchBox,
|
|
||||||
FilterUtil.createMonsterFilter(player)
|
|
||||||
);
|
|
||||||
Monster target = null;
|
|
||||||
entities.sort(Comparator.comparingDouble(e -> e.distanceToSqr(pos)));
|
entities.sort(Comparator.comparingDouble(e -> e.distanceToSqr(pos)));
|
||||||
if(!entities.isEmpty()) target = entities.getFirst();
|
if(!entities.isEmpty()) target = entities.getFirst();
|
||||||
return target;
|
return target;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.lzxnone.terraria.ui.config.ConfigFactory;
|
|||||||
import com.lzxnone.terraria.ui.config.ConfigListItem;
|
import com.lzxnone.terraria.ui.config.ConfigListItem;
|
||||||
import com.lzxnone.terraria.ui.config.ConfigUtil;
|
import com.lzxnone.terraria.ui.config.ConfigUtil;
|
||||||
import com.lzxnone.terraria.ui.config.IConfigData;
|
import com.lzxnone.terraria.ui.config.IConfigData;
|
||||||
|
import com.lzxnone.terraria.utils.CollisionUtil;
|
||||||
import com.lzxnone.terraria.utils.DamageUtil;
|
import com.lzxnone.terraria.utils.DamageUtil;
|
||||||
import com.lzxnone.terraria.utils.FilterUtil;
|
import com.lzxnone.terraria.utils.FilterUtil;
|
||||||
import com.lzxnone.terraria.utils.ParticleUtil;
|
import com.lzxnone.terraria.utils.ParticleUtil;
|
||||||
@@ -26,7 +27,6 @@ import net.minecraft.world.entity.EquipmentSlotGroup;
|
|||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
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.monster.Monster;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.entity.projectile.Projectile;
|
import net.minecraft.world.entity.projectile.Projectile;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
@@ -182,12 +182,8 @@ public class LightsBane extends MeleeWeapon {
|
|||||||
pos.x - targetRange, pos.y - targetRange, pos.z - targetRange,
|
pos.x - targetRange, pos.y - targetRange, pos.z - targetRange,
|
||||||
pos.x + targetRange, pos.y + targetRange, pos.z + targetRange
|
pos.x + targetRange, pos.y + targetRange, pos.z + targetRange
|
||||||
);
|
);
|
||||||
List<Monster> entities = target.level().getEntitiesOfClass(
|
List<Entity> entities = CollisionUtil.searchEnemies(target.level(), searchBox, player, player);
|
||||||
Monster.class,
|
Entity summonTarget = null;
|
||||||
searchBox,
|
|
||||||
FilterUtil.createMonsterFilter(player)
|
|
||||||
);
|
|
||||||
Monster summonTarget = null;
|
|
||||||
entities.sort(Comparator.comparingDouble(e -> e.distanceToSqr(pos)));
|
entities.sort(Comparator.comparingDouble(e -> e.distanceToSqr(pos)));
|
||||||
if(!entities.isEmpty()) summonTarget = entities.getFirst();
|
if(!entities.isEmpty()) summonTarget = entities.getFirst();
|
||||||
if(summonTarget != null) {
|
if(summonTarget != null) {
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ public class Mace extends MeleeWeapon {
|
|||||||
tag -> tag.putInt("state", State.THROWING_BACK.ordinal()));
|
tag -> tag.putInt("state", State.THROWING_BACK.ordinal()));
|
||||||
}
|
}
|
||||||
if(!summon.level().isClientSide()) {
|
if(!summon.level().isClientSide()) {
|
||||||
EntityHitResult entityHitResult = CollisionUtil.checkEntityHit(summon, summon.position().add(summon.getDeltaMovement()));
|
EntityHitResult entityHitResult = CollisionUtil.checkEntityHit(summon, summon.position().add(summon.getDeltaMovement()), 1.0);
|
||||||
if(entityHitResult != null) {
|
if(entityHitResult != null) {
|
||||||
Entity target = entityHitResult.getEntity();
|
Entity target = entityHitResult.getEntity();
|
||||||
if(DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) getDamage(), 1.0f)) {
|
if(DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) getDamage(), 1.0f)) {
|
||||||
@@ -343,7 +343,7 @@ public class Mace extends MeleeWeapon {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EntityHitResult entityHitResult = CollisionUtil.checkEntityHit(summon, summon.position().add(summon.getDeltaMovement()));
|
EntityHitResult entityHitResult = CollisionUtil.checkEntityHit(summon, summon.position().add(summon.getDeltaMovement()), 1.0);
|
||||||
if(entityHitResult != null) {
|
if(entityHitResult != null) {
|
||||||
Entity target = entityHitResult.getEntity();
|
Entity target = entityHitResult.getEntity();
|
||||||
if(DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) getDamage(), 1.0f)) {
|
if(DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) getDamage(), 1.0f)) {
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ public class Meowmere extends MeleeWeapon {
|
|||||||
|
|
||||||
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA);
|
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA);
|
||||||
|
|
||||||
EntityHitResult entityHitResult = CollisionUtil.checkEntityHit(summon, summon.position().add(motion));
|
EntityHitResult entityHitResult = CollisionUtil.checkEntityHit(summon, summon.position().add(motion), 1.0);
|
||||||
if(entityHitResult != null) {
|
if(entityHitResult != null) {
|
||||||
Entity target = entityHitResult.getEntity();
|
Entity target = entityHitResult.getEntity();
|
||||||
if(summon.getOwner() instanceof Player player) {
|
if(summon.getOwner() instanceof Player player) {
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import net.minecraft.world.entity.EquipmentSlotGroup;
|
|||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
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.monster.Monster;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.*;
|
import net.minecraft.world.item.*;
|
||||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||||
@@ -157,7 +156,7 @@ public class Seedler extends MeleeWeapon {
|
|||||||
Vec3 motion = summon.getDeltaMovement();
|
Vec3 motion = summon.getDeltaMovement();
|
||||||
motion = motion.add(0, -getNutGravity(), 0);
|
motion = motion.add(0, -getNutGravity(), 0);
|
||||||
|
|
||||||
EntityHitResult entityHitResult = CollisionUtil.checkEntityHit(summon, summon.position().add(motion));
|
EntityHitResult entityHitResult = CollisionUtil.checkEntityHit(summon, summon.position().add(motion), 1.0);
|
||||||
if(entityHitResult != null) {
|
if(entityHitResult != null) {
|
||||||
Entity target = entityHitResult.getEntity();
|
Entity target = entityHitResult.getEntity();
|
||||||
if(summon.getOwner() instanceof Player player) {
|
if(summon.getOwner() instanceof Player player) {
|
||||||
@@ -205,10 +204,11 @@ public class Seedler extends MeleeWeapon {
|
|||||||
@Override
|
@Override
|
||||||
public void onDied(StaticSummon summon) {
|
public void onDied(StaticSummon summon) {
|
||||||
if(!summon.level().isClientSide()) {
|
if(!summon.level().isClientSide()) {
|
||||||
List<Monster> targets = summon.level().getEntitiesOfClass(
|
List<Entity> targets = CollisionUtil.searchEnemies(
|
||||||
Monster.class,
|
summon.level(),
|
||||||
AABB.ofSize(summon.position(), 64, 64, 64),
|
AABB.ofSize(summon.position(), 64, 64, 64),
|
||||||
FilterUtil.createMonsterFilter(summon.getOwner())
|
summon,
|
||||||
|
summon.getOwner()
|
||||||
);
|
);
|
||||||
targets.sort(Comparator.comparingDouble(e -> e.distanceToSqr(summon.position())));
|
targets.sort(Comparator.comparingDouble(e -> e.distanceToSqr(summon.position())));
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import net.minecraft.world.entity.LivingEntity;
|
|||||||
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.ai.targeting.TargetingConditions;
|
import net.minecraft.world.entity.ai.targeting.TargetingConditions;
|
||||||
import net.minecraft.world.entity.monster.Monster;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.*;
|
import net.minecraft.world.item.*;
|
||||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||||
@@ -299,21 +298,22 @@ public class TheHorsemansBlade extends MeleeWeapon {
|
|||||||
this.checkBeforeTick(summon);
|
this.checkBeforeTick(summon);
|
||||||
|
|
||||||
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA);
|
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA);
|
||||||
LivingEntity target = null;
|
Entity target = null;
|
||||||
|
|
||||||
if(customData.contains("target")) {
|
if(customData.contains("target")) {
|
||||||
Entity entity = summon.level().getEntity(customData.getInt("target"));
|
Entity entity = summon.level().getEntity(customData.getInt("target"));
|
||||||
if(entity instanceof LivingEntity le && le.isAlive()) {
|
if(entity != null && entity.isAlive()) {
|
||||||
target = le;
|
target = entity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!summon.level().isClientSide()) {
|
if(!summon.level().isClientSide()) {
|
||||||
if(target == null) {
|
if(target == null) {
|
||||||
List<Monster> targets = summon.level().getEntitiesOfClass(
|
List<Entity> targets = CollisionUtil.searchEnemies(
|
||||||
Monster.class,
|
summon.level(),
|
||||||
AABB.ofSize(summon.position(), getPumpkinMaxTargetRange() * 2, getPumpkinMaxTargetRange() * 2, getPumpkinMaxTargetRange() * 2),
|
AABB.ofSize(summon.position(), getPumpkinMaxTargetRange() * 2, getPumpkinMaxTargetRange() * 2, getPumpkinMaxTargetRange() * 2),
|
||||||
FilterUtil.createMonsterFilter(summon.getOwner())
|
summon,
|
||||||
|
summon.getOwner()
|
||||||
);
|
);
|
||||||
targets.sort(Comparator.comparingDouble(e -> e.distanceToSqr(summon.position())));
|
targets.sort(Comparator.comparingDouble(e -> e.distanceToSqr(summon.position())));
|
||||||
if(!targets.isEmpty()) target = targets.getFirst();
|
if(!targets.isEmpty()) target = targets.getFirst();
|
||||||
@@ -336,7 +336,7 @@ public class TheHorsemansBlade extends MeleeWeapon {
|
|||||||
summon.setYRot(xyRot[1]);
|
summon.setYRot(xyRot[1]);
|
||||||
|
|
||||||
if(selfPos.distanceToSqr(targetPos) < 2.0D) {
|
if(selfPos.distanceToSqr(targetPos) < 2.0D) {
|
||||||
if(summon.getOwner() instanceof Player player && FilterUtil.createLivingTargetFilter(player).test(target) && DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) getPumpkinDamage(), 1.0f)) onDied(summon);
|
if(summon.getOwner() instanceof Player player && FilterUtil.createTargetFilter(player).test(target) && DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) getPumpkinDamage(), 1.0f)) onDied(summon);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
Vec3 dir = summon.getLookAngle().normalize();
|
Vec3 dir = summon.getLookAngle().normalize();
|
||||||
@@ -351,10 +351,10 @@ public class TheHorsemansBlade extends MeleeWeapon {
|
|||||||
);
|
);
|
||||||
summon.setBoundingBox(box);
|
summon.setBoundingBox(box);
|
||||||
|
|
||||||
List<Monster> hitEntities = summon.level().getEntitiesOfClass(
|
List<Entity> hitEntities = summon.level().getEntitiesOfClass(
|
||||||
Monster.class,
|
Entity.class,
|
||||||
summon.getBoundingBox().inflate(0.2D),
|
summon.getBoundingBox().inflate(0.2D),
|
||||||
FilterUtil.createMonsterFilter(summon.getOwner())
|
entity -> CollisionUtil.isEnemySearchTarget(entity, summon, summon.getOwner())
|
||||||
);
|
);
|
||||||
|
|
||||||
if(!hitEntities.isEmpty()) {
|
if(!hitEntities.isEmpty()) {
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import net.minecraft.world.entity.EquipmentSlotGroup;
|
|||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
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.monster.Monster;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class Boomstick extends BasicGun {
|
|||||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||||
|
|
||||||
public Boomstick() {
|
public Boomstick() {
|
||||||
super(Tiers.IRON, new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON), ID, OFFSET, DAMAGE_DEFAULT, 40, ModSounds.SHOT5, 1.0f, 10);
|
super(Tiers.IRON, new Item.Properties().stacksTo(1), ID, OFFSET, DAMAGE_DEFAULT, 40, ModSounds.SHOT5, 1.0f, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class ChainGun extends BasicGun {
|
|||||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||||
|
|
||||||
public ChainGun() {
|
public ChainGun() {
|
||||||
super(Tiers.NETHERITE, new Item.Properties().stacksTo(1).rarity(Rarity.EPIC), ID, OFFSET, DAMAGE_DEFAULT, 4, ModSounds.SHOT6, 0.1f, 4);
|
super(Tiers.NETHERITE, new Item.Properties().stacksTo(1).rarity(Rarity.RARE), ID, OFFSET, DAMAGE_DEFAULT, 4, ModSounds.SHOT6, 0.1f, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class ClockworkAssaultRifle extends BasicGun {
|
|||||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||||
|
|
||||||
public ClockworkAssaultRifle() {
|
public ClockworkAssaultRifle() {
|
||||||
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.RARE), ID, OFFSET, DAMAGE_DEFAULT, 24, ModSounds.SHOT7, 0.2f, 5);
|
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.COMMON), ID, OFFSET, DAMAGE_DEFAULT, 24, ModSounds.SHOT7, 0.2f, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -16,6 +16,6 @@ public class FlintlockPistol extends BasicGun {
|
|||||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||||
|
|
||||||
public FlintlockPistol() {
|
public FlintlockPistol() {
|
||||||
super(Tiers.IRON, new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON), ID, OFFSET, DAMAGE_DEFAULT, 16, ModSounds.SHOT4, 0.25f, 10);
|
super(Tiers.IRON, new Item.Properties().stacksTo(1), ID, OFFSET, DAMAGE_DEFAULT, 16, ModSounds.SHOT4, 0.25f, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,7 @@ public class Gatligator extends BasicGun {
|
|||||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||||
|
|
||||||
public Gatligator() {
|
public Gatligator() {
|
||||||
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.RARE), ID, OFFSET, DAMAGE_DEFAULT, 7, ModSounds.SHOT6, 0.1f, 5);
|
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON), ID, OFFSET, DAMAGE_DEFAULT, 7, ModSounds.SHOT6, 0.1f, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -16,6 +16,6 @@ public class Handgun extends BasicGun {
|
|||||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||||
|
|
||||||
public Handgun() {
|
public Handgun() {
|
||||||
super(Tiers.IRON, new Item.Properties().stacksTo(1).rarity(Rarity.RARE), ID, OFFSET, DAMAGE_DEFAULT, 15, ModSounds.SHOT6, 0.25f, 10);
|
super(Tiers.IRON, new Item.Properties().stacksTo(1), ID, OFFSET, DAMAGE_DEFAULT, 15, ModSounds.SHOT6, 0.25f, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17,6 +17,6 @@ public class Megashark extends BasicGun {
|
|||||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||||
|
|
||||||
public Megashark() {
|
public Megashark() {
|
||||||
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.EPIC), ID, OFFSET, DAMAGE_DEFAULT, AMMO_NOT_CONSUME_CHANCE_DEFAULT, 7, ModSounds.SHOT2, 0.1f, 5);
|
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON), ID, OFFSET, DAMAGE_DEFAULT, AMMO_NOT_CONSUME_CHANCE_DEFAULT, 7, ModSounds.SHOT2, 0.1f, 5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17,6 +17,6 @@ public class Minishark extends BasicGun {
|
|||||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||||
|
|
||||||
public Minishark() {
|
public Minishark() {
|
||||||
super(Tiers.IRON, new Item.Properties().stacksTo(1).rarity(Rarity.RARE), ID, OFFSET, DAMAGE_DEFAULT, AMMO_NOT_CONSUME_CHANCE_DEFAULT, 8, ModSounds.SHOT2, 0.1f, 5);
|
super(Tiers.IRON, new Item.Properties().stacksTo(1).rarity(Rarity.COMMON), ID, OFFSET, DAMAGE_DEFAULT, AMMO_NOT_CONSUME_CHANCE_DEFAULT, 8, ModSounds.SHOT2, 0.1f, 5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,11 +18,6 @@ public class Musket extends BasicGun {
|
|||||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||||
|
|
||||||
public Musket() {
|
public Musket() {
|
||||||
super(Tiers.IRON, new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON), ID, OFFSET, DAMAGE_DEFAULT, 32, ModSounds.SHOT3, 1.0f, 10);
|
super(Tiers.IRON, new Item.Properties().stacksTo(1), ID, OFFSET, DAMAGE_DEFAULT, 32, ModSounds.SHOT3, 1.0f, 10);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canUseAmmo(ItemStack weaponStack, ItemStack ammoStack) {
|
|
||||||
return ammoStack.is(ModItems.MUSKET_BALL.get()) || ammoStack.is(ModItems.ENDLESS_MUSKET_POUCH.get());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,6 +16,6 @@ public class PhoenixBlaster extends BasicGun {
|
|||||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||||
|
|
||||||
public PhoenixBlaster() {
|
public PhoenixBlaster() {
|
||||||
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.RARE), ID, OFFSET, DAMAGE_DEFAULT, 14, ModSounds.SHOT6, 0.25f, 10);
|
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1), ID, OFFSET, DAMAGE_DEFAULT, 14, ModSounds.SHOT6, 0.25f, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -28,7 +28,7 @@ public class QuadBarrelShotgun extends BasicGun {
|
|||||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||||
|
|
||||||
public QuadBarrelShotgun() {
|
public QuadBarrelShotgun() {
|
||||||
super(Tiers.IRON, new Item.Properties().stacksTo(1).rarity(Rarity.RARE), ID, OFFSET, DAMAGE_DEFAULT, 55, ModSounds.SHOT5, 1.5f, 10);
|
super(Tiers.IRON, new Item.Properties().stacksTo(1), ID, OFFSET, DAMAGE_DEFAULT, 55, ModSounds.SHOT5, 1.5f, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -16,6 +16,6 @@ public class RedRyder extends BasicGun {
|
|||||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||||
|
|
||||||
public RedRyder() {
|
public RedRyder() {
|
||||||
super(Tiers.IRON, new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON), ID, OFFSET, DAMAGE_DEFAULT, 38, ModSounds.SHOT2, 1.0f, 10);
|
super(Tiers.IRON, new Item.Properties().stacksTo(1), ID, OFFSET, DAMAGE_DEFAULT, 38, ModSounds.SHOT2, 1.0f, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,6 +16,6 @@ public class Revolver extends BasicGun {
|
|||||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||||
|
|
||||||
public Revolver() {
|
public Revolver() {
|
||||||
super(Tiers.IRON, new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON), ID, OFFSET, DAMAGE_DEFAULT, 22, ModSounds.SHOT6, 0.8f, 10);
|
super(Tiers.IRON, new Item.Properties().stacksTo(1), ID, OFFSET, DAMAGE_DEFAULT, 22, ModSounds.SHOT6, 0.8f, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,7 @@ public class Shotgun extends BasicGun {
|
|||||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||||
|
|
||||||
public Shotgun() {
|
public Shotgun() {
|
||||||
super(Tiers.IRON, new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON), ID, OFFSET, DAMAGE_DEFAULT, 45, ModSounds.SHOT5, 1.25f, 10);
|
super(Tiers.IRON, new Item.Properties().stacksTo(1).rarity(Rarity.COMMON), ID, OFFSET, DAMAGE_DEFAULT, 45, ModSounds.SHOT5, 1.25f, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class SniperRifle extends BasicGun {
|
|||||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||||
|
|
||||||
public SniperRifle() {
|
public SniperRifle() {
|
||||||
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.EPIC), ID, OFFSET, DAMAGE_DEFAULT, 36, ModSounds.SHOT, 2.0f, 10);
|
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON), ID, OFFSET, DAMAGE_DEFAULT, 36, ModSounds.SHOT, 2.0f, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getZoomScrollSpeed() {
|
public static double getZoomScrollSpeed() {
|
||||||
@@ -67,14 +67,14 @@ public class SniperRifle extends BasicGun {
|
|||||||
|
|
||||||
StaticSummon summon = AmmoUtil.createAmmoSummon(level, player, hand, stack, OFFSET);
|
StaticSummon summon = AmmoUtil.createAmmoSummon(level, player, hand, stack, OFFSET);
|
||||||
ItemStack ammoStack = RangedWeapon.getAmmoStack(stack);
|
ItemStack ammoStack = RangedWeapon.getAmmoStack(stack);
|
||||||
if(ammoStack.is(ModItems.MUSKET_BALL.get()) || ammoStack.is(ModItems.TUNGSTEN_BULLET.get())) {
|
if(ammoStack.is(ModItems.MUSKET_BALL.get()) || ammoStack.is(ModItems.TUNGSTEN_BULLET.get()) || ammoStack.is(ModItems.ENDLESS_MUSKET_POUCH.get())) {
|
||||||
AmmoUtil.setHighVelocityBullet(summon);
|
AmmoUtil.setHighVelocityBullet(summon);
|
||||||
}
|
}
|
||||||
|
|
||||||
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA);
|
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA);
|
||||||
customData.putFloat("damage", getDamage());
|
customData.putFloat("damage", getDamage());
|
||||||
customData.putFloat("knockbackScale", 2.0f);
|
customData.putFloat("knockbackScale", 2.0f);
|
||||||
customData.putInt("invulnerableTime", 10);
|
customData.putInt("invulnerableTime", 20);
|
||||||
summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData);
|
summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData);
|
||||||
level.addFreshEntity(summon);
|
level.addFreshEntity(summon);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class TacticalShotgun extends BasicGun {
|
|||||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||||
|
|
||||||
public TacticalShotgun() {
|
public TacticalShotgun() {
|
||||||
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.EPIC), ID, OFFSET, DAMAGE_DEFAULT, 34, ModSounds.SHOT8, 1.5f, 10);
|
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON), ID, OFFSET, DAMAGE_DEFAULT, 34, ModSounds.SHOT8, 1.5f, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -16,6 +16,6 @@ public class TheUndertaker extends BasicGun {
|
|||||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||||
|
|
||||||
public TheUndertaker() {
|
public TheUndertaker() {
|
||||||
super(Tiers.IRON, new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON), ID, OFFSET, DAMAGE_DEFAULT, 20, ModSounds.SHOT2, 0.5f, 10);
|
super(Tiers.IRON, new Item.Properties().stacksTo(1), ID, OFFSET, DAMAGE_DEFAULT, 20, ModSounds.SHOT2, 0.5f, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,7 @@ public class Uzi extends BasicGun {
|
|||||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||||
|
|
||||||
public Uzi() {
|
public Uzi() {
|
||||||
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.RARE), ID, OFFSET, DAMAGE_DEFAULT, 9, ModSounds.SHOT2, 0.1f, 5);
|
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON), ID, OFFSET, DAMAGE_DEFAULT, 9, ModSounds.SHOT2, 0.1f, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -36,7 +36,7 @@ public class Uzi extends BasicGun {
|
|||||||
|
|
||||||
StaticSummon summon = AmmoUtil.createAmmoSummon(level, player, hand, stack, OFFSET);
|
StaticSummon summon = AmmoUtil.createAmmoSummon(level, player, hand, stack, OFFSET);
|
||||||
ItemStack ammoStack = RangedWeapon.getAmmoStack(stack);
|
ItemStack ammoStack = RangedWeapon.getAmmoStack(stack);
|
||||||
if(ammoStack.is(ModItems.MUSKET_BALL.get()) || ammoStack.is(ModItems.TUNGSTEN_BULLET.get())) {
|
if(ammoStack.is(ModItems.MUSKET_BALL.get()) || ammoStack.is(ModItems.TUNGSTEN_BULLET.get()) || ammoStack.is(ModItems.ENDLESS_MUSKET_POUCH.get())) {
|
||||||
AmmoUtil.setHighVelocityBullet(summon);
|
AmmoUtil.setHighVelocityBullet(summon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class VenusMagnum extends BasicGun {
|
|||||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||||
|
|
||||||
public VenusMagnum() {
|
public VenusMagnum() {
|
||||||
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.EPIC), ID, OFFSET, DAMAGE_DEFAULT, 9, ModSounds.SHOT6, 0.1f, 5);
|
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.RARE), ID, OFFSET, DAMAGE_DEFAULT, 9, ModSounds.SHOT6, 0.1f, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -36,7 +36,7 @@ public class VenusMagnum extends BasicGun {
|
|||||||
|
|
||||||
StaticSummon summon = AmmoUtil.createAmmoSummon(level, player, hand, stack, OFFSET);
|
StaticSummon summon = AmmoUtil.createAmmoSummon(level, player, hand, stack, OFFSET);
|
||||||
ItemStack ammoStack = RangedWeapon.getAmmoStack(stack);
|
ItemStack ammoStack = RangedWeapon.getAmmoStack(stack);
|
||||||
if(ammoStack.is(ModItems.MUSKET_BALL.get()) || ammoStack.is(ModItems.TUNGSTEN_BULLET.get())) {
|
if(ammoStack.is(ModItems.MUSKET_BALL.get()) || ammoStack.is(ModItems.TUNGSTEN_BULLET.get()) || ammoStack.is(ModItems.ENDLESS_MUSKET_POUCH.get())) {
|
||||||
AmmoUtil.setHighVelocityBullet(summon);
|
AmmoUtil.setHighVelocityBullet(summon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.lzxnone.terraria.item.weapon.summon;
|
|||||||
|
|
||||||
import com.lzxnone.terraria.ModSounds;
|
import com.lzxnone.terraria.ModSounds;
|
||||||
import com.lzxnone.terraria.attachment.ModAttachments;
|
import com.lzxnone.terraria.attachment.ModAttachments;
|
||||||
import com.lzxnone.terraria.enchantment.ModEnchantments;
|
|
||||||
import com.lzxnone.terraria.entity.ModEntities;
|
import com.lzxnone.terraria.entity.ModEntities;
|
||||||
import com.lzxnone.terraria.entity.summon.IStaticSummonBehavior;
|
import com.lzxnone.terraria.entity.summon.IStaticSummonBehavior;
|
||||||
import com.lzxnone.terraria.entity.summon.StaticSummon;
|
import com.lzxnone.terraria.entity.summon.StaticSummon;
|
||||||
@@ -19,27 +18,20 @@ import com.lzxnone.terraria.utils.MathUtil;
|
|||||||
import com.lzxnone.terraria.utils.SoundUtil;
|
import com.lzxnone.terraria.utils.SoundUtil;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.core.registries.Registries;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResultHolder;
|
import net.minecraft.world.InteractionResultHolder;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.entity.monster.Monster;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
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.minecraft.world.level.ClipContext;
|
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
|
||||||
import net.minecraft.world.phys.HitResult;
|
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import org.joml.Quaternionf;
|
import org.joml.Quaternionf;
|
||||||
import org.joml.Vector3f;
|
import org.joml.Vector3f;
|
||||||
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@@ -90,6 +82,7 @@ public class Terraprisma extends SummonWeapon {
|
|||||||
|
|
||||||
public static final float ROTATION_LERP = 0.25f;
|
public static final float ROTATION_LERP = 0.25f;
|
||||||
public static final float ROTATION_LERP2 = 0.5f;
|
public static final float ROTATION_LERP2 = 0.5f;
|
||||||
|
public static final float ROTATION_LERP3 = 1.0f;
|
||||||
|
|
||||||
public static final float TRAIL_ALPHA = 1.0f;
|
public static final float TRAIL_ALPHA = 1.0f;
|
||||||
public static final int TRAIL_MAX_LENGTH = 20;
|
public static final int TRAIL_MAX_LENGTH = 20;
|
||||||
@@ -218,18 +211,23 @@ public class Terraprisma extends SummonWeapon {
|
|||||||
int state = customData.contains("state") ? customData.getInt("state") : 0;
|
int state = customData.contains("state") ? customData.getInt("state") : 0;
|
||||||
|
|
||||||
if(state == State.IDLE.ordinal()) {
|
if(state == State.IDLE.ordinal()) {
|
||||||
updateTargetData(summon, player);
|
storeSummonTarget(summon, findSummonTarget(summon, player, getTargetRange()));
|
||||||
tickFollowOwner(summon);
|
tickFollowOwner(summon);
|
||||||
}else if(state == State.FIGHT.ordinal()) {
|
}else if(state == State.FIGHT.ordinal()) {
|
||||||
updateTargetData(summon, player);
|
storeSummonTarget(summon, findSummonTarget(summon, player, getTargetRange()));
|
||||||
}else if(state == State.DASH_PRE.ordinal()) {
|
}else if(state == State.DASH_PRE.ordinal()) {
|
||||||
Entity target = getTarget(summon);
|
Entity target = getStoredSummonTarget(summon);
|
||||||
if(target != null) {
|
if(target != null) {
|
||||||
Vec3 distV = target.getBoundingBox().getCenter().subtract(summon.position());
|
Vec3 distV = target.getBoundingBox().getCenter().subtract(summon.position());
|
||||||
Vec3 targetDir = distV.normalize();
|
Vec3 targetDir = distV.normalize();
|
||||||
float[] targetXYRot = MathUtil.computeXYRot(targetDir.toVector3f());
|
float[] targetXYRot = MathUtil.computeXYRot(targetDir.toVector3f());
|
||||||
summon.setXRot(Mth.rotLerp(ROTATION_LERP, summon.getXRot(), targetXYRot[0]));
|
if(summon.getDeltaMovement().length() < 0.05) {
|
||||||
summon.setYRot(Mth.rotLerp(ROTATION_LERP, summon.getYRot(), targetXYRot[1]));
|
summon.setXRot(Mth.rotLerp(ROTATION_LERP3, summon.getXRot(), targetXYRot[0]));
|
||||||
|
summon.setYRot(Mth.rotLerp(ROTATION_LERP3, summon.getYRot(), targetXYRot[1]));
|
||||||
|
}else {
|
||||||
|
summon.setXRot(Mth.rotLerp(ROTATION_LERP, summon.getXRot(), targetXYRot[0]));
|
||||||
|
summon.setYRot(Mth.rotLerp(ROTATION_LERP, summon.getYRot(), targetXYRot[1]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
summon.setDeltaMovement(summon.getDeltaMovement().scale(getDashPreFriction()));
|
summon.setDeltaMovement(summon.getDeltaMovement().scale(getDashPreFriction()));
|
||||||
}else if(state == State.DASH.ordinal()) {
|
}else if(state == State.DASH.ordinal()) {
|
||||||
@@ -248,7 +246,7 @@ public class Terraprisma extends SummonWeapon {
|
|||||||
);
|
);
|
||||||
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
|
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
|
||||||
for(Entity target : targets) {
|
for(Entity target : targets) {
|
||||||
if(DamageUtil.summonAttack(summon, target, sourceStack, getDamage(customData), 1.0f)) target.invulnerableTime = 15;
|
if(DamageUtil.summonAttack(summon, target, sourceStack, customData.contains("damage") ? customData.getFloat("damage") : getDamage(), 1.0f)) target.invulnerableTime = 15;
|
||||||
}
|
}
|
||||||
}else if(state == State.ROTATE.ordinal()) {
|
}else if(state == State.ROTATE.ordinal()) {
|
||||||
int time = customData.contains("rotateTime") ? customData.getInt("rotateTime") : 0;
|
int time = customData.contains("rotateTime") ? customData.getInt("rotateTime") : 0;
|
||||||
@@ -299,7 +297,7 @@ public class Terraprisma extends SummonWeapon {
|
|||||||
|
|
||||||
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
|
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
|
||||||
for(Entity target : targets) {
|
for(Entity target : targets) {
|
||||||
if(DamageUtil.summonAttack(summon, target, sourceStack, getDamage(customData), 1.0f)) target.invulnerableTime = 15;
|
if(DamageUtil.summonAttack(summon, target, sourceStack, customData.contains("damage") ? customData.getFloat("damage") : getDamage(), 1.0f)) target.invulnerableTime = 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
customData.putInt("rotateTime", time + 1);
|
customData.putInt("rotateTime", time + 1);
|
||||||
@@ -312,11 +310,11 @@ public class Terraprisma extends SummonWeapon {
|
|||||||
|
|
||||||
public static int getNextState(StaticSummon summon, int state) {
|
public static int getNextState(StaticSummon summon, int state) {
|
||||||
if(state == State.IDLE.ordinal()) {
|
if(state == State.IDLE.ordinal()) {
|
||||||
Entity target = getTarget(summon);
|
Entity target = getStoredSummonTarget(summon);
|
||||||
if(target != null) return State.FIGHT.ordinal();
|
if(target != null) return State.FIGHT.ordinal();
|
||||||
return State.IDLE.ordinal();
|
return State.IDLE.ordinal();
|
||||||
}else if(state == State.FIGHT.ordinal()) {
|
}else if(state == State.FIGHT.ordinal()) {
|
||||||
Entity target = getTarget(summon);
|
Entity target = getStoredSummonTarget(summon);
|
||||||
if(target != null) {
|
if(target != null) {
|
||||||
Vec3 distV = target.getBoundingBox().getCenter().subtract(summon.position());
|
Vec3 distV = target.getBoundingBox().getCenter().subtract(summon.position());
|
||||||
double dist = distV.length();
|
double dist = distV.length();
|
||||||
@@ -329,7 +327,7 @@ public class Terraprisma extends SummonWeapon {
|
|||||||
}
|
}
|
||||||
return State.IDLE.ordinal();
|
return State.IDLE.ordinal();
|
||||||
}else if(state == State.DASH_PRE.ordinal()) {
|
}else if(state == State.DASH_PRE.ordinal()) {
|
||||||
Entity target = getTarget(summon);
|
Entity target = getStoredSummonTarget(summon);
|
||||||
if(target != null) {
|
if(target != null) {
|
||||||
Vec3 targetDir = target.getBoundingBox().getCenter().subtract(summon.position()).normalize();
|
Vec3 targetDir = target.getBoundingBox().getCenter().subtract(summon.position()).normalize();
|
||||||
double speed = summon.getDeltaMovement().length();
|
double speed = summon.getDeltaMovement().length();
|
||||||
@@ -361,12 +359,12 @@ public class Terraprisma extends SummonWeapon {
|
|||||||
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA).copy();
|
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA).copy();
|
||||||
customData.putInt("state", to);
|
customData.putInt("state", to);
|
||||||
if(to == State.DASH_PRE.ordinal()) {
|
if(to == State.DASH_PRE.ordinal()) {
|
||||||
Entity target = getTarget(summon);
|
Entity target = getStoredSummonTarget(summon);
|
||||||
if(target != null) {
|
if(target != null) {
|
||||||
summon.setDeltaMovement(target.getBoundingBox().getCenter().subtract(summon.position()).normalize().scale(getDashPreSpeed()));
|
summon.setDeltaMovement(target.getBoundingBox().getCenter().subtract(summon.position()).normalize().scale(getDashPreSpeed()));
|
||||||
}
|
}
|
||||||
}else if(to == State.DASH.ordinal()) {
|
}else if(to == State.DASH.ordinal()) {
|
||||||
Entity target = getTarget(summon);
|
Entity target = getStoredSummonTarget(summon);
|
||||||
if(target != null) {
|
if(target != null) {
|
||||||
summon.setDeltaMovement(Vec3.ZERO);
|
summon.setDeltaMovement(Vec3.ZERO);
|
||||||
Vec3 distV = target.getBoundingBox().getCenter().subtract(summon.position());
|
Vec3 distV = target.getBoundingBox().getCenter().subtract(summon.position());
|
||||||
@@ -376,7 +374,7 @@ public class Terraprisma extends SummonWeapon {
|
|||||||
customData.putInt("dashTime", dashTime);
|
customData.putInt("dashTime", dashTime);
|
||||||
}
|
}
|
||||||
}else if(to == State.ROTATE.ordinal()) {
|
}else if(to == State.ROTATE.ordinal()) {
|
||||||
Entity target = getTarget(summon);
|
Entity target = getStoredSummonTarget(summon);
|
||||||
if(target != null) {
|
if(target != null) {
|
||||||
Vec3 start = summon.position();
|
Vec3 start = summon.position();
|
||||||
Vec3 end = target.getBoundingBox().getCenter();
|
Vec3 end = target.getBoundingBox().getCenter();
|
||||||
@@ -462,92 +460,6 @@ public class Terraprisma extends SummonWeapon {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void updateTargetData(StaticSummon summon, Player player) {
|
|
||||||
LivingEntity target = findTarget(summon, player);
|
|
||||||
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA).copy();
|
|
||||||
if(target == null) {
|
|
||||||
customData.remove("target");
|
|
||||||
}else {
|
|
||||||
customData.putUUID("target", target.getUUID());
|
|
||||||
}
|
|
||||||
summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static LivingEntity findTarget(StaticSummon summon, Player player) {
|
|
||||||
LivingEntity playerAttackTarget = player.getLastHurtMob();
|
|
||||||
if(isValidTarget(summon, player, playerAttackTarget)) {
|
|
||||||
return playerAttackTarget;
|
|
||||||
}
|
|
||||||
|
|
||||||
LivingEntity playerAttacker = player.getLastHurtByMob();
|
|
||||||
if(isValidTarget(summon, player, playerAttacker)) {
|
|
||||||
return playerAttacker;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!player.getData(ModAttachments.SUMMON_FREE_TARGETING)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean ignoreBlockOcclusion = hasBarrenLand(summon, player);
|
|
||||||
List<Monster> monsters = summon.level().getEntitiesOfClass(
|
|
||||||
Monster.class,
|
|
||||||
AABB.ofSize(summon.position(), getTargetRange() * 2.0D, getTargetRange() * 2.0D, getTargetRange() * 2.0D),
|
|
||||||
monster -> FilterUtil.createMonsterFilter(player).test(monster)
|
|
||||||
&& (ignoreBlockOcclusion || hasFreeTargetLineOfSight(player, monster))
|
|
||||||
);
|
|
||||||
monsters.sort(Comparator.comparingDouble(monster -> monster.distanceToSqr(summon.position())));
|
|
||||||
if(!monsters.isEmpty()) {
|
|
||||||
return monsters.getFirst();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isValidTarget(StaticSummon summon, Player player, LivingEntity target) {
|
|
||||||
return target != null
|
|
||||||
&& target.level() == summon.level()
|
|
||||||
&& target.distanceToSqr(summon) <= getTargetRange() * getTargetRange()
|
|
||||||
&& FilterUtil.createLivingTargetFilter(summon, player).test(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean hasFreeTargetLineOfSight(Player player, LivingEntity target) {
|
|
||||||
BlockHitResult hitResult = player.level().clip(new ClipContext(
|
|
||||||
player.getEyePosition(),
|
|
||||||
target.getEyePosition(),
|
|
||||||
ClipContext.Block.COLLIDER,
|
|
||||||
ClipContext.Fluid.NONE,
|
|
||||||
player
|
|
||||||
));
|
|
||||||
return hitResult.getType() == HitResult.Type.MISS;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean hasBarrenLand(StaticSummon summon, Player player) {
|
|
||||||
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
|
|
||||||
if(sourceStack.isEmpty()) sourceStack = player.getWeaponItem();
|
|
||||||
if(sourceStack.isEmpty()) return false;
|
|
||||||
|
|
||||||
return player.registryAccess()
|
|
||||||
.lookupOrThrow(Registries.ENCHANTMENT)
|
|
||||||
.get(ModEnchantments.BARREN_LAND)
|
|
||||||
.map(sourceStack::getEnchantmentLevel)
|
|
||||||
.orElse(0) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Entity getTarget(StaticSummon summon) {
|
|
||||||
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA);
|
|
||||||
if(customData.contains("target") && summon.level() instanceof ServerLevel serverLevel) {
|
|
||||||
Entity target = serverLevel.getEntity(customData.getUUID("target"));
|
|
||||||
if(target != null && target.isAlive()) {
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static float getDamage(CompoundTag customData) {
|
|
||||||
return customData.contains("damage") ? customData.getFloat("damage") : getDamage();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static float[] computeCrystalColor(float time, int idx) {
|
private static float[] computeCrystalColor(float time, int idx) {
|
||||||
float hue = (time * 0.015F + idx * 0.12F) % 1.0F;
|
float hue = (time * 0.015F + idx * 0.12F) % 1.0F;
|
||||||
int rgb = Mth.hsvToRgb(hue, 0.85F, 1.0F);
|
int rgb = Mth.hsvToRgb(hue, 0.85F, 1.0F);
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ public class ModNetwork {
|
|||||||
ClearSummonHandler::handle
|
ClearSummonHandler::handle
|
||||||
);
|
);
|
||||||
registrar.playToServer(
|
registrar.playToServer(
|
||||||
ToggleSummonFreeTargetingPayload.TYPE,
|
ToggleSummonAttackModePayload.TYPE,
|
||||||
ToggleSummonFreeTargetingPayload.CODEC,
|
ToggleSummonAttackModePayload.CODEC,
|
||||||
ToggleSummonFreeTargetingHandler::handle
|
ToggleSummonAttackModeHandler::handle
|
||||||
);
|
);
|
||||||
registrar.playToClient(
|
registrar.playToClient(
|
||||||
ScreenShakePayload.TYPE,
|
ScreenShakePayload.TYPE,
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.lzxnone.terraria.network.handler;
|
||||||
|
|
||||||
|
import com.lzxnone.terraria.item.weapon.SummonWeapon;
|
||||||
|
import com.lzxnone.terraria.network.payload.ToggleSummonAttackModePayload;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.neoforged.neoforge.network.handling.IPayloadContext;
|
||||||
|
|
||||||
|
public class ToggleSummonAttackModeHandler {
|
||||||
|
public static void handle(final ToggleSummonAttackModePayload payload, final IPayloadContext context) {
|
||||||
|
context.enqueueWork(() -> {
|
||||||
|
Player player = context.player();
|
||||||
|
if(player.level().isClientSide()) return;
|
||||||
|
|
||||||
|
SummonWeapon.SummonAttackMode mode = SummonWeapon.cycleAttackMode(player);
|
||||||
|
player.displayClientMessage(
|
||||||
|
Component.translatable("message.lzxnoneterraria.summon_attack_mode", mode.getDisplayName()).withStyle(mode.getColor()),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
-27
@@ -1,27 +0,0 @@
|
|||||||
package com.lzxnone.terraria.network.handler;
|
|
||||||
|
|
||||||
import com.lzxnone.terraria.attachment.ModAttachments;
|
|
||||||
import com.lzxnone.terraria.network.payload.ToggleSummonFreeTargetingPayload;
|
|
||||||
import net.minecraft.ChatFormatting;
|
|
||||||
import net.minecraft.network.chat.Component;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
|
||||||
import net.neoforged.neoforge.network.handling.IPayloadContext;
|
|
||||||
|
|
||||||
public class ToggleSummonFreeTargetingHandler {
|
|
||||||
public static void handle(final ToggleSummonFreeTargetingPayload payload, final IPayloadContext context) {
|
|
||||||
context.enqueueWork(() -> {
|
|
||||||
Player player = context.player();
|
|
||||||
if(player.level().isClientSide()) return;
|
|
||||||
|
|
||||||
boolean enabled = !player.getData(ModAttachments.SUMMON_FREE_TARGETING);
|
|
||||||
player.setData(ModAttachments.SUMMON_FREE_TARGETING, enabled);
|
|
||||||
player.displayClientMessage(
|
|
||||||
Component.translatable(enabled
|
|
||||||
? "message.lzxnoneterraria.summon_free_targeting_enabled"
|
|
||||||
: "message.lzxnoneterraria.summon_free_targeting_disabled")
|
|
||||||
.withStyle(enabled ? ChatFormatting.GREEN : ChatFormatting.RED),
|
|
||||||
true
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+8
-8
@@ -1,20 +1,20 @@
|
|||||||
package com.lzxnone.terraria.network.payload;
|
package com.lzxnone.terraria.network.payload;
|
||||||
|
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.network.codec.ByteBufCodecs;
|
|
||||||
import net.minecraft.network.codec.StreamCodec;
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
||||||
public record ToggleSummonFreeTargetingPayload(boolean ignored) implements CustomPacketPayload {
|
public class ToggleSummonAttackModePayload implements CustomPacketPayload {
|
||||||
public static final CustomPacketPayload.Type<ToggleSummonFreeTargetingPayload> TYPE = new CustomPacketPayload.Type<>(
|
public static final CustomPacketPayload.Type<ToggleSummonAttackModePayload> TYPE = new CustomPacketPayload.Type<>(
|
||||||
ResourceLocation.fromNamespaceAndPath("lzxnoneterraria", "toggle_summon_free_targeting_payload")
|
ResourceLocation.fromNamespaceAndPath("lzxnoneterraria", "toggle_summon_attack_mode_payload")
|
||||||
);
|
);
|
||||||
|
|
||||||
public static final StreamCodec<FriendlyByteBuf, ToggleSummonFreeTargetingPayload> CODEC = StreamCodec.composite(
|
public static final StreamCodec<FriendlyByteBuf, ToggleSummonAttackModePayload> CODEC =
|
||||||
ByteBufCodecs.BOOL, ToggleSummonFreeTargetingPayload::ignored,
|
StreamCodec.of(
|
||||||
ToggleSummonFreeTargetingPayload::new
|
(buf, payload) -> {},
|
||||||
);
|
buf -> new ToggleSummonAttackModePayload()
|
||||||
|
);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CustomPacketPayload.Type<? extends CustomPacketPayload> type() {
|
public CustomPacketPayload.Type<? extends CustomPacketPayload> type() {
|
||||||
@@ -2,11 +2,24 @@ package com.lzxnone.terraria.utils;
|
|||||||
|
|
||||||
import com.lzxnone.terraria.entity.projectile.StaticProjectile;
|
import com.lzxnone.terraria.entity.projectile.StaticProjectile;
|
||||||
import com.lzxnone.terraria.entity.summon.StaticSummon;
|
import com.lzxnone.terraria.entity.summon.StaticSummon;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
import net.minecraft.world.entity.boss.EnderDragonPart;
|
||||||
|
import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
|
||||||
import net.minecraft.world.entity.projectile.ProjectileUtil;
|
import net.minecraft.world.entity.projectile.ProjectileUtil;
|
||||||
import net.minecraft.world.level.ClipContext;
|
import net.minecraft.world.level.ClipContext;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.EntityHitResult;
|
import net.minecraft.world.phys.EntityHitResult;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import net.neoforged.neoforge.entity.PartEntity;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class CollisionUtil {
|
public class CollisionUtil {
|
||||||
public static EntityHitResult checkEntityHit(StaticProjectile projectile, double inflate) {
|
public static EntityHitResult checkEntityHit(StaticProjectile projectile, double inflate) {
|
||||||
@@ -23,20 +36,6 @@ public class CollisionUtil {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EntityHitResult checkEntityHit(StaticProjectile projectile) {
|
|
||||||
return checkEntityHit(projectile, 1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BlockHitResult checkBlockHit(StaticProjectile projectile) {
|
|
||||||
BlockHitResult result = projectile.level().clip(new ClipContext(
|
|
||||||
projectile.position(), projectile.position().add(projectile.getDeltaMovement()),
|
|
||||||
ClipContext.Block.COLLIDER,
|
|
||||||
ClipContext.Fluid.NONE,
|
|
||||||
projectile
|
|
||||||
));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static EntityHitResult checkEntityHit(StaticSummon summon, Vec3 nextPos, double inflate) {
|
public static EntityHitResult checkEntityHit(StaticSummon summon, Vec3 nextPos, double inflate) {
|
||||||
EntityHitResult result = ProjectileUtil.getEntityHitResult(
|
EntityHitResult result = ProjectileUtil.getEntityHitResult(
|
||||||
summon.level(),
|
summon.level(),
|
||||||
@@ -51,17 +50,77 @@ public class CollisionUtil {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EntityHitResult checkEntityHit(StaticSummon summon, Vec3 nextPos) {
|
public static BlockHitResult checkBlockHit(Entity entity, Vec3 nextPos) {
|
||||||
return checkEntityHit(summon, nextPos, 1.0);
|
return entity.level().clip(new ClipContext(
|
||||||
}
|
entity.position(), nextPos,
|
||||||
|
|
||||||
public static BlockHitResult checkBlockHit(StaticSummon summon, Vec3 nextPos) {
|
|
||||||
BlockHitResult result = summon.level().clip(new ClipContext(
|
|
||||||
summon.position(), nextPos,
|
|
||||||
ClipContext.Block.COLLIDER,
|
ClipContext.Block.COLLIDER,
|
||||||
ClipContext.Fluid.NONE,
|
ClipContext.Fluid.NONE,
|
||||||
summon
|
entity
|
||||||
));
|
));
|
||||||
return result;
|
}
|
||||||
|
|
||||||
|
public static List<Entity> searchEntities(Level level, AABB searchBox, @Nullable Entity attacker, @Nullable Entity owner) {
|
||||||
|
return level.getEntitiesOfClass(
|
||||||
|
Entity.class,
|
||||||
|
searchBox,
|
||||||
|
FilterUtil.createTargetFilter(attacker, owner)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Entity> searchEnemies(Level level, AABB searchBox, @Nullable Entity attacker, @Nullable Entity owner) {
|
||||||
|
List<Entity> enemies = new ArrayList<>();
|
||||||
|
Set<Integer> addedIds = new HashSet<>();
|
||||||
|
|
||||||
|
for(Entity entity : level.getEntitiesOfClass(Entity.class, searchBox, entity -> isEnemySearchTarget(entity, attacker, owner))) {
|
||||||
|
if(entity instanceof EnderDragon dragon) {
|
||||||
|
addEnderDragonParts(enemies, addedIds, dragon, searchBox, attacker, owner);
|
||||||
|
}else if(addedIds.add(entity.getId())) {
|
||||||
|
enemies.add(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(EnderDragon dragon : level.getEntitiesOfClass(
|
||||||
|
EnderDragon.class,
|
||||||
|
searchBox.inflate(16.0D),
|
||||||
|
dragon -> isEnemySearchTarget(dragon, attacker, owner)
|
||||||
|
)) {
|
||||||
|
addEnderDragonParts(enemies, addedIds, dragon, searchBox, attacker, owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
return enemies;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isEnemySearchTarget(Entity entity, @Nullable Entity attacker, @Nullable Entity owner) {
|
||||||
|
if(entity instanceof EnderDragonPart dragonPart) {
|
||||||
|
return isSearchableTarget(dragonPart, attacker, owner, true)
|
||||||
|
&& isSearchableTarget(dragonPart.parentMob, attacker, owner, false);
|
||||||
|
}
|
||||||
|
if(entity instanceof EnderDragon dragon) {
|
||||||
|
return isSearchableTarget(dragon, attacker, owner, false);
|
||||||
|
}
|
||||||
|
return entity instanceof LivingEntity livingTarget
|
||||||
|
&& FilterUtil.createEnemyFilter(attacker, owner).test(livingTarget);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isSearchableTarget(Entity entity, @Nullable Entity attacker, @Nullable Entity owner, boolean requirePickable) {
|
||||||
|
return entity != null
|
||||||
|
&& entity.isAlive()
|
||||||
|
&& (!requirePickable || entity.isPickable())
|
||||||
|
&& !entity.isInvulnerable()
|
||||||
|
&& !entity.isSpectator()
|
||||||
|
&& entity != attacker
|
||||||
|
&& !(entity instanceof PartEntity<?> part && part.getParent() == attacker)
|
||||||
|
&& (owner == null || (entity != owner && !entity.isAlliedTo(owner)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addEnderDragonParts(List<Entity> enemies, Set<Integer> addedIds, EnderDragon dragon,
|
||||||
|
AABB searchBox, @Nullable Entity attacker, @Nullable Entity owner) {
|
||||||
|
for(EnderDragonPart part : dragon.getSubEntities()) {
|
||||||
|
if(part.getBoundingBox().intersects(searchBox)
|
||||||
|
&& isEnemySearchTarget(part, attacker, owner)
|
||||||
|
&& addedIds.add(part.getId())) {
|
||||||
|
enemies.add(part);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@ package com.lzxnone.terraria.utils;
|
|||||||
|
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.monster.Monster;
|
import net.minecraft.world.entity.monster.Enemy;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
@@ -40,9 +40,15 @@ public class FilterUtil {
|
|||||||
&& target != attacker;
|
&& target != attacker;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Predicate<Monster> createMonsterFilter(@Nullable Entity owner) {
|
public static Predicate<LivingEntity> createEnemyFilter(@Nullable Entity owner) {
|
||||||
return monster ->
|
return target ->
|
||||||
BASE_FILTER.test(monster)
|
createLivingTargetFilter(owner).test(target)
|
||||||
&& (owner == null || (monster != owner && !monster.isAlliedTo(owner)));
|
&& target instanceof Enemy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Predicate<LivingEntity> createEnemyFilter(Entity attacker, @Nullable Entity owner) {
|
||||||
|
return target ->
|
||||||
|
createEnemyFilter(owner).test(target)
|
||||||
|
&& target != attacker;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,12 +119,15 @@
|
|||||||
"key.lzxnoneterraria.kill_mode": "Kill Mode",
|
"key.lzxnoneterraria.kill_mode": "Kill Mode",
|
||||||
"key.lzxnoneterraria.clear_summon": "Clear Selected Summons",
|
"key.lzxnoneterraria.clear_summon": "Clear Selected Summons",
|
||||||
"key.lzxnoneterraria.clear_all_summons": "Clear All Summons",
|
"key.lzxnoneterraria.clear_all_summons": "Clear All Summons",
|
||||||
"key.lzxnoneterraria.toggle_summon_free_targeting": "Toggle Summon Free Targeting",
|
"key.lzxnoneterraria.toggle_summon_attack_mode": "Toggle Summon Attack Mode",
|
||||||
"message.lzxnoneterraria.current_summons": "Current summons %s/%s",
|
"message.lzxnoneterraria.current_summons": "Current summons %s/%s",
|
||||||
"message.lzxnoneterraria.clear_all_summons": "Cleared all summons",
|
"message.lzxnoneterraria.clear_all_summons": "Cleared all summons",
|
||||||
"message.lzxnoneterraria.clear_summon": "Cleared %s",
|
"message.lzxnoneterraria.clear_summon": "Cleared %s",
|
||||||
"message.lzxnoneterraria.summon_free_targeting_enabled": "Summon free targeting : enabled",
|
"message.lzxnoneterraria.summon_attack_mode": "Summon attack mode: %s",
|
||||||
"message.lzxnoneterraria.summon_free_targeting_disabled": "Summon free targeting : disabled",
|
"message.lzxnoneterraria.summon_attack_mode.passive": "Passive",
|
||||||
|
"message.lzxnoneterraria.summon_attack_mode.neutral": "Neutral",
|
||||||
|
"message.lzxnoneterraria.summon_attack_mode.aggressive": "Aggressive",
|
||||||
|
"message.lzxnoneterraria.summon_attack_mode.attack_target": "Attack Player Target",
|
||||||
|
|
||||||
"lzxnoneterraria.configuration.title": "LzxnoneTerraria Config",
|
"lzxnoneterraria.configuration.title": "LzxnoneTerraria Config",
|
||||||
"lzxnoneterraria.configuration.nav_weapon": "Weapon",
|
"lzxnoneterraria.configuration.nav_weapon": "Weapon",
|
||||||
|
|||||||
@@ -118,12 +118,15 @@
|
|||||||
"key.lzxnoneterraria.kill_mode": "进入杀戮模式",
|
"key.lzxnoneterraria.kill_mode": "进入杀戮模式",
|
||||||
"key.lzxnoneterraria.clear_summon": "清除指定召唤物",
|
"key.lzxnoneterraria.clear_summon": "清除指定召唤物",
|
||||||
"key.lzxnoneterraria.clear_all_summons": "清除所有召唤物",
|
"key.lzxnoneterraria.clear_all_summons": "清除所有召唤物",
|
||||||
"key.lzxnoneterraria.toggle_summon_free_targeting": "开关召唤物自由寻敌",
|
"key.lzxnoneterraria.toggle_summon_attack_mode": "切换召唤物攻击模式",
|
||||||
"message.lzxnoneterraria.current_summons": "当前召唤物 %s/%s",
|
"message.lzxnoneterraria.current_summons": "当前召唤物 %s/%s",
|
||||||
"message.lzxnoneterraria.clear_all_summons": "已清除所有召唤物",
|
"message.lzxnoneterraria.clear_all_summons": "已清除所有召唤物",
|
||||||
"message.lzxnoneterraria.clear_summon": "已清除%s",
|
"message.lzxnoneterraria.clear_summon": "已清除%s",
|
||||||
"message.lzxnoneterraria.summon_free_targeting_enabled": "召唤物自由寻敌 : 开启",
|
"message.lzxnoneterraria.summon_attack_mode": "召唤物攻击模式: %s",
|
||||||
"message.lzxnoneterraria.summon_free_targeting_disabled": "召唤物自由寻敌 : 关闭",
|
"message.lzxnoneterraria.summon_attack_mode.passive": "被动",
|
||||||
|
"message.lzxnoneterraria.summon_attack_mode.neutral": "中立",
|
||||||
|
"message.lzxnoneterraria.summon_attack_mode.aggressive": "主动",
|
||||||
|
"message.lzxnoneterraria.summon_attack_mode.attack_target": "攻击玩家目标",
|
||||||
|
|
||||||
"lzxnoneterraria.configuration.title": "LzxnoneTerraria 配置",
|
"lzxnoneterraria.configuration.title": "LzxnoneTerraria 配置",
|
||||||
"lzxnoneterraria.configuration.nav_weapon": "武器",
|
"lzxnoneterraria.configuration.nav_weapon": "武器",
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
" ",
|
||||||
|
"BBB",
|
||||||
|
"AAA"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "tag": "minecraft:oak_logs" },
|
||||||
|
"B": { "item": "minecraft:iron_block" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:boomstick",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"BCB",
|
||||||
|
"AAA",
|
||||||
|
"BDB"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:gatligator" },
|
||||||
|
"B": { "item": "minecraft:dragon_breath" },
|
||||||
|
"C": { "item": "minecraft:elytra" },
|
||||||
|
"D": { "item": "minecraft:conduit" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:chain_gun",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"AAA",
|
||||||
|
"ABA",
|
||||||
|
"AAA"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:musket_ball" },
|
||||||
|
"B": { "item": "minecraft:emerald_block" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:chlorophyte_bullet",
|
||||||
|
"count": 8
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"DDD",
|
||||||
|
"AAA",
|
||||||
|
"BBC"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:minishark" },
|
||||||
|
"B": { "item": "minecraft:diamond_block" },
|
||||||
|
"C": { "item": "minecraft:netherite_ingot" },
|
||||||
|
"D": { "item": "minecraft:gold_block" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:clockwork_assault_rifle",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"AAA",
|
||||||
|
"ABA",
|
||||||
|
"AAA"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:musket_ball" },
|
||||||
|
"B": { "item": "minecraft:amethyst_shard" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:crystal_bullet",
|
||||||
|
"count": 8
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"AAA",
|
||||||
|
"ABA",
|
||||||
|
"AAA"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:musket_ball" },
|
||||||
|
"B": { "item": "minecraft:soul_sand" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:cursed_bullet",
|
||||||
|
"count": 8
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"AAA",
|
||||||
|
"ABA",
|
||||||
|
"AAA"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "minecraft:iron_block" },
|
||||||
|
"B": { "item": "lzxnoneterraria:musket_ball" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:endless_musket_pouch",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"AAA",
|
||||||
|
"ABA",
|
||||||
|
"AAA"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:high_velocity_bullet" },
|
||||||
|
"B": { "item": "minecraft:tnt" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:exploding_bullet",
|
||||||
|
"count": 8
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
" ",
|
||||||
|
"BBB",
|
||||||
|
"AA "
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "tag": "minecraft:oak_logs" },
|
||||||
|
"B": { "item": "minecraft:iron_block" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:flintlock_pistol",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"DDD",
|
||||||
|
"AAA",
|
||||||
|
"BBC"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:clockwork_assault_rifle" },
|
||||||
|
"B": { "item": "minecraft:diamond_block" },
|
||||||
|
"C": { "item": "minecraft:netherite_block" },
|
||||||
|
"D": { "item": "minecraft:gold_block" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:gatligator",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"AAA",
|
||||||
|
"ABA",
|
||||||
|
"AAA"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:musket_ball" },
|
||||||
|
"B": { "item": "minecraft:gold_block" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:golden_bullet",
|
||||||
|
"count": 8
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"AAA",
|
||||||
|
"BBB",
|
||||||
|
"CC "
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:revolver" },
|
||||||
|
"B": { "item": "lzxnoneterraria:the_undertaker" },
|
||||||
|
"C": { "item": "minecraft:gold_block" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:handgun",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"AAA",
|
||||||
|
"ABA",
|
||||||
|
"AAA"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "minecraft:iron_ingot" },
|
||||||
|
"B": { "item": "minecraft:iron_block" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:high_velocity_bullet",
|
||||||
|
"count": 16
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"AAA",
|
||||||
|
"ABA",
|
||||||
|
"AAA"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:musket_ball" },
|
||||||
|
"B": { "item": "minecraft:honey_block" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:ichor_bullet",
|
||||||
|
"count": 8
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"AAA",
|
||||||
|
"BCB",
|
||||||
|
"AAA"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "minecraft:iron_ingot" },
|
||||||
|
"B": { "item": "minecraft:diamond_block" },
|
||||||
|
"C": { "item": "minecraft:netherite_scrap" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:luminite_bullet",
|
||||||
|
"count": 16
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"DDD",
|
||||||
|
"AAA",
|
||||||
|
"BBC"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:minishark" },
|
||||||
|
"B": { "item": "minecraft:diamond_block" },
|
||||||
|
"C": { "item": "minecraft:netherite_ingot" },
|
||||||
|
"D": {
|
||||||
|
"type": "neoforge:components",
|
||||||
|
"items": "minecraft:potion",
|
||||||
|
"components": {
|
||||||
|
"minecraft:potion_contents": {
|
||||||
|
"potion": "minecraft:strong_swiftness"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:megashark",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"AAA",
|
||||||
|
"ABA",
|
||||||
|
"AAA"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:musket_ball" },
|
||||||
|
"B": { "item": "minecraft:redstone_block" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:meteor_shot",
|
||||||
|
"count": 8
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"DDD",
|
||||||
|
"ABC",
|
||||||
|
"EEF"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:musket" },
|
||||||
|
"B": { "item": "lzxnoneterraria:flintlock_pistol" },
|
||||||
|
"C": { "item": "lzxnoneterraria:boomstick" },
|
||||||
|
"D": {
|
||||||
|
"type": "neoforge:components",
|
||||||
|
"items": "minecraft:potion",
|
||||||
|
"components": {
|
||||||
|
"minecraft:potion_contents": {
|
||||||
|
"potion": "minecraft:strong_swiftness"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"E": { "item": "minecraft:diamond" },
|
||||||
|
"F": { "item": "minecraft:netherite_scrap" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:minishark",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
" B ",
|
||||||
|
"BBB",
|
||||||
|
"AA "
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "tag": "minecraft:oak_logs" },
|
||||||
|
"B": { "item": "minecraft:iron_block" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:musket",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"AAA",
|
||||||
|
"A A",
|
||||||
|
"AAA"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "minecraft:iron_ingot" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:musket_ball",
|
||||||
|
"count": 16
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"AAA",
|
||||||
|
"ABA",
|
||||||
|
"AAA"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:high_velocity_bullet" },
|
||||||
|
"B": { "item": "minecraft:diamond_block" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:nano_bullet",
|
||||||
|
"count": 8
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"AAA",
|
||||||
|
"ABA",
|
||||||
|
"AAA"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:high_velocity_bullet" },
|
||||||
|
"B": { "item": "minecraft:black_dye" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:party_bullet",
|
||||||
|
"count": 8
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"CCC",
|
||||||
|
"AAA",
|
||||||
|
"BBD"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:handgun" },
|
||||||
|
"B": { "item": "minecraft:gold_block" },
|
||||||
|
"C": { "item": "minecraft:magma_block" },
|
||||||
|
"D": { "item": "minecraft:diamond_block" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:phoenix_blaster",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"AAA",
|
||||||
|
"AAA",
|
||||||
|
"BBC"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:boomstick" },
|
||||||
|
"B": { "item": "minecraft:diamond" },
|
||||||
|
"C": { "item": "minecraft:netherite_scrap" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:quad_barrel_shotgun",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"CCC",
|
||||||
|
"BBB",
|
||||||
|
"AA "
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "tag": "minecraft:oak_logs" },
|
||||||
|
"B": { "item": "minecraft:iron_block" },
|
||||||
|
"C": { "item": "minecraft:red_dye" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:red_ryder",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"B ",
|
||||||
|
"BAB",
|
||||||
|
"BB "
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:flintlock_pistol" },
|
||||||
|
"B": { "item": "minecraft:iron_block" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:revolver",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"ABC",
|
||||||
|
"DFE",
|
||||||
|
"GGG"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:chain_gun" },
|
||||||
|
"B": { "item": "lzxnoneterraria:venus_magnum" },
|
||||||
|
"C": { "item": "lzxnoneterraria:tactical_shotgun" },
|
||||||
|
"D": { "item": "lzxnoneterraria:sniper_rifle" },
|
||||||
|
"E": { "item": "lzxnoneterraria:sniper_rifle" },
|
||||||
|
"F": { "item": "minecraft:dragon_egg" },
|
||||||
|
"G": { "item": "minecraft:nether_star" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:sdmg",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"DDD",
|
||||||
|
"AAA",
|
||||||
|
"BBC"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:quad_barrel_shotgun" },
|
||||||
|
"B": { "item": "minecraft:diamond_block" },
|
||||||
|
"C": { "item": "minecraft:netherite_ingot" },
|
||||||
|
"D": { "item": "minecraft:gold_block" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:shotgun",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"AAA",
|
||||||
|
"ABA",
|
||||||
|
"AAA"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:musket_ball" },
|
||||||
|
"B": { "item": "minecraft:iron_block" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:silver_bullet",
|
||||||
|
"count": 8
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"DCD",
|
||||||
|
"AAA",
|
||||||
|
"BBB"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:clockwork_assault_rifle" },
|
||||||
|
"B": { "item": "minecraft:netherite_block" },
|
||||||
|
"C": { "item": "minecraft:spyglass" },
|
||||||
|
"D": { "item": "minecraft:sea_lantern" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:sniper_rifle",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"BBB",
|
||||||
|
"AAA",
|
||||||
|
"CDC"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:shotgun" },
|
||||||
|
"B": { "item": "minecraft:netherite_block" },
|
||||||
|
"C": { "item": "minecraft:mace" },
|
||||||
|
"D": { "item": "minecraft:silence_armor_trim_smithing_template" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:tactical_shotgun",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"CCC",
|
||||||
|
"BAB",
|
||||||
|
"BB "
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:flintlock_pistol" },
|
||||||
|
"B": { "item": "minecraft:iron_block" },
|
||||||
|
"C": { "item": "minecraft:red_dye" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:the_undertaker",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"AAA",
|
||||||
|
"ABA",
|
||||||
|
"AAA"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:musket_ball" },
|
||||||
|
"B": { "item": "minecraft:copper_block" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:tungsten_bullet",
|
||||||
|
"count": 8
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"DDD",
|
||||||
|
"AAA",
|
||||||
|
"BBC"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:clockwork_assault_rifle" },
|
||||||
|
"B": { "item": "minecraft:diamond_block" },
|
||||||
|
"C": { "item": "minecraft:netherite_block" },
|
||||||
|
"D": { "item": "minecraft:emerald_block" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:uzi",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"AAA",
|
||||||
|
"ABA",
|
||||||
|
"AAA"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:high_velocity_bullet" },
|
||||||
|
"B": {
|
||||||
|
"type": "neoforge:components",
|
||||||
|
"items": "minecraft:potion",
|
||||||
|
"components": {
|
||||||
|
"minecraft:potion_contents": {
|
||||||
|
"potion": "minecraft:poison"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:venom_bullet",
|
||||||
|
"count": 8
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"category": "combat",
|
||||||
|
"pattern": [
|
||||||
|
"DDD",
|
||||||
|
"ABC",
|
||||||
|
"EEF"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"A": { "item": "lzxnoneterraria:gatligator" },
|
||||||
|
"B": { "item": "lzxnoneterraria:uzi" },
|
||||||
|
"C": { "item": "lzxnoneterraria:megashark" },
|
||||||
|
"D": { "item": "minecraft:totem_of_undying" },
|
||||||
|
"E": { "item": "minecraft:diamond_block" },
|
||||||
|
"F": { "item": "minecraft:netherite_block" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "lzxnoneterraria:venus_magnum",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user