移除部分阔剑procedure
This commit is contained in:
parent
16f6b1e7d0
commit
28a8f71508
6 changed files with 30 additions and 109 deletions
|
@ -81,7 +81,6 @@ public class BocekarrowEntity extends AbstractArrow implements ItemSupplier {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onHitEntity(EntityHitResult result) {
|
protected void onHitEntity(EntityHitResult result) {
|
||||||
final Vec3 position = this.position();
|
|
||||||
Entity entity = result.getEntity();
|
Entity entity = result.getEntity();
|
||||||
if (this.getOwner() instanceof LivingEntity living) {
|
if (this.getOwner() instanceof LivingEntity living) {
|
||||||
double _setval = 25;
|
double _setval = 25;
|
||||||
|
@ -95,7 +94,7 @@ public class BocekarrowEntity extends AbstractArrow implements ItemSupplier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (entity instanceof LivingEntity livingEntity) {
|
if (entity instanceof LivingEntity livingEntity) {
|
||||||
entity.invulnerableTime = 0;
|
livingEntity.invulnerableTime = 0;
|
||||||
}
|
}
|
||||||
AABB boundingBox = entity.getBoundingBox();
|
AABB boundingBox = entity.getBoundingBox();
|
||||||
Vec3 startVec = this.position();
|
Vec3 startVec = this.position();
|
||||||
|
@ -110,7 +109,7 @@ public class BocekarrowEntity extends AbstractArrow implements ItemSupplier {
|
||||||
if (box != null) {
|
if (box != null) {
|
||||||
box = box.move(boundingBox.getCenter().x, boundingBox.minY, boundingBox.getCenter().z);
|
box = box.move(boundingBox.getCenter().x, boundingBox.minY, boundingBox.getCenter().z);
|
||||||
Optional<Vec3> headshotHitPos = box.clip(startVec, endVec);
|
Optional<Vec3> headshotHitPos = box.clip(startVec, endVec);
|
||||||
if (!headshotHitPos.isPresent()) {
|
if (headshotHitPos.isEmpty()) {
|
||||||
box = box.inflate(0.2, 0.2, 0.2);
|
box = box.inflate(0.2, 0.2, 0.2);
|
||||||
headshotHitPos = box.clip(startVec, endVec);
|
headshotHitPos = box.clip(startVec, endVec);
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,6 +194,11 @@ public class ClaymoreEntity extends TamableAnimal implements GeoEntity, Animated
|
||||||
@Override
|
@Override
|
||||||
public void baseTick() {
|
public void baseTick() {
|
||||||
super.baseTick();
|
super.baseTick();
|
||||||
|
|
||||||
|
if (this.getPersistentData().getDouble("claymore") > 0) {
|
||||||
|
this.getPersistentData().putDouble("claymore", (this.getPersistentData().getDouble("claymore") - 1));
|
||||||
|
}
|
||||||
|
|
||||||
ClaymoreDangShiTiGengXinKeShiProcedure.execute(this.level(), this.getX(), this.getY(), this.getZ(), this);
|
ClaymoreDangShiTiGengXinKeShiProcedure.execute(this.level(), this.getX(), this.getY(), this.getZ(), this);
|
||||||
this.refreshDimensions();
|
this.refreshDimensions();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
package net.mcreator.target.item;
|
package net.mcreator.target.item;
|
||||||
|
|
||||||
import net.mcreator.target.procedures.ClaymoreMineYouJiFangKuaiShiFangKuaiDeWeiZhiProcedure;
|
import net.mcreator.target.entity.ClaymoreEntity;
|
||||||
|
import net.mcreator.target.init.TargetModEntities;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
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.MobSpawnType;
|
||||||
|
import net.minecraft.world.entity.TamableAnimal;
|
||||||
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;
|
||||||
|
@ -24,9 +28,23 @@ public class ClaymoreMineItem extends Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InteractionResultHolder<ItemStack> use(Level world, Player entity, InteractionHand hand) {
|
public InteractionResultHolder<ItemStack> use(Level world, Player player, InteractionHand hand) {
|
||||||
InteractionResultHolder<ItemStack> ar = super.use(world, entity, hand);
|
ItemStack stack = player.getItemInHand(hand);
|
||||||
ClaymoreMineYouJiFangKuaiShiFangKuaiDeWeiZhiProcedure.execute(world, entity.getX(), entity.getY(), entity.getZ(), entity, ar.getObject());
|
|
||||||
return ar;
|
if (world instanceof ServerLevel serverLevel) {
|
||||||
|
TamableAnimal entityToSpawn = new ClaymoreEntity(TargetModEntities.CLAYMORE.get(), serverLevel);
|
||||||
|
entityToSpawn.moveTo(player.getX(), player.getY() + 1.1, player.getZ(), player.getYRot(), player.getXRot());
|
||||||
|
entityToSpawn.setYBodyRot(player.getYRot());
|
||||||
|
entityToSpawn.setYHeadRot(player.getYRot());
|
||||||
|
entityToSpawn.setDeltaMovement((0.5 * player.getLookAngle().x), (0.5 * player.getLookAngle().y), (0.5 * player.getLookAngle().z));
|
||||||
|
entityToSpawn.finalizeSpawn(serverLevel, serverLevel.getCurrentDifficultyAt(entityToSpawn.blockPosition()), MobSpawnType.MOB_SUMMONED, null, null);
|
||||||
|
entityToSpawn.tame(player);
|
||||||
|
serverLevel.addFreshEntity(entityToSpawn);
|
||||||
|
}
|
||||||
|
|
||||||
|
player.getCooldowns().addCooldown(this, 20);
|
||||||
|
stack.shrink(1);
|
||||||
|
|
||||||
|
return InteractionResultHolder.consume(stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
package net.mcreator.target.procedures;
|
|
||||||
|
|
||||||
import net.minecraft.commands.CommandSource;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
|
|
||||||
public class BullettestDanSheWuJiZhongFangKuaiShiProcedure {
|
|
||||||
public static void execute(Entity immediatesourceentity) {
|
|
||||||
if (immediatesourceentity == null)
|
|
||||||
return;
|
|
||||||
{
|
|
||||||
if (!immediatesourceentity.level().isClientSide() && immediatesourceentity.getServer() != null) {
|
|
||||||
immediatesourceentity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, immediatesourceentity.position(), immediatesourceentity.getRotationVector(), immediatesourceentity.level() instanceof ServerLevel ? (ServerLevel) immediatesourceentity.level() : null, 4,
|
|
||||||
immediatesourceentity.getName().getString(), immediatesourceentity.getDisplayName(), immediatesourceentity.level().getServer(), immediatesourceentity), "particle target:bullthole ~ ~ ~ 0 0 0 0 1 force");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
if (!immediatesourceentity.level().isClientSide() && immediatesourceentity.getServer() != null) {
|
|
||||||
immediatesourceentity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, immediatesourceentity.position(), immediatesourceentity.getRotationVector(), immediatesourceentity.level() instanceof ServerLevel ? (ServerLevel) immediatesourceentity.level() : null, 4,
|
|
||||||
immediatesourceentity.getName().getString(), immediatesourceentity.getDisplayName(), immediatesourceentity.level().getServer(), immediatesourceentity), "particle minecraft:smoke ~ ~ ~ 0 0.1 0 0.01 3 force");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
if (!immediatesourceentity.level().isClientSide() && immediatesourceentity.getServer() != null) {
|
|
||||||
immediatesourceentity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, immediatesourceentity.position(), immediatesourceentity.getRotationVector(), immediatesourceentity.level() instanceof ServerLevel ? (ServerLevel) immediatesourceentity.level() : null, 4,
|
|
||||||
immediatesourceentity.getName().getString(), immediatesourceentity.getDisplayName(), immediatesourceentity.level().getServer(), immediatesourceentity), "playsound target:land block @a ~ ~ ~ 1 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!immediatesourceentity.level().isClientSide())
|
|
||||||
immediatesourceentity.discard();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,39 +0,0 @@
|
||||||
package net.mcreator.target.procedures;
|
|
||||||
|
|
||||||
import net.mcreator.target.entity.ClaymoreEntity;
|
|
||||||
import net.mcreator.target.init.TargetModEntities;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.InteractionHand;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.entity.MobSpawnType;
|
|
||||||
import net.minecraft.world.entity.TamableAnimal;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
import net.minecraft.world.level.LevelAccessor;
|
|
||||||
|
|
||||||
public class ClaymoreMineYouJiFangKuaiShiFangKuaiDeWeiZhiProcedure {
|
|
||||||
public static void execute(LevelAccessor world, double x, double y, double z, Entity entity, ItemStack itemstack) {
|
|
||||||
if (entity == null) return;
|
|
||||||
if (entity instanceof LivingEntity _entity)
|
|
||||||
_entity.swing(InteractionHand.MAIN_HAND, true);
|
|
||||||
if (world instanceof ServerLevel _level) {
|
|
||||||
TamableAnimal entityToSpawn = new ClaymoreEntity(TargetModEntities.CLAYMORE.get(), _level);
|
|
||||||
entityToSpawn.moveTo(x, (y + 1.1), z, entity.getYRot(), entity.getXRot());
|
|
||||||
entityToSpawn.setYBodyRot(entity.getYRot());
|
|
||||||
entityToSpawn.setYHeadRot(entity.getYRot());
|
|
||||||
entityToSpawn.setDeltaMovement((0.5 * entity.getLookAngle().x), (0.5 * entity.getLookAngle().y), (0.5 * entity.getLookAngle().z));
|
|
||||||
entityToSpawn.finalizeSpawn(_level, _level.getCurrentDifficultyAt(entityToSpawn.blockPosition()), MobSpawnType.MOB_SUMMONED, null, null);
|
|
||||||
if (entity instanceof Player _owner) {
|
|
||||||
entityToSpawn.tame(_owner);
|
|
||||||
}
|
|
||||||
_level.addFreshEntity(entityToSpawn);
|
|
||||||
}
|
|
||||||
if (entity instanceof Player player) {
|
|
||||||
player.getCooldowns().addCooldown(itemstack.getItem(), 20);
|
|
||||||
if (!player.isCreative()) {
|
|
||||||
player.getInventory().clearOrCountMatchingItems(p -> itemstack.getItem() == p.getItem(), 1, player.inventoryMenu.getCraftSlots());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
package net.mcreator.target.procedures;
|
|
||||||
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
|
||||||
import net.minecraftforge.eventbus.api.Event;
|
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
|
||||||
import net.minecraftforge.fml.common.Mod;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
@Mod.EventBusSubscriber
|
|
||||||
public class ClaymoretimeProcedure {
|
|
||||||
@SubscribeEvent
|
|
||||||
public static void onEntityTick(LivingEvent.LivingTickEvent event) {
|
|
||||||
execute(event, event.getEntity());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void execute(Entity entity) {
|
|
||||||
execute(null, entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void execute(@Nullable Event event, Entity entity) {
|
|
||||||
if (entity == null)
|
|
||||||
return;
|
|
||||||
if (entity.getPersistentData().getDouble("claymore") > 0) {
|
|
||||||
entity.getPersistentData().putDouble("claymore", (entity.getPersistentData().getDouble("claymore") - 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue