添加捷径包的功能
This commit is contained in:
parent
03a06c2ffd
commit
8d4b272cef
1 changed files with 17 additions and 10 deletions
|
@ -23,6 +23,7 @@ import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.level.ClipContext;
|
import net.minecraft.world.level.ClipContext;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import net.minecraftforge.event.AnvilUpdateEvent;
|
||||||
import net.minecraftforge.event.TickEvent;
|
import net.minecraftforge.event.TickEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
@ -92,7 +93,6 @@ public class PlayerEventHandler {
|
||||||
handleChangeFireRate(player);
|
handleChangeFireRate(player);
|
||||||
handleBocekPulling(player);
|
handleBocekPulling(player);
|
||||||
handleGunRecoil(player);
|
handleGunRecoil(player);
|
||||||
handleWeaponSeek(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleGround(player);
|
handleGround(player);
|
||||||
|
@ -104,15 +104,6 @@ public class PlayerEventHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 测试用
|
|
||||||
private static void handleWeaponSeek(Player player) {
|
|
||||||
// if (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).zooming) {
|
|
||||||
// Entity seekingEntity = SeekTool.seekEntity(player, player.level(), 256, 30);
|
|
||||||
// if (seekingEntity instanceof LivingEntity _entity && !_entity.level().isClientSide())
|
|
||||||
// _entity.addEffect(new MobEffectInstance(MobEffects.GLOWING, 2, 0));
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void handleWeaponSway(Player player) {
|
private static void handleWeaponSway(Player player) {
|
||||||
if (player.getMainHandItem().is(ModTags.Items.GUN)) {
|
if (player.getMainHandItem().is(ModTags.Items.GUN)) {
|
||||||
float pose;
|
float pose;
|
||||||
|
@ -572,4 +563,20 @@ public class PlayerEventHandler {
|
||||||
ModUtils.PACKET_HANDLER.send(PacketDistributor.PLAYER.with(() -> serverPlayer), new SimulationDistanceMessage(maxDistance));
|
ModUtils.PACKET_HANDLER.send(PacketDistributor.PLAYER.with(() -> serverPlayer), new SimulationDistanceMessage(maxDistance));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void onAnvilUpdate(AnvilUpdateEvent event) {
|
||||||
|
ItemStack left = event.getLeft();
|
||||||
|
ItemStack right = event.getRight();
|
||||||
|
|
||||||
|
if (left.is(ModTags.Items.GUN) && right.getItem() == ModItems.SHORTCUT_PACK.get()) {
|
||||||
|
ItemStack output = left.copy();
|
||||||
|
|
||||||
|
output.getOrCreateTag().putDouble("UpgradePoint", output.getOrCreateTag().getDouble("UpgradePoint") + 1);
|
||||||
|
|
||||||
|
event.setOutput(output);
|
||||||
|
event.setCost(10);
|
||||||
|
event.setMaterialCost(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue