优化部分代码

This commit is contained in:
Light_Quanta 2024-05-05 15:44:33 +08:00
parent 7dde8eef4b
commit 8f7db46aec
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
475 changed files with 25909 additions and 28052 deletions

View file

@ -41,6 +41,7 @@ import java.util.function.Supplier;
public class TargetMod { public class TargetMod {
public static final Logger LOGGER = LogManager.getLogger(TargetMod.class); public static final Logger LOGGER = LogManager.getLogger(TargetMod.class);
public static final String MODID = "target"; public static final String MODID = "target";
public TargetMod() { public TargetMod() {
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
@ -76,7 +77,7 @@ public class TargetMod {
private static final Collection<AbstractMap.SimpleEntry<Runnable, Integer>> workQueue = new ConcurrentLinkedQueue<>(); private static final Collection<AbstractMap.SimpleEntry<Runnable, Integer>> workQueue = new ConcurrentLinkedQueue<>();
public static void queueServerWork(int tick, Runnable action) { public static void queueServerWork(int tick, Runnable action) {
workQueue.add(new AbstractMap.SimpleEntry(action, tick)); workQueue.add(new AbstractMap.SimpleEntry<>(action, tick));
} }
@SubscribeEvent @SubscribeEvent

View file

@ -1,18 +1,17 @@
package net.mcreator.target.block; package net.mcreator.target.block;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.PickaxeItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.entity.player.Player;
import net.minecraft.network.chat.Component;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.PickaxeItem;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import java.util.List; import java.util.List;

View file

@ -1,18 +1,17 @@
package net.mcreator.target.block; package net.mcreator.target.block;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.PickaxeItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.entity.player.Player;
import net.minecraft.network.chat.Component;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.PickaxeItem;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import java.util.List; import java.util.List;

View file

@ -1,18 +1,17 @@
package net.mcreator.target.block; package net.mcreator.target.block;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.PickaxeItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.entity.player.Player;
import net.minecraft.network.chat.Component;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.PickaxeItem;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import java.util.List; import java.util.List;

View file

@ -1,35 +1,31 @@
package net.mcreator.target.block; package net.mcreator.target.block;
import io.netty.buffer.Unpooled;
import net.mcreator.target.world.inventory.GunRecycleGuiMenu;
import net.minecraft.core.BlockPos;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.NetworkHooks;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.InteractionHand;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.network.chat.Component;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.core.BlockPos;
import net.mcreator.target.world.inventory.GunRecycleGuiMenu;
import java.util.List;
import java.util.Collections; import java.util.Collections;
import java.util.List;
import io.netty.buffer.Unpooled;
public class GunRecycleBlock extends Block { public class GunRecycleBlock extends Block {
public GunRecycleBlock() { public GunRecycleBlock() {

View file

@ -1,34 +1,28 @@
package net.mcreator.target.block; package net.mcreator.target.block;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.entity.Entity;
import net.minecraft.network.chat.Component;
import net.minecraft.core.Direction;
import net.minecraft.core.BlockPos;
import net.mcreator.target.procedures.JumppadBlockShiTiZaiFangKuaiZhongPengZhuangShiProcedure; import net.mcreator.target.procedures.JumppadBlockShiTiZaiFangKuaiZhongPengZhuangShiProcedure;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import java.util.List;
import java.util.Collections; import java.util.Collections;
import java.util.List;
public class JumppadBlockBlock extends Block { public class JumppadBlockBlock extends Block {
public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING;
@ -61,10 +55,14 @@ public class JumppadBlockBlock extends Block {
@Override @Override
public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
return switch (state.getValue(FACING)) { return switch (state.getValue(FACING)) {
default -> Shapes.or(box(0, 0, 0, 16, 3, 16), box(-0.25, -0.1, -0.25, 2, 3.25, 2), box(14, -0.1, -0.25, 16.25, 3.25, 2), box(14, -0.1, 14, 16.25, 3.25, 16.25), box(-0.25, -0.1, 14, 2, 3.25, 16.25), box(1, 3, 1, 15, 4, 15)); default ->
case NORTH -> Shapes.or(box(0, 0, 0, 16, 3, 16), box(14, -0.1, 14, 16.25, 3.25, 16.25), box(-0.25, -0.1, 14, 2, 3.25, 16.25), box(-0.25, -0.1, -0.25, 2, 3.25, 2), box(14, -0.1, -0.25, 16.25, 3.25, 2), box(1, 3, 1, 15, 4, 15)); Shapes.or(box(0, 0, 0, 16, 3, 16), box(-0.25, -0.1, -0.25, 2, 3.25, 2), box(14, -0.1, -0.25, 16.25, 3.25, 2), box(14, -0.1, 14, 16.25, 3.25, 16.25), box(-0.25, -0.1, 14, 2, 3.25, 16.25), box(1, 3, 1, 15, 4, 15));
case EAST -> Shapes.or(box(0, 0, 0, 16, 3, 16), box(-0.25, -0.1, 14, 2, 3.25, 16.25), box(-0.25, -0.1, -0.25, 2, 3.25, 2), box(14, -0.1, -0.25, 16.25, 3.25, 2), box(14, -0.1, 14, 16.25, 3.25, 16.25), box(1, 3, 1, 15, 4, 15)); case NORTH ->
case WEST -> Shapes.or(box(0, 0, 0, 16, 3, 16), box(14, -0.1, -0.25, 16.25, 3.25, 2), box(14, -0.1, 14, 16.25, 3.25, 16.25), box(-0.25, -0.1, 14, 2, 3.25, 16.25), box(-0.25, -0.1, -0.25, 2, 3.25, 2), box(1, 3, 1, 15, 4, 15)); Shapes.or(box(0, 0, 0, 16, 3, 16), box(14, -0.1, 14, 16.25, 3.25, 16.25), box(-0.25, -0.1, 14, 2, 3.25, 16.25), box(-0.25, -0.1, -0.25, 2, 3.25, 2), box(14, -0.1, -0.25, 16.25, 3.25, 2), box(1, 3, 1, 15, 4, 15));
case EAST ->
Shapes.or(box(0, 0, 0, 16, 3, 16), box(-0.25, -0.1, 14, 2, 3.25, 16.25), box(-0.25, -0.1, -0.25, 2, 3.25, 2), box(14, -0.1, -0.25, 16.25, 3.25, 2), box(14, -0.1, 14, 16.25, 3.25, 16.25), box(1, 3, 1, 15, 4, 15));
case WEST ->
Shapes.or(box(0, 0, 0, 16, 3, 16), box(14, -0.1, -0.25, 16.25, 3.25, 2), box(14, -0.1, 14, 16.25, 3.25, 16.25), box(-0.25, -0.1, 14, 2, 3.25, 16.25), box(-0.25, -0.1, -0.25, 2, 3.25, 2), box(1, 3, 1, 15, 4, 15));
}; };
} }

View file

@ -1,20 +1,19 @@
package net.mcreator.target.block; package net.mcreator.target.block;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.ItemStack;
import net.minecraft.network.chat.Component;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import net.minecraft.world.level.storage.loot.LootParams;
import java.util.List;
import java.util.Collections; import java.util.Collections;
import java.util.List;
public class SandbagBlock extends Block { public class SandbagBlock extends Block {
public SandbagBlock() { public SandbagBlock() {

View file

@ -1,18 +1,17 @@
package net.mcreator.target.block; package net.mcreator.target.block;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.PickaxeItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.entity.player.Player;
import net.minecraft.network.chat.Component;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.PickaxeItem;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import java.util.List; import java.util.List;

View file

@ -1,20 +1,19 @@
package net.mcreator.target.client; package net.mcreator.target.client;
import com.mojang.blaze3d.platform.InputConstants; import com.mojang.blaze3d.platform.InputConstants;
import net.mcreator.target.TargetMod;
import net.mcreator.target.network.FireMessage;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.InputEvent; import net.minecraftforge.client.event.InputEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFW;
import net.minecraft.tags.ItemTags;
import net.minecraft.resources.ResourceLocation;
import net.mcreator.target.network.FireMessage;
import net.mcreator.target.TargetMod;
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT)
public class ClickHandler { public class ClickHandler {
@ -33,7 +32,7 @@ public class ClickHandler {
@SubscribeEvent @SubscribeEvent
public static void onKeyReleased(InputEvent.MouseButton.Pre event) { public static void onKeyReleased(InputEvent.MouseButton.Pre event) {
if(!isInGame()) { if (!isInGame()) {
return; return;
} }
@ -47,8 +46,6 @@ public class ClickHandler {
return; return;
} }
ItemStack heldItem = player.getMainHandItem();
int button = event.getButton(); int button = event.getButton();
if (button == GLFW.GLFW_MOUSE_BUTTON_LEFT) { if (button == GLFW.GLFW_MOUSE_BUTTON_LEFT) {
TargetMod.PACKET_HANDLER.sendToServer(new FireMessage(1, 0)); TargetMod.PACKET_HANDLER.sendToServer(new FireMessage(1, 0));
@ -58,7 +55,7 @@ public class ClickHandler {
@SubscribeEvent @SubscribeEvent
public static void onKeyPressed(InputEvent.MouseButton.Pre event) { public static void onKeyPressed(InputEvent.MouseButton.Pre event) {
if(!isInGame()) { if (!isInGame()) {
return; return;
} }
@ -85,7 +82,7 @@ public class ClickHandler {
@SubscribeEvent @SubscribeEvent
public static void onKeyPressed(InputEvent.Key event) { public static void onKeyPressed(InputEvent.Key event) {
if(!isInGame()) { if (!isInGame()) {
return; return;
} }
@ -97,23 +94,24 @@ public class ClickHandler {
Player player = mc.player; Player player = mc.player;
int button = event.getKey(); int button = event.getKey();
CompoundTag persistentData = player.getPersistentData();
if (button == GLFW.GLFW_KEY_D) { if (button == GLFW.GLFW_KEY_D) {
player.getPersistentData().putDouble("mover", 1); persistentData.putDouble("mover", 1);
} }
if (button == GLFW.GLFW_KEY_A) { if (button == GLFW.GLFW_KEY_A) {
player.getPersistentData().putDouble("movel", 1); persistentData.putDouble("movel", 1);
} }
if (button == GLFW.GLFW_KEY_W) { if (button == GLFW.GLFW_KEY_W) {
player.getPersistentData().putDouble("qian", 1); persistentData.putDouble("qian", 1);
} }
if (button == GLFW.GLFW_KEY_W) { if (button == GLFW.GLFW_KEY_W) {
player.getPersistentData().putDouble("tui", 1); persistentData.putDouble("tui", 1);
} }
} }
@SubscribeEvent @SubscribeEvent
public static void onKeyReleased(InputEvent.Key event) { public static void onKeyReleased(InputEvent.Key event) {
if(!isInGame()) { if (!isInGame()) {
return; return;
} }
@ -125,17 +123,18 @@ public class ClickHandler {
} }
int button = event.getKey(); int button = event.getKey();
CompoundTag persistentData = player.getPersistentData();
if (button == GLFW.GLFW_KEY_D) { if (button == GLFW.GLFW_KEY_D) {
player.getPersistentData().putDouble("mover", 0); persistentData.putDouble("mover", 0);
} }
if (button == GLFW.GLFW_KEY_A) { if (button == GLFW.GLFW_KEY_A) {
player.getPersistentData().putDouble("movel", 0); persistentData.putDouble("movel", 0);
} }
if (button == GLFW.GLFW_KEY_W) { if (button == GLFW.GLFW_KEY_W) {
player.getPersistentData().putDouble("qian", 0); persistentData.putDouble("qian", 0);
} }
if (button == GLFW.GLFW_KEY_W) { if (button == GLFW.GLFW_KEY_W) {
player.getPersistentData().putDouble("tui", 0); persistentData.putDouble("tui", 0);
} }
} }
} }

View file

@ -1,18 +1,14 @@
package net.mcreator.target.client; package net.mcreator.target.client;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.world.item.ItemStack; import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.ItemTags;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.RenderGuiOverlayEvent; import net.minecraftforge.client.event.RenderGuiOverlayEvent;
import net.minecraftforge.client.gui.overlay.VanillaGuiOverlay; import net.minecraftforge.client.gui.overlay.VanillaGuiOverlay;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraft.tags.ItemTags;
import net.minecraft.resources.ResourceLocation;
import net.mcreator.target.network.TargetModVariables;
@Mod.EventBusSubscriber(modid = "target", value = Dist.CLIENT) @Mod.EventBusSubscriber(modid = "target", value = Dist.CLIENT)
public class CrossHairHandler { public class CrossHairHandler {
@SubscribeEvent @SubscribeEvent
@ -30,11 +26,8 @@ public class CrossHairHandler {
return; return;
} }
ItemStack heldItem = mc.player.getMainHandItem();
{
if ((mc.player.getMainHandItem()).is(ItemTags.create(new ResourceLocation("target:gun")))) { if ((mc.player.getMainHandItem()).is(ItemTags.create(new ResourceLocation("target:gun")))) {
event.setCanceled(true); event.setCanceled(true);
} }
} }
}
} }

View file

@ -1,18 +1,14 @@
package net.mcreator.target.client; package net.mcreator.target.client;
import net.minecraft.world.item.Item;
import net.minecraft.world.scores.Objective;
import net.minecraft.client.CameraType;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraft.world.entity.player.Player;
import net.minecraft.tags.ItemTags;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.client.event.ViewportEvent; import net.minecraftforge.client.event.ViewportEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import com.ibm.icu.impl.coll.BOCSU;
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT)
public class RenderHandler { public class RenderHandler {
@ -25,16 +21,11 @@ public class RenderHandler {
Player player = Minecraft.getInstance().player; Player player = Minecraft.getInstance().player;
Minecraft mc = Minecraft.getInstance();
if (player != null) { if (player != null) {
ItemStack stack = player.getMainHandItem(); ItemStack stack = player.getMainHandItem();
double p = 0; double p = player.getPersistentData().getDouble("zoompos");
double zoom = 0; double zoom = stack.getOrCreateTag().getDouble("zoom");
p = player.getPersistentData().getDouble("zoompos");
zoom = stack.getOrCreateTag().getDouble("zoom");
if (stack.is(ItemTags.create(new ResourceLocation("target:gun")))) { if (stack.is(ItemTags.create(new ResourceLocation("target:gun")))) {
event.setFOV(event.getFOV() / (1.0 + p * (zoom - 1))); event.setFOV(event.getFOV() / (1.0 + p * (zoom - 1)));

View file

@ -1,22 +1,20 @@
package net.mcreator.target.client.gui; package net.mcreator.target.client.gui;
import net.minecraft.world.level.Level; import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.network.chat.Component;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.GuiGraphics;
import net.mcreator.target.world.inventory.GunRecycleGuiMenu;
import net.mcreator.target.network.GunRecycleGuiButtonMessage;
import net.mcreator.target.TargetMod; import net.mcreator.target.TargetMod;
import net.mcreator.target.network.GunRecycleGuiButtonMessage;
import net.mcreator.target.world.inventory.GunRecycleGuiMenu;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import java.util.HashMap; import java.util.HashMap;
import com.mojang.blaze3d.systems.RenderSystem;
public class GunRecycleGuiScreen extends AbstractContainerScreen<GunRecycleGuiMenu> { public class GunRecycleGuiScreen extends AbstractContainerScreen<GunRecycleGuiMenu> {
private final static HashMap<String, Object> guistate = GunRecycleGuiMenu.guistate; private final static HashMap<String, Object> guistate = GunRecycleGuiMenu.guistate;
private final Level world; private final Level world;
@ -83,10 +81,8 @@ public class GunRecycleGuiScreen extends AbstractContainerScreen<GunRecycleGuiMe
public void init() { public void init() {
super.init(); super.init();
button_dismantle = Button.builder(Component.translatable("gui.target.gun_recycle_gui.button_dismantle"), e -> { button_dismantle = Button.builder(Component.translatable("gui.target.gun_recycle_gui.button_dismantle"), e -> {
if (true) {
TargetMod.PACKET_HANDLER.sendToServer(new GunRecycleGuiButtonMessage(0, x, y, z)); TargetMod.PACKET_HANDLER.sendToServer(new GunRecycleGuiButtonMessage(0, x, y, z));
GunRecycleGuiButtonMessage.handleButtonAction(entity, 0, x, y, z); GunRecycleGuiButtonMessage.handleButtonAction(entity, 0, x, y, z);
}
}).bounds(this.leftPos + 62, this.topPos + 56, 52, 20).build(); }).bounds(this.leftPos + 62, this.topPos + 56, 52, 20).build();
guistate.put("button:button_dismantle", button_dismantle); guistate.put("button:button_dismantle", button_dismantle);
this.addRenderableWidget(button_dismantle); this.addRenderableWidget(button_dismantle);

View file

@ -1,25 +1,22 @@
package net.mcreator.target.client.gui; package net.mcreator.target.client.gui;
import net.minecraft.world.level.Level; import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.world.entity.player.Player; import net.mcreator.target.TargetMod;
import net.minecraft.world.entity.player.Inventory; import net.mcreator.target.network.MortarGUIButtonMessage;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.network.chat.Component;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.GuiGraphics;
import net.mcreator.target.world.inventory.MortarGUIMenu;
import net.mcreator.target.procedures.MortarAngleProcedure; import net.mcreator.target.procedures.MortarAngleProcedure;
import net.mcreator.target.procedures.MortarPitchProcedure; import net.mcreator.target.procedures.MortarPitchProcedure;
import net.mcreator.target.network.MortarGUIButtonMessage; import net.mcreator.target.world.inventory.MortarGUIMenu;
import net.minecraft.client.gui.GuiGraphics;
import net.mcreator.target.TargetMod; import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import java.util.HashMap; import java.util.HashMap;
import com.mojang.blaze3d.systems.RenderSystem;
public class MortarGUIScreen extends AbstractContainerScreen<MortarGUIMenu> { public class MortarGUIScreen extends AbstractContainerScreen<MortarGUIMenu> {
private final static HashMap<String, Object> guistate = MortarGUIMenu.guistate; private final static HashMap<String, Object> guistate = MortarGUIMenu.guistate;
private final Level world; private final Level world;
@ -92,50 +89,38 @@ public class MortarGUIScreen extends AbstractContainerScreen<MortarGUIMenu> {
public void init() { public void init() {
super.init(); super.init();
button_zeng_da_yang_jiao = Button.builder(Component.translatable("gui.target.mortar_gui.button_zeng_da_yang_jiao"), e -> { button_zeng_da_yang_jiao = Button.builder(Component.translatable("gui.target.mortar_gui.button_zeng_da_yang_jiao"), e -> {
if (true) {
TargetMod.PACKET_HANDLER.sendToServer(new MortarGUIButtonMessage(0, x, y, z)); TargetMod.PACKET_HANDLER.sendToServer(new MortarGUIButtonMessage(0, x, y, z));
MortarGUIButtonMessage.handleButtonAction(entity, 0, x, y, z); MortarGUIButtonMessage.handleButtonAction(entity, 0, x, y, z);
}
}).bounds(this.leftPos + 42, this.topPos + 124, 29, 20).build(); }).bounds(this.leftPos + 42, this.topPos + 124, 29, 20).build();
guistate.put("button:button_zeng_da_yang_jiao", button_zeng_da_yang_jiao); guistate.put("button:button_zeng_da_yang_jiao", button_zeng_da_yang_jiao);
this.addRenderableWidget(button_zeng_da_yang_jiao); this.addRenderableWidget(button_zeng_da_yang_jiao);
button_empty = Button.builder(Component.translatable("gui.target.mortar_gui.button_empty"), e -> { button_empty = Button.builder(Component.translatable("gui.target.mortar_gui.button_empty"), e -> {
if (true) {
TargetMod.PACKET_HANDLER.sendToServer(new MortarGUIButtonMessage(1, x, y, z)); TargetMod.PACKET_HANDLER.sendToServer(new MortarGUIButtonMessage(1, x, y, z));
MortarGUIButtonMessage.handleButtonAction(entity, 1, x, y, z); MortarGUIButtonMessage.handleButtonAction(entity, 1, x, y, z);
}
}).bounds(this.leftPos + -73, this.topPos + 124, 30, 20).build(); }).bounds(this.leftPos + -73, this.topPos + 124, 30, 20).build();
guistate.put("button:button_empty", button_empty); guistate.put("button:button_empty", button_empty);
this.addRenderableWidget(button_empty); this.addRenderableWidget(button_empty);
button_10 = Button.builder(Component.translatable("gui.target.mortar_gui.button_10"), e -> { button_10 = Button.builder(Component.translatable("gui.target.mortar_gui.button_10"), e -> {
if (true) {
TargetMod.PACKET_HANDLER.sendToServer(new MortarGUIButtonMessage(2, x, y, z)); TargetMod.PACKET_HANDLER.sendToServer(new MortarGUIButtonMessage(2, x, y, z));
MortarGUIButtonMessage.handleButtonAction(entity, 2, x, y, z); MortarGUIButtonMessage.handleButtonAction(entity, 2, x, y, z);
}
}).bounds(this.leftPos + 43, this.topPos + 151, 28, 20).build(); }).bounds(this.leftPos + 43, this.topPos + 151, 28, 20).build();
guistate.put("button:button_10", button_10); guistate.put("button:button_10", button_10);
this.addRenderableWidget(button_10); this.addRenderableWidget(button_10);
button_101 = Button.builder(Component.translatable("gui.target.mortar_gui.button_101"), e -> { button_101 = Button.builder(Component.translatable("gui.target.mortar_gui.button_101"), e -> {
if (true) {
TargetMod.PACKET_HANDLER.sendToServer(new MortarGUIButtonMessage(3, x, y, z)); TargetMod.PACKET_HANDLER.sendToServer(new MortarGUIButtonMessage(3, x, y, z));
MortarGUIButtonMessage.handleButtonAction(entity, 3, x, y, z); MortarGUIButtonMessage.handleButtonAction(entity, 3, x, y, z);
}
}).bounds(this.leftPos + -73, this.topPos + 151, 30, 20).build(); }).bounds(this.leftPos + -73, this.topPos + 151, 30, 20).build();
guistate.put("button:button_101", button_101); guistate.put("button:button_101", button_101);
this.addRenderableWidget(button_101); this.addRenderableWidget(button_101);
button_05 = Button.builder(Component.translatable("gui.target.mortar_gui.button_05"), e -> { button_05 = Button.builder(Component.translatable("gui.target.mortar_gui.button_05"), e -> {
if (true) {
TargetMod.PACKET_HANDLER.sendToServer(new MortarGUIButtonMessage(4, x, y, z)); TargetMod.PACKET_HANDLER.sendToServer(new MortarGUIButtonMessage(4, x, y, z));
MortarGUIButtonMessage.handleButtonAction(entity, 4, x, y, z); MortarGUIButtonMessage.handleButtonAction(entity, 4, x, y, z);
}
}).bounds(this.leftPos + -73, this.topPos + 97, 30, 20).build(); }).bounds(this.leftPos + -73, this.topPos + 97, 30, 20).build();
guistate.put("button:button_05", button_05); guistate.put("button:button_05", button_05);
this.addRenderableWidget(button_05); this.addRenderableWidget(button_05);
button_051 = Button.builder(Component.translatable("gui.target.mortar_gui.button_051"), e -> { button_051 = Button.builder(Component.translatable("gui.target.mortar_gui.button_051"), e -> {
if (true) {
TargetMod.PACKET_HANDLER.sendToServer(new MortarGUIButtonMessage(5, x, y, z)); TargetMod.PACKET_HANDLER.sendToServer(new MortarGUIButtonMessage(5, x, y, z));
MortarGUIButtonMessage.handleButtonAction(entity, 5, x, y, z); MortarGUIButtonMessage.handleButtonAction(entity, 5, x, y, z);
}
}).bounds(this.leftPos + 42, this.topPos + 97, 29, 20).build(); }).bounds(this.leftPos + 42, this.topPos + 97, 29, 20).build();
guistate.put("button:button_051", button_051); guistate.put("button:button_051", button_051);
this.addRenderableWidget(button_051); this.addRenderableWidget(button_051);

View file

@ -1,7 +1,7 @@
package net.mcreator.target.client.gui; package net.mcreator.target.client.gui;
public class RangeHelper { public class RangeHelper {
// 发射角度以度为单位需要根据实际情况修改 // 发射角度以度为单位需要根据实际情况修改
public static double getRange(double thetaDegrees) { public static double getRange(double thetaDegrees) {
double initialVelocity = 8.0; // 初始速度 8 m/s double initialVelocity = 8.0; // 初始速度 8 m/s
double thetaRadians = Math.toRadians(thetaDegrees); // 将角度转换为弧度 double thetaRadians = Math.toRadians(thetaDegrees); // 将角度转换为弧度

View file

@ -1,19 +1,14 @@
package net.mcreator.target.client.model; package net.mcreator.target.client.model;
import net.minecraft.world.entity.Entity;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.model.geom.builders.PartDefinition;
import net.minecraft.client.model.geom.builders.MeshDefinition;
import net.minecraft.client.model.geom.builders.LayerDefinition;
import net.minecraft.client.model.geom.builders.CubeListBuilder;
import net.minecraft.client.model.geom.builders.CubeDeformation;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.EntityModel;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.model.EntityModel;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
// Made with Blockbench 4.9.2 // Made with Blockbench 4.9.2
// Exported for Minecraft version 1.17 or later with Mojang mappings // Exported for Minecraft version 1.17 or later with Mojang mappings

View file

@ -1,19 +1,14 @@
package net.mcreator.target.client.model; package net.mcreator.target.client.model;
import net.minecraft.world.entity.Entity;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.model.geom.builders.PartDefinition;
import net.minecraft.client.model.geom.builders.MeshDefinition;
import net.minecraft.client.model.geom.builders.LayerDefinition;
import net.minecraft.client.model.geom.builders.CubeListBuilder;
import net.minecraft.client.model.geom.builders.CubeDeformation;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.EntityModel;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.model.EntityModel;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
// Made with Blockbench 4.9.4 // Made with Blockbench 4.9.4
// Exported for Minecraft version 1.17 or later with Mojang mappings // Exported for Minecraft version 1.17 or later with Mojang mappings

View file

@ -1,19 +1,14 @@
package net.mcreator.target.client.model; package net.mcreator.target.client.model;
import net.minecraft.world.entity.Entity;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.model.geom.builders.PartDefinition;
import net.minecraft.client.model.geom.builders.MeshDefinition;
import net.minecraft.client.model.geom.builders.LayerDefinition;
import net.minecraft.client.model.geom.builders.CubeListBuilder;
import net.minecraft.client.model.geom.builders.CubeDeformation;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.EntityModel;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.model.EntityModel;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
// Made with Blockbench 4.9.4 // Made with Blockbench 4.9.4
// Exported for Minecraft version 1.17 or later with Mojang mappings // Exported for Minecraft version 1.17 or later with Mojang mappings

View file

@ -1,19 +1,14 @@
package net.mcreator.target.client.model; package net.mcreator.target.client.model;
import net.minecraft.world.entity.Entity;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.model.geom.builders.PartDefinition;
import net.minecraft.client.model.geom.builders.MeshDefinition;
import net.minecraft.client.model.geom.builders.LayerDefinition;
import net.minecraft.client.model.geom.builders.CubeListBuilder;
import net.minecraft.client.model.geom.builders.CubeDeformation;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.EntityModel;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.model.EntityModel;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
// Made with Blockbench 4.9.2 // Made with Blockbench 4.9.2
// Exported for Minecraft version 1.17 or later with Mojang mappings // Exported for Minecraft version 1.17 or later with Mojang mappings

View file

@ -1,19 +1,14 @@
package net.mcreator.target.client.model; package net.mcreator.target.client.model;
import net.minecraft.world.entity.Entity;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.model.geom.builders.PartDefinition;
import net.minecraft.client.model.geom.builders.MeshDefinition;
import net.minecraft.client.model.geom.builders.LayerDefinition;
import net.minecraft.client.model.geom.builders.CubeListBuilder;
import net.minecraft.client.model.geom.builders.CubeDeformation;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.EntityModel;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.model.EntityModel;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
// Made with Blockbench 4.9.4 // Made with Blockbench 4.9.4
// Exported for Minecraft version 1.17 or later with Mojang mappings // Exported for Minecraft version 1.17 or later with Mojang mappings

View file

@ -1,19 +1,14 @@
package net.mcreator.target.client.model; package net.mcreator.target.client.model;
import net.minecraft.world.entity.Entity;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.model.geom.builders.PartDefinition;
import net.minecraft.client.model.geom.builders.MeshDefinition;
import net.minecraft.client.model.geom.builders.LayerDefinition;
import net.minecraft.client.model.geom.builders.CubeListBuilder;
import net.minecraft.client.model.geom.builders.CubeDeformation;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.EntityModel;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.model.EntityModel;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
// Made with Blockbench 4.9.3 // Made with Blockbench 4.9.3
// Exported for Minecraft version 1.17 or later with Mojang mappings // Exported for Minecraft version 1.17 or later with Mojang mappings

View file

@ -1,19 +1,14 @@
package net.mcreator.target.client.model; package net.mcreator.target.client.model;
import net.minecraft.world.entity.Entity;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.model.geom.builders.PartDefinition;
import net.minecraft.client.model.geom.builders.MeshDefinition;
import net.minecraft.client.model.geom.builders.LayerDefinition;
import net.minecraft.client.model.geom.builders.CubeListBuilder;
import net.minecraft.client.model.geom.builders.CubeDeformation;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.EntityModel;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.model.EntityModel;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
// Made with Blockbench 4.9.2 // Made with Blockbench 4.9.2
// Exported for Minecraft version 1.17 or later with Mojang mappings // Exported for Minecraft version 1.17 or later with Mojang mappings

View file

@ -1,19 +1,14 @@
package net.mcreator.target.client.model; package net.mcreator.target.client.model;
import net.minecraft.world.entity.Entity;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.model.geom.builders.PartDefinition;
import net.minecraft.client.model.geom.builders.MeshDefinition;
import net.minecraft.client.model.geom.builders.LayerDefinition;
import net.minecraft.client.model.geom.builders.CubeListBuilder;
import net.minecraft.client.model.geom.builders.CubeDeformation;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.EntityModel;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.model.EntityModel;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
// Made with Blockbench 4.9.4 // Made with Blockbench 4.9.4
// Exported for Minecraft version 1.17 or later with Mojang mappings // Exported for Minecraft version 1.17 or later with Mojang mappings

View file

@ -1,19 +1,14 @@
package net.mcreator.target.client.model; package net.mcreator.target.client.model;
import net.minecraft.world.entity.Entity;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.model.geom.builders.PartDefinition;
import net.minecraft.client.model.geom.builders.MeshDefinition;
import net.minecraft.client.model.geom.builders.LayerDefinition;
import net.minecraft.client.model.geom.builders.CubeListBuilder;
import net.minecraft.client.model.geom.builders.CubeDeformation;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.EntityModel;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.model.EntityModel;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
// Made with Blockbench 4.9.4 // Made with Blockbench 4.9.4
// Exported for Minecraft version 1.17 or later with Mojang mappings // Exported for Minecraft version 1.17 or later with Mojang mappings

View file

@ -1,19 +1,14 @@
package net.mcreator.target.client.model; package net.mcreator.target.client.model;
import net.minecraft.world.entity.Entity;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.model.geom.builders.PartDefinition;
import net.minecraft.client.model.geom.builders.MeshDefinition;
import net.minecraft.client.model.geom.builders.LayerDefinition;
import net.minecraft.client.model.geom.builders.CubeListBuilder;
import net.minecraft.client.model.geom.builders.CubeDeformation;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.EntityModel;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.model.EntityModel;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
// Made with Blockbench 4.9.3 // Made with Blockbench 4.9.3
// Exported for Minecraft version 1.17 or later with Mojang mappings // Exported for Minecraft version 1.17 or later with Mojang mappings

View file

@ -1,16 +1,10 @@
package net.mcreator.target.client.particle; package net.mcreator.target.client.particle;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraft.client.particle.TextureSheetParticle;
import net.minecraft.client.particle.SpriteSet;
import net.minecraft.client.particle.ParticleRenderType;
import net.minecraft.client.particle.ParticleProvider;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.particle.*;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class BulltholeParticle extends TextureSheetParticle { public class BulltholeParticle extends TextureSheetParticle {

View file

@ -1,16 +1,10 @@
package net.mcreator.target.client.particle; package net.mcreator.target.client.particle;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraft.client.particle.TextureSheetParticle;
import net.minecraft.client.particle.SpriteSet;
import net.minecraft.client.particle.ParticleRenderType;
import net.minecraft.client.particle.ParticleProvider;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.particle.*;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class FirestarParticle extends TextureSheetParticle { public class FirestarParticle extends TextureSheetParticle {
@ -38,7 +32,7 @@ public class FirestarParticle extends TextureSheetParticle {
this.spriteSet = spriteSet; this.spriteSet = spriteSet;
this.setSize(0.2f, 0.2f); this.setSize(0.2f, 0.2f);
this.quadSize *= 0.5f; this.quadSize *= 0.5f;
this.lifetime = (int) Math.max(1, 40 + (this.random.nextInt(40) - 20)); this.lifetime = Math.max(1, 40 + (this.random.nextInt(40) - 20));
this.gravity = 1f; this.gravity = 1f;
this.hasPhysics = true; this.hasPhysics = true;
this.xd = vx * 1; this.xd = vx * 1;

View file

@ -1,19 +1,17 @@
package net.mcreator.target.client.renderer; package net.mcreator.target.client.renderer;
import net.minecraft.util.Mth;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.MultiBufferSource;
import net.mcreator.target.entity.BocekarrowEntity;
import net.mcreator.target.client.model.Modelbocekarrow;
import com.mojang.math.Axis;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Axis;
import net.mcreator.target.client.model.Modelbocekarrow;
import net.mcreator.target.entity.BocekarrowEntity;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
public class BocekarrowRenderer extends EntityRenderer<BocekarrowEntity> { public class BocekarrowRenderer extends EntityRenderer<BocekarrowEntity> {
private static final ResourceLocation texture = new ResourceLocation("target:textures/entities/bocekarrow.png"); private static final ResourceLocation texture = new ResourceLocation("target:textures/entities/bocekarrow.png");

View file

@ -1,19 +1,15 @@
package net.mcreator.target.client.renderer; package net.mcreator.target.client.renderer;
import software.bernie.geckolib.renderer.GeoEntityRenderer;
import software.bernie.geckolib.cache.object.BakedGeoModel;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.MultiBufferSource;
import net.mcreator.target.entity.model.ClaymoreModel;
import net.mcreator.target.entity.ClaymoreEntity;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.mcreator.target.entity.ClaymoreEntity;
import net.mcreator.target.entity.model.ClaymoreModel;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.resources.ResourceLocation;
import software.bernie.geckolib.cache.object.BakedGeoModel;
import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class ClaymoreRenderer extends GeoEntityRenderer<ClaymoreEntity> { public class ClaymoreRenderer extends GeoEntityRenderer<ClaymoreEntity> {
public ClaymoreRenderer(EntityRendererProvider.Context renderManager) { public ClaymoreRenderer(EntityRendererProvider.Context renderManager) {

View file

@ -1,19 +1,17 @@
package net.mcreator.target.client.renderer; package net.mcreator.target.client.renderer;
import net.minecraft.util.Mth;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.MultiBufferSource;
import net.mcreator.target.entity.GunGrenadeEntity;
import net.mcreator.target.client.model.ModelGrenade;
import com.mojang.math.Axis;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Axis;
import net.mcreator.target.client.model.ModelGrenade;
import net.mcreator.target.entity.GunGrenadeEntity;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
public class GunGrenadeRenderer extends EntityRenderer<GunGrenadeEntity> { public class GunGrenadeRenderer extends EntityRenderer<GunGrenadeEntity> {
private static final ResourceLocation texture = new ResourceLocation("target:textures/entities/grenade.png"); private static final ResourceLocation texture = new ResourceLocation("target:textures/entities/grenade.png");

View file

@ -1,19 +1,15 @@
package net.mcreator.target.client.renderer; package net.mcreator.target.client.renderer;
import software.bernie.geckolib.renderer.GeoEntityRenderer;
import software.bernie.geckolib.cache.object.BakedGeoModel;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.MultiBufferSource;
import net.mcreator.target.entity.model.MortarModel;
import net.mcreator.target.entity.MortarEntity;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.mcreator.target.entity.MortarEntity;
import net.mcreator.target.entity.model.MortarModel;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.resources.ResourceLocation;
import software.bernie.geckolib.cache.object.BakedGeoModel;
import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class MortarRenderer extends GeoEntityRenderer<MortarEntity> { public class MortarRenderer extends GeoEntityRenderer<MortarEntity> {
public MortarRenderer(EntityRendererProvider.Context renderManager) { public MortarRenderer(EntityRendererProvider.Context renderManager) {

View file

@ -1,19 +1,17 @@
package net.mcreator.target.client.renderer; package net.mcreator.target.client.renderer;
import net.minecraft.util.Mth;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.MultiBufferSource;
import net.mcreator.target.entity.MortarShellEntity;
import net.mcreator.target.client.model.Modelmortar_shell_Converted;
import com.mojang.math.Axis;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Axis;
import net.mcreator.target.client.model.Modelmortar_shell_Converted;
import net.mcreator.target.entity.MortarShellEntity;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
public class MortarShellRenderer extends EntityRenderer<MortarShellEntity> { public class MortarShellRenderer extends EntityRenderer<MortarShellEntity> {
private static final ResourceLocation texture = new ResourceLocation("target:textures/entities/mortar_shell.png"); private static final ResourceLocation texture = new ResourceLocation("target:textures/entities/mortar_shell.png");

View file

@ -1,27 +1,18 @@
package net.mcreator.target.client.renderer; package net.mcreator.target.client.renderer;
import net.minecraft.util.Mth;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.layers.RenderLayer;
import net.minecraft.client.renderer.entity.MobRenderer;
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.RenderType;
import net.mcreator.target.entity.ProjectileEntity;
import net.mcreator.target.client.model.Modelbullet;
import net.minecraft.core.BlockPos;
import com.mojang.math.Axis;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Axis;
import net.mcreator.target.client.model.Modelbullet;
import net.mcreator.target.entity.ProjectileEntity;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
public class ProjectileRenderer extends EntityRenderer<ProjectileEntity> { public class ProjectileRenderer extends EntityRenderer<ProjectileEntity> {
private static final ResourceLocation texture = new ResourceLocation("target:textures/entities/bullet_tex.png"); private static final ResourceLocation texture = new ResourceLocation("target:textures/entities/bullet_tex.png");

View file

@ -1,19 +1,17 @@
package net.mcreator.target.client.renderer; package net.mcreator.target.client.renderer;
import net.minecraft.util.Mth;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.MultiBufferSource;
import net.mcreator.target.entity.RpgRocketEntity;
import net.mcreator.target.client.model.Modelrpg7_rocket_Converted;
import com.mojang.math.Axis;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Axis;
import net.mcreator.target.client.model.Modelrpg7_rocket_Converted;
import net.mcreator.target.entity.RpgRocketEntity;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
public class RpgRocketRenderer extends EntityRenderer<RpgRocketEntity> { public class RpgRocketRenderer extends EntityRenderer<RpgRocketEntity> {
private static final ResourceLocation texture = new ResourceLocation("target:textures/entities/rocket.png"); private static final ResourceLocation texture = new ResourceLocation("target:textures/entities/rocket.png");

View file

@ -1,19 +1,15 @@
package net.mcreator.target.client.renderer; package net.mcreator.target.client.renderer;
import software.bernie.geckolib.renderer.GeoEntityRenderer;
import software.bernie.geckolib.cache.object.BakedGeoModel;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.MultiBufferSource;
import net.mcreator.target.entity.model.SenpaiModel;
import net.mcreator.target.entity.SenpaiEntity;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.mcreator.target.entity.SenpaiEntity;
import net.mcreator.target.entity.model.SenpaiModel;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.resources.ResourceLocation;
import software.bernie.geckolib.cache.object.BakedGeoModel;
import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class SenpaiRenderer extends GeoEntityRenderer<SenpaiEntity> { public class SenpaiRenderer extends GeoEntityRenderer<SenpaiEntity> {
public SenpaiRenderer(EntityRendererProvider.Context renderManager) { public SenpaiRenderer(EntityRendererProvider.Context renderManager) {

View file

@ -1,19 +1,15 @@
package net.mcreator.target.client.renderer; package net.mcreator.target.client.renderer;
import software.bernie.geckolib.renderer.GeoEntityRenderer;
import software.bernie.geckolib.cache.object.BakedGeoModel;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.MultiBufferSource;
import net.mcreator.target.entity.model.Target1Model;
import net.mcreator.target.entity.Target1Entity;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.mcreator.target.entity.Target1Entity;
import net.mcreator.target.entity.model.Target1Model;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.resources.ResourceLocation;
import software.bernie.geckolib.cache.object.BakedGeoModel;
import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class Target1Renderer extends GeoEntityRenderer<Target1Entity> { public class Target1Renderer extends GeoEntityRenderer<Target1Entity> {
public Target1Renderer(EntityRendererProvider.Context renderManager) { public Target1Renderer(EntityRendererProvider.Context renderManager) {

View file

@ -1,20 +1,16 @@
package net.mcreator.target.client.renderer; package net.mcreator.target.client.renderer;
import software.bernie.geckolib.renderer.GeoEntityRenderer;
import software.bernie.geckolib.cache.object.BakedGeoModel;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.MultiBufferSource;
import net.mcreator.target.entity.model.TargetModel;
import net.mcreator.target.entity.layer.TargetLayer;
import net.mcreator.target.entity.TargetEntity;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.mcreator.target.entity.TargetEntity;
import net.mcreator.target.entity.layer.TargetLayer;
import net.mcreator.target.entity.model.TargetModel;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.resources.ResourceLocation;
import software.bernie.geckolib.cache.object.BakedGeoModel;
import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class TargetRenderer extends GeoEntityRenderer<TargetEntity> { public class TargetRenderer extends GeoEntityRenderer<TargetEntity> {
public TargetRenderer(EntityRendererProvider.Context renderManager) { public TargetRenderer(EntityRendererProvider.Context renderManager) {

View file

@ -1,19 +1,17 @@
package net.mcreator.target.client.renderer; package net.mcreator.target.client.renderer;
import net.minecraft.util.Mth;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.MultiBufferSource;
import net.mcreator.target.entity.TaserBulletProjectileEntity;
import net.mcreator.target.client.model.Modeltaser_rod;
import com.mojang.math.Axis;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Axis;
import net.mcreator.target.client.model.Modeltaser_rod;
import net.mcreator.target.entity.TaserBulletProjectileEntity;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
public class TaserBulletProjectileRenderer extends EntityRenderer<TaserBulletProjectileEntity> { public class TaserBulletProjectileRenderer extends EntityRenderer<TaserBulletProjectileEntity> {
private static final ResourceLocation texture = new ResourceLocation("target:textures/entities/taser_rod.png"); private static final ResourceLocation texture = new ResourceLocation("target:textures/entities/taser_rod.png");

View file

@ -1,20 +1,15 @@
package net.mcreator.target.client.screens; package net.mcreator.target.client.screens;
import org.checkerframework.checker.units.qual.h;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.client.event.RenderGuiEvent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraft.world.level.Level;
import net.minecraft.world.entity.player.Player;
import net.minecraft.client.Minecraft;
import net.mcreator.target.procedures.AmmocountProcedure;
import net.mcreator.target.procedures.AmmobarXianShiYouXiNeiDieJiaCengProcedure; import net.mcreator.target.procedures.AmmobarXianShiYouXiNeiDieJiaCengProcedure;
import net.mcreator.target.procedures.AmmocountProcedure;
import net.minecraft.client.Minecraft;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.RenderGuiEvent;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
@Mod.EventBusSubscriber({Dist.CLIENT}) @Mod.EventBusSubscriber({Dist.CLIENT})
public class AmmobarOverlay { public class AmmobarOverlay {
@ -22,21 +17,16 @@ public class AmmobarOverlay {
public static void eventHandler(RenderGuiEvent.Pre event) { public static void eventHandler(RenderGuiEvent.Pre event) {
int w = event.getWindow().getGuiScaledWidth(); int w = event.getWindow().getGuiScaledWidth();
int h = event.getWindow().getGuiScaledHeight(); int h = event.getWindow().getGuiScaledHeight();
Level world = null;
double x = 0;
double y = 0;
double z = 0;
Player entity = Minecraft.getInstance().player; Player entity = Minecraft.getInstance().player;
if (entity != null) {
world = entity.level();
x = entity.getX();
y = entity.getY();
z = entity.getZ();
}
if (AmmobarXianShiYouXiNeiDieJiaCengProcedure.execute(entity)) { if (AmmobarXianShiYouXiNeiDieJiaCengProcedure.execute(entity)) {
event.getGuiGraphics().drawString(Minecraft.getInstance().font, event.getGuiGraphics().drawString(
Minecraft.getInstance().font,
AmmocountProcedure.execute(entity), w / 2 + 92, h - 11, -16711936, false); AmmocountProcedure.execute(entity),
w / 2 + 92,
h - 11,
-16711936,
false
);
} }
} }
} }

View file

@ -1,38 +1,22 @@
package net.mcreator.target.client.screens; package net.mcreator.target.client.screens;
import org.checkerframework.checker.units.qual.h;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.client.event.RenderGuiEvent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraft.world.level.Level;
import net.minecraft.world.entity.player.Player;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.Minecraft;
import net.mcreator.target.init.TargetModAttributes;
import net.mcreator.target.network.TargetModVariables;
import net.mcreator.target.procedures.CrosshairXianShiYouXiNeiDieJiaCengProcedure;
import net.minecraft.client.gui.GuiGraphics;
import com.mojang.blaze3d.systems.RenderSystem;
import org.joml.Matrix4f;
import com.mojang.blaze3d.vertex.BufferUploader;
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.VertexFormat;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.*;
import com.mojang.blaze3d.vertex.Tesselator; import net.mcreator.target.init.TargetModAttributes;
import net.mcreator.target.network.TargetModVariables;
import net.mcreator.target.procedures.CrosshairXianShiYouXiNeiDieJiaCengProcedure;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.RenderGuiEvent;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import org.joml.Matrix4f;
@Mod.EventBusSubscriber({Dist.CLIENT}) @Mod.EventBusSubscriber({Dist.CLIENT})
public class CrosshairOverlay { public class CrosshairOverlay {
@ -40,30 +24,16 @@ public class CrosshairOverlay {
public static void eventHandler(RenderGuiEvent.Pre event) { public static void eventHandler(RenderGuiEvent.Pre event) {
int w = event.getWindow().getGuiScaledWidth(); int w = event.getWindow().getGuiScaledWidth();
int h = event.getWindow().getGuiScaledHeight(); int h = event.getWindow().getGuiScaledHeight();
Level world = null;
double x = 0;
double y = 0;
double z = 0;
Player entity = Minecraft.getInstance().player; Player entity = Minecraft.getInstance().player;
double spread = 0; double spread = entity.getAttribute(TargetModAttributes.SPREAD.get()).getBaseValue();
spread = entity.getAttribute(TargetModAttributes.SPREAD.get()).getBaseValue();
double hitind = 0; double hitind = (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).hitind;
hitind = (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).hitind;
double headind = 0; double headind = (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).headind;
headind = (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).headind;
double killind = 0; double killind = (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).killind;
killind = (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).killind;
if (entity != null) {
world = entity.level();
x = entity.getX();
y = entity.getY();
z = entity.getZ();
}
RenderSystem.disableDepthTest(); RenderSystem.disableDepthTest();
RenderSystem.depthMask(false); RenderSystem.depthMask(false);
RenderSystem.enableBlend(); RenderSystem.enableBlend();
@ -73,21 +43,18 @@ public class CrosshairOverlay {
if (CrosshairXianShiYouXiNeiDieJiaCengProcedure.execute(entity)) { if (CrosshairXianShiYouXiNeiDieJiaCengProcedure.execute(entity)) {
preciseBlit(event.getGuiGraphics(), new ResourceLocation("target:textures/screens/point.png"), w / 2 + -7.5f, h / 2 + -8, 0, 0, 16, 16, 16, 16); preciseBlit(event.getGuiGraphics(), new ResourceLocation("target:textures/screens/point.png"), w / 2 + -7.5f, h / 2 + -8, 0, 0, 16, 16, 16, 16);
preciseBlit(event.getGuiGraphics(), new ResourceLocation("target:textures/screens/rexheng.png"), w / 2 + -9.5f - 2.8f * (float)spread, h / 2 + -8, 0, 0, 16, 16, 16, 16); preciseBlit(event.getGuiGraphics(), new ResourceLocation("target:textures/screens/rexheng.png"), w / 2 + -9.5f - 2.8f * (float) spread, h / 2 + -8, 0, 0, 16, 16, 16, 16);
preciseBlit(event.getGuiGraphics(), new ResourceLocation("target:textures/screens/rexheng.png"), w / 2 + -6.5f + 2.8f * (float)spread, h / 2 + -8, 0, 0, 16, 16, 16, 16); preciseBlit(event.getGuiGraphics(), new ResourceLocation("target:textures/screens/rexheng.png"), w / 2 + -6.5f + 2.8f * (float) spread, h / 2 + -8, 0, 0, 16, 16, 16, 16);
preciseBlit(event.getGuiGraphics(), new ResourceLocation("target:textures/screens/rexshu.png"), w / 2 + -7.5f, h / 2 + -7 + 2.8f * (float)spread, 0, 0, 16, 16, 16, 16); preciseBlit(event.getGuiGraphics(), new ResourceLocation("target:textures/screens/rexshu.png"), w / 2 + -7.5f, h / 2 + -7 + 2.8f * (float) spread, 0, 0, 16, 16, 16, 16);
preciseBlit(event.getGuiGraphics(), new ResourceLocation("target:textures/screens/rexshu.png"), w / 2 + -7.5f, h / 2 + -10 - 2.8f * (float)spread, 0, 0, 16, 16, 16, 16); preciseBlit(event.getGuiGraphics(), new ResourceLocation("target:textures/screens/rexshu.png"), w / 2 + -7.5f, h / 2 + -10 - 2.8f * (float) spread, 0, 0, 16, 16, 16, 16);
} }
float ww = 0; float ww = w / 2 - 7.5f + (float) (2 * (Math.random() - 0.5f));
float hh = 0; float hh = h / 2 - 8 + (float) (2 * (Math.random() - 0.5f));
float m = 0; float m = (float) ((40 - killind) / 5.5f);
ww = w / 2 + -7.5f + (float)(2 * (Math.random() - 0.5f));
hh = h / 2 + -8 + (float)(2 * (Math.random() - 0.5f));
m = (float)((40 - killind)/5.5f);
if (hitind > 0) { if (hitind > 0) {
preciseBlit(event.getGuiGraphics(), new ResourceLocation("target:textures/screens/hit_marker.png"), ww, hh, 0, 0, 16, 16, 16, 16); preciseBlit(event.getGuiGraphics(), new ResourceLocation("target:textures/screens/hit_marker.png"), ww, hh, 0, 0, 16, 16, 16, 16);
@ -98,13 +65,13 @@ public class CrosshairOverlay {
} }
if (killind > 0) { if (killind > 0) {
preciseBlit(event.getGuiGraphics(), new ResourceLocation("target:textures/screens/kill_mark1.png"), w / 2 + -7.5f -2 + m, h / 2 + -8 -2 + m, 0, 0, 16, 16, 16, 16); preciseBlit(event.getGuiGraphics(), new ResourceLocation("target:textures/screens/kill_mark1.png"), w / 2 + -7.5f - 2 + m, h / 2 + -8 - 2 + m, 0, 0, 16, 16, 16, 16);
preciseBlit(event.getGuiGraphics(), new ResourceLocation("target:textures/screens/kill_mark2.png"), w / 2 + -7.5f +2 - m, h / 2 + -8 -2 + m, 0, 0, 16, 16, 16, 16); preciseBlit(event.getGuiGraphics(), new ResourceLocation("target:textures/screens/kill_mark2.png"), w / 2 + -7.5f + 2 - m, h / 2 + -8 - 2 + m, 0, 0, 16, 16, 16, 16);
preciseBlit(event.getGuiGraphics(), new ResourceLocation("target:textures/screens/kill_mark3.png"), w / 2 + -7.5f -2 + m, h / 2 + -8 +2 - m, 0, 0, 16, 16, 16, 16); preciseBlit(event.getGuiGraphics(), new ResourceLocation("target:textures/screens/kill_mark3.png"), w / 2 + -7.5f - 2 + m, h / 2 + -8 + 2 - m, 0, 0, 16, 16, 16, 16);
preciseBlit(event.getGuiGraphics(), new ResourceLocation("target:textures/screens/kill_mark4.png"), w / 2 + -7.5f +2 - m, h / 2 + -8 +2 - m, 0, 0, 16, 16, 16, 16); preciseBlit(event.getGuiGraphics(), new ResourceLocation("target:textures/screens/kill_mark4.png"), w / 2 + -7.5f + 2 - m, h / 2 + -8 + 2 - m, 0, 0, 16, 16, 16, 16);
} }
RenderSystem.depthMask(true); RenderSystem.depthMask(true);
@ -114,10 +81,8 @@ public class CrosshairOverlay {
RenderSystem.setShaderColor(1, 1, 1, 1); RenderSystem.setShaderColor(1, 1, 1, 1);
} }
private static void preciseBlit(GuiGraphics gui,ResourceLocation pAtlasLocation, float pX, float pY, float pUOffset, float pVOffset, float pWidth, float pHeight, float pTextureWidth, float pTextureHeight) { private static void preciseBlit(GuiGraphics gui, ResourceLocation pAtlasLocation, float pX, float pY, float pUOffset, float pVOffset, float pWidth, float pHeight, float pTextureWidth, float pTextureHeight) {
float pX1 = pX;
float pX2 = pX + pWidth; float pX2 = pX + pWidth;
float pY1 = pY;
float pY2 = pY + pHeight; float pY2 = pY + pHeight;
float pBlitOffset = 0; float pBlitOffset = 0;
@ -131,10 +96,10 @@ public class CrosshairOverlay {
Matrix4f matrix4f = gui.pose().last().pose(); Matrix4f matrix4f = gui.pose().last().pose();
BufferBuilder bufferbuilder = Tesselator.getInstance().getBuilder(); BufferBuilder bufferbuilder = Tesselator.getInstance().getBuilder();
bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX);
bufferbuilder.vertex(matrix4f, pX1, pY1, pBlitOffset).uv(pMinU, pMinV).endVertex(); bufferbuilder.vertex(matrix4f, pX, pY, pBlitOffset).uv(pMinU, pMinV).endVertex();
bufferbuilder.vertex(matrix4f, pX1, pY2, pBlitOffset).uv(pMinU, pMaxV).endVertex(); bufferbuilder.vertex(matrix4f, pX, pY2, pBlitOffset).uv(pMinU, pMaxV).endVertex();
bufferbuilder.vertex(matrix4f, pX2, pY2, pBlitOffset).uv(pMaxU, pMaxV).endVertex(); bufferbuilder.vertex(matrix4f, pX2, pY2, pBlitOffset).uv(pMaxU, pMaxV).endVertex();
bufferbuilder.vertex(matrix4f, pX2, pY1, pBlitOffset).uv(pMaxU, pMinV).endVertex(); bufferbuilder.vertex(matrix4f, pX2, pY, pBlitOffset).uv(pMaxU, pMinV).endVertex();
BufferUploader.drawWithShader(bufferbuilder.end()); BufferUploader.drawWithShader(bufferbuilder.end());
} }
} }

View file

@ -1,24 +1,17 @@
package net.mcreator.target.client.screens; package net.mcreator.target.client.screens;
import org.checkerframework.checker.units.qual.h;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.client.event.RenderGuiEvent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraft.world.level.Level;
import net.minecraft.world.entity.player.Player;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.Minecraft;
import net.mcreator.target.procedures.M79uiXianShiYouXiNeiDieJiaCengProcedure;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.mcreator.target.procedures.M79uiXianShiYouXiNeiDieJiaCengProcedure;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.RenderGuiEvent;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
@Mod.EventBusSubscriber({Dist.CLIENT}) @Mod.EventBusSubscriber({Dist.CLIENT})
public class M79uiOverlay { public class M79uiOverlay {
@ -26,17 +19,7 @@ public class M79uiOverlay {
public static void eventHandler(RenderGuiEvent.Pre event) { public static void eventHandler(RenderGuiEvent.Pre event) {
int w = event.getWindow().getGuiScaledWidth(); int w = event.getWindow().getGuiScaledWidth();
int h = event.getWindow().getGuiScaledHeight(); int h = event.getWindow().getGuiScaledHeight();
Level world = null;
double x = 0;
double y = 0;
double z = 0;
Player entity = Minecraft.getInstance().player; Player entity = Minecraft.getInstance().player;
if (entity != null) {
world = entity.level();
x = entity.getX();
y = entity.getY();
z = entity.getZ();
}
RenderSystem.disableDepthTest(); RenderSystem.disableDepthTest();
RenderSystem.depthMask(false); RenderSystem.depthMask(false);
RenderSystem.enableBlend(); RenderSystem.enableBlend();
@ -45,7 +28,6 @@ public class M79uiOverlay {
RenderSystem.setShaderColor(1, 1, 1, 1); RenderSystem.setShaderColor(1, 1, 1, 1);
if (M79uiXianShiYouXiNeiDieJiaCengProcedure.execute(entity)) { if (M79uiXianShiYouXiNeiDieJiaCengProcedure.execute(entity)) {
event.getGuiGraphics().blit(new ResourceLocation("target:textures/screens/rex.png"), w / 2 + -16, h / 2 + -16, 0, 0, 32, 32, 32, 32); event.getGuiGraphics().blit(new ResourceLocation("target:textures/screens/rex.png"), w / 2 + -16, h / 2 + -16, 0, 0, 32, 32, 32, 32);
} }
RenderSystem.depthMask(true); RenderSystem.depthMask(true);
RenderSystem.defaultBlendFunc(); RenderSystem.defaultBlendFunc();

View file

@ -1,20 +1,14 @@
package net.mcreator.target.client.screens; package net.mcreator.target.client.screens;
import org.checkerframework.checker.units.qual.h;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.client.event.RenderGuiEvent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraft.world.level.Level;
import net.minecraft.world.entity.player.Player;
import net.minecraft.client.Minecraft;
import net.mcreator.target.procedures.SpyglassRangeXianShiYouXiNeiDieJiaCengProcedure;
import net.mcreator.target.procedures.EntityRangeProcedure; import net.mcreator.target.procedures.EntityRangeProcedure;
import net.mcreator.target.procedures.SpyglassRangeXianShiYouXiNeiDieJiaCengProcedure;
import net.minecraft.client.Minecraft;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.RenderGuiEvent;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
@Mod.EventBusSubscriber({Dist.CLIENT}) @Mod.EventBusSubscriber({Dist.CLIENT})
public class SpyglassRangeOverlay { public class SpyglassRangeOverlay {
@ -22,21 +16,16 @@ public class SpyglassRangeOverlay {
public static void eventHandler(RenderGuiEvent.Pre event) { public static void eventHandler(RenderGuiEvent.Pre event) {
int w = event.getWindow().getGuiScaledWidth(); int w = event.getWindow().getGuiScaledWidth();
int h = event.getWindow().getGuiScaledHeight(); int h = event.getWindow().getGuiScaledHeight();
Level world = null;
double x = 0;
double y = 0;
double z = 0;
Player entity = Minecraft.getInstance().player; Player entity = Minecraft.getInstance().player;
if (entity != null) {
world = entity.level();
x = entity.getX();
y = entity.getY();
z = entity.getZ();
}
if (SpyglassRangeXianShiYouXiNeiDieJiaCengProcedure.execute(entity)) { if (SpyglassRangeXianShiYouXiNeiDieJiaCengProcedure.execute(entity)) {
event.getGuiGraphics().drawString(Minecraft.getInstance().font, event.getGuiGraphics().drawString(
Minecraft.getInstance().font,
EntityRangeProcedure.execute(entity), w / 2 + 19, h / 2 + -23, -1, false); EntityRangeProcedure.execute(entity),
w / 2 + 19,
h / 2 + -23,
-1,
false
);
} }
} }
} }

View file

@ -1,36 +1,22 @@
package net.mcreator.target.command; package net.mcreator.target.command;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.event.RegisterCommandsEvent;
import net.minecraftforge.common.util.FakePlayerFactory;
import net.minecraft.world.level.Level;
import net.minecraft.world.entity.Entity;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.core.Direction;
import net.minecraft.commands.Commands;
import net.mcreator.target.procedures.HugeexpProcedure; import net.mcreator.target.procedures.HugeexpProcedure;
import net.minecraft.commands.Commands;
import net.minecraft.world.level.Level;
import net.minecraftforge.event.RegisterCommandsEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
@Mod.EventBusSubscriber @Mod.EventBusSubscriber
public class BigexpCommand { public class BigexpCommand {
@SubscribeEvent @SubscribeEvent
public static void registerCommand(RegisterCommandsEvent event) { public static void registerCommand(RegisterCommandsEvent event) {
event.getDispatcher().register(Commands.literal("target:bigexp") event.getDispatcher().register(Commands.literal("target:bigexp")
.executes(arguments -> { .executes(arguments -> {
Level world = arguments.getSource().getUnsidedLevel(); Level world = arguments.getSource().getUnsidedLevel();
double x = arguments.getSource().getPosition().x(); double x = arguments.getSource().getPosition().x();
double y = arguments.getSource().getPosition().y(); double y = arguments.getSource().getPosition().y();
double z = arguments.getSource().getPosition().z(); double z = arguments.getSource().getPosition().z();
Entity entity = arguments.getSource().getEntity();
if (entity == null && world instanceof ServerLevel _servLevel)
entity = FakePlayerFactory.getMinecraft(_servLevel);
Direction direction = Direction.DOWN;
if (entity != null)
direction = entity.getDirection();
HugeexpProcedure.execute(world, x, y, z); HugeexpProcedure.execute(world, x, y, z);
return 0; return 0;

View file

@ -1,36 +1,22 @@
package net.mcreator.target.command; package net.mcreator.target.command;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.event.RegisterCommandsEvent;
import net.minecraftforge.common.util.FakePlayerFactory;
import net.minecraft.world.level.Level;
import net.minecraft.world.entity.Entity;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.core.Direction;
import net.minecraft.commands.Commands;
import net.mcreator.target.procedures.MedexpProcedure; import net.mcreator.target.procedures.MedexpProcedure;
import net.minecraft.commands.Commands;
import net.minecraft.world.level.Level;
import net.minecraftforge.event.RegisterCommandsEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
@Mod.EventBusSubscriber @Mod.EventBusSubscriber
public class MediumexpCommand { public class MediumexpCommand {
@SubscribeEvent @SubscribeEvent
public static void registerCommand(RegisterCommandsEvent event) { public static void registerCommand(RegisterCommandsEvent event) {
event.getDispatcher().register(Commands.literal("target:mediumexp") event.getDispatcher().register(Commands.literal("target:mediumexp")
.executes(arguments -> { .executes(arguments -> {
Level world = arguments.getSource().getUnsidedLevel(); Level world = arguments.getSource().getUnsidedLevel();
double x = arguments.getSource().getPosition().x(); double x = arguments.getSource().getPosition().x();
double y = arguments.getSource().getPosition().y(); double y = arguments.getSource().getPosition().y();
double z = arguments.getSource().getPosition().z(); double z = arguments.getSource().getPosition().z();
Entity entity = arguments.getSource().getEntity();
if (entity == null && world instanceof ServerLevel _servLevel)
entity = FakePlayerFactory.getMinecraft(_servLevel);
Direction direction = Direction.DOWN;
if (entity != null)
direction = entity.getDirection();
MedexpProcedure.execute(world, x, y, z); MedexpProcedure.execute(world, x, y, z);
return 0; return 0;

View file

@ -1,38 +1,34 @@
package net.mcreator.target.entity; package net.mcreator.target.entity;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraft.commands.CommandSource;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.phys.*;
import net.mcreator.target.headshot.BoundingBoxManager; import net.mcreator.target.headshot.BoundingBoxManager;
import net.mcreator.target.headshot.IHeadshotBox; import net.mcreator.target.headshot.IHeadshotBox;
import net.mcreator.target.init.TargetModEntities; import net.mcreator.target.init.TargetModEntities;
import net.minecraftforge.network.PlayMessages;
import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.level.Level;
import net.minecraft.world.item.Items;
import net.minecraft.world.entity.projectile.ItemSupplier;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.ItemStack;
import net.minecraft.util.RandomSource;
import net.minecraft.sounds.SoundSource;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.protocol.Packet;
import net.mcreator.target.network.TargetModVariables; import net.mcreator.target.network.TargetModVariables;
import net.minecraft.commands.CommandSource;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundSource;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.entity.projectile.ItemSupplier;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.network.PlayMessages;
import net.minecraftforge.registries.ForgeRegistries;
import java.util.Optional; import java.util.Optional;
@ -87,16 +83,15 @@ public class BocekarrowEntity extends AbstractArrow implements ItemSupplier {
protected void onHitEntity(EntityHitResult result) { protected void onHitEntity(EntityHitResult result) {
final Vec3 position = this.position(); 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;
living.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { living.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
capability.hitind = _setval; capability.hitind = _setval;
capability.syncPlayerVariables(living); capability.syncPlayerVariables(living);
}); });
Entity _ent = living; if (!living.level().isClientSide() && living.getServer() != null) {
if (!_ent.level().isClientSide() && _ent.getServer() != null) { living.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, living.position(), living.getRotationVector(), living.level() instanceof ServerLevel ? (ServerLevel) living.level() : null, 4,
_ent.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, _ent.position(), _ent.getRotationVector(), _ent.level() instanceof ServerLevel ? (ServerLevel) _ent.level() : null, 4, living.getName().getString(), living.getDisplayName(), living.level().getServer(), living), "playsound target:indication voice @a ~ ~ ~ 1 1");
_ent.getName().getString(), _ent.getDisplayName(), _ent.level().getServer(), _ent), "playsound target:indication voice @a ~ ~ ~ 1 1");
} }
} }
if (entity instanceof LivingEntity livingEntity) { if (entity instanceof LivingEntity livingEntity) {
@ -108,38 +103,31 @@ public class BocekarrowEntity extends AbstractArrow implements ItemSupplier {
Vec3 hitPos = boundingBox.clip(startVec, endVec).orElse(null); Vec3 hitPos = boundingBox.clip(startVec, endVec).orElse(null);
/* Check for headshot */ /* Check for headshot */
boolean headshot = false; boolean headshot = false;
if(entity instanceof LivingEntity) if (entity instanceof LivingEntity) {
{
IHeadshotBox<LivingEntity> headshotBox = (IHeadshotBox<LivingEntity>) BoundingBoxManager.getHeadshotBoxes(entity.getType()); IHeadshotBox<LivingEntity> headshotBox = (IHeadshotBox<LivingEntity>) BoundingBoxManager.getHeadshotBoxes(entity.getType());
if(headshotBox != null) if (headshotBox != null) {
{
AABB box = headshotBox.getHeadshotBox((LivingEntity) entity); AABB box = headshotBox.getHeadshotBox((LivingEntity) entity);
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.isPresent()) {
{ 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);
} }
if(headshotHitPos.isPresent() && (hitPos == null || headshotHitPos.get().distanceTo(hitPos) < 0.55)) if (headshotHitPos.isPresent() && (hitPos == null || headshotHitPos.get().distanceTo(hitPos) < 0.55)) {
{
hitPos = headshotHitPos.get();
headshot = true; headshot = true;
} }
if(headshot){ if (headshot) {
if(this.getOwner() instanceof LivingEntity living){ if (this.getOwner() instanceof LivingEntity living) {
setBaseDamage(getBaseDamage() * 2); setBaseDamage(getBaseDamage() * 2);
double _setval = 25; double _setval = 25;
living.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { living.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
capability.headind = _setval; capability.headind = _setval;
capability.syncPlayerVariables(living); capability.syncPlayerVariables(living);
}); });
Entity _ent = living; if (!living.level().isClientSide() && living.getServer() != null) {
if (!_ent.level().isClientSide() && _ent.getServer() != null) { living.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, living.position(), living.getRotationVector(), living.level() instanceof ServerLevel ? (ServerLevel) living.level() : null, 4,
_ent.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, _ent.position(), _ent.getRotationVector(), _ent.level() instanceof ServerLevel ? (ServerLevel) _ent.level() : null, 4, living.getName().getString(), living.getDisplayName(), living.level().getServer(), living), "playsound target:headshot voice @a ~ ~ ~ 1 1");
_ent.getName().getString(), _ent.getDisplayName(), _ent.level().getServer(), _ent), "playsound target:headshot voice @a ~ ~ ~ 1 1");
} }
} }
} }
@ -153,7 +141,7 @@ public class BocekarrowEntity extends AbstractArrow implements ItemSupplier {
@Override @Override
public void tick() { public void tick() {
super.tick(); super.tick();
if(this.tickCount>200){ if (this.tickCount > 200) {
this.discard(); this.discard();
} }
} }

View file

@ -1,52 +1,39 @@
package net.mcreator.target.entity; package net.mcreator.target.entity;
import software.bernie.geckolib.util.GeckoLibUtil;
import software.bernie.geckolib.core.object.PlayState;
import software.bernie.geckolib.core.animation.RawAnimation;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.core.animation.AnimationController;
import software.bernie.geckolib.core.animation.AnimatableManager;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.animatable.GeoEntity;
import net.minecraftforge.network.PlayMessages;
import net.minecraftforge.network.NetworkHooks;
import net.minecraft.world.level.Level;
import net.minecraft.world.item.SpawnEggItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Item;
import net.minecraft.world.entity.projectile.ThrownPotion;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.TamableAnimal;
import net.minecraft.world.entity.Pose;
import net.minecraft.world.entity.MobType;
import net.minecraft.world.entity.MobSpawnType;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.EntityDimensions;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.AreaEffectCloud;
import net.minecraft.world.entity.AgeableMob;
import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.InteractionHand;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.protocol.Packet;
import net.minecraft.nbt.CompoundTag;
import net.mcreator.target.procedures.ClaymoreYouJiShiTiShiProcedure;
import net.mcreator.target.procedures.ClaymoreDangShiTiSiWangShiProcedure;
import net.mcreator.target.procedures.ClaymoreDangShiTiGengXinKeShiProcedure;
import net.mcreator.target.init.TargetModEntities; import net.mcreator.target.init.TargetModEntities;
import net.mcreator.target.procedures.ClaymoreDangShiTiGengXinKeShiProcedure;
import net.mcreator.target.procedures.ClaymoreDangShiTiSiWangShiProcedure;
import net.mcreator.target.procedures.ClaymoreYouJiShiTiShiProcedure;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.entity.*;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.projectile.ThrownPotion;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.SpawnEggItem;
import net.minecraft.world.level.Level;
import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.network.PlayMessages;
import software.bernie.geckolib.animatable.GeoEntity;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.core.animation.AnimatableManager;
import software.bernie.geckolib.core.animation.AnimationController;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.core.animation.RawAnimation;
import software.bernie.geckolib.core.object.PlayState;
import software.bernie.geckolib.util.GeckoLibUtil;
import java.util.List; import java.util.List;
@ -192,11 +179,7 @@ public class ClaymoreEntity extends TamableAnimal implements GeoEntity {
this.setPersistenceRequired(); this.setPersistenceRequired();
} }
} }
double x = this.getX();
double y = this.getY();
double z = this.getZ();
Entity entity = this; Entity entity = this;
Level world = this.level();
ClaymoreYouJiShiTiShiProcedure.execute(entity, sourceentity); ClaymoreYouJiShiTiShiProcedure.execute(entity, sourceentity);
return retval; return retval;
@ -223,7 +206,7 @@ public class ClaymoreEntity extends TamableAnimal implements GeoEntity {
@Override @Override
public boolean isFood(ItemStack stack) { public boolean isFood(ItemStack stack) {
return List.of().contains(stack.getItem()); return false;
} }
@Override @Override

View file

@ -1,36 +1,34 @@
package net.mcreator.target.entity; package net.mcreator.target.entity;
import net.minecraft.commands.CommandSource;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.block.*;
import net.minecraft.world.phys.*;
import net.mcreator.target.headshot.BoundingBoxManager; import net.mcreator.target.headshot.BoundingBoxManager;
import net.mcreator.target.headshot.IHeadshotBox; import net.mcreator.target.headshot.IHeadshotBox;
import net.mcreator.target.init.TargetModEntities; import net.mcreator.target.init.TargetModEntities;
import net.minecraftforge.network.PlayMessages;
import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraft.world.level.Level;
import net.minecraft.world.entity.projectile.ItemSupplier;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.ItemStack;
import net.minecraft.util.RandomSource;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.protocol.Packet;
import net.mcreator.target.procedures.GunGrenadeDanSheWuJiZhongShiTiShiProcedure;
import net.mcreator.target.procedures.GunGrenadeDanSheWuJiZhongFangKuaiShiProcedure;
import net.mcreator.target.procedures.GunGrenadeDanSheWuFeiXingShiMeiKeFaShengProcedure;
import net.mcreator.target.network.TargetModVariables; import net.mcreator.target.network.TargetModVariables;
import net.mcreator.target.procedures.GunGrenadeDanSheWuFeiXingShiMeiKeFaShengProcedure;
import net.mcreator.target.procedures.GunGrenadeDanSheWuJiZhongFangKuaiShiProcedure;
import net.mcreator.target.procedures.GunGrenadeDanSheWuJiZhongShiTiShiProcedure;
import net.minecraft.commands.CommandSource;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.entity.projectile.ItemSupplier;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.network.PlayMessages;
import java.util.Optional; import java.util.Optional;
@ -80,20 +78,19 @@ public class GunGrenadeEntity extends AbstractArrow implements ItemSupplier {
protected void onHitEntity(EntityHitResult result) { protected void onHitEntity(EntityHitResult result) {
final Vec3 position = this.position(); 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;
living.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { living.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
capability.hitind = _setval; capability.hitind = _setval;
capability.syncPlayerVariables(living); capability.syncPlayerVariables(living);
}); });
Entity _ent = living; if (!living.level().isClientSide() && living.getServer() != null) {
if (!_ent.level().isClientSide() && _ent.getServer() != null) { living.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, living.position(), living.getRotationVector(), living.level() instanceof ServerLevel ? (ServerLevel) living.level() : null, 4,
_ent.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, _ent.position(), _ent.getRotationVector(), _ent.level() instanceof ServerLevel ? (ServerLevel) _ent.level() : null, 4, living.getName().getString(), living.getDisplayName(), living.level().getServer(), living), "playsound target:indication voice @a ~ ~ ~ 1 1");
_ent.getName().getString(), _ent.getDisplayName(), _ent.level().getServer(), _ent), "playsound target:indication voice @a ~ ~ ~ 1 1");
} }
} }
GunGrenadeDanSheWuJiZhongShiTiShiProcedure.execute(this.level(), this); GunGrenadeDanSheWuJiZhongShiTiShiProcedure.execute(this.level(), this);
if (entity instanceof LivingEntity livingEntity) { if (entity instanceof LivingEntity) {
entity.invulnerableTime = 0; entity.invulnerableTime = 0;
} }
AABB boundingBox = entity.getBoundingBox(); AABB boundingBox = entity.getBoundingBox();
@ -102,38 +99,31 @@ public class GunGrenadeEntity extends AbstractArrow implements ItemSupplier {
Vec3 hitPos = boundingBox.clip(startVec, endVec).orElse(null); Vec3 hitPos = boundingBox.clip(startVec, endVec).orElse(null);
/* Check for headshot */ /* Check for headshot */
boolean headshot = false; boolean headshot = false;
if(entity instanceof LivingEntity) if (entity instanceof LivingEntity) {
{
IHeadshotBox<LivingEntity> headshotBox = (IHeadshotBox<LivingEntity>) BoundingBoxManager.getHeadshotBoxes(entity.getType()); IHeadshotBox<LivingEntity> headshotBox = (IHeadshotBox<LivingEntity>) BoundingBoxManager.getHeadshotBoxes(entity.getType());
if(headshotBox != null) if (headshotBox != null) {
{
AABB box = headshotBox.getHeadshotBox((LivingEntity) entity); AABB box = headshotBox.getHeadshotBox((LivingEntity) entity);
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.isPresent()) {
{ 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);
} }
if(headshotHitPos.isPresent() && (hitPos == null || headshotHitPos.get().distanceTo(hitPos) < 0.55)) if (headshotHitPos.isPresent() && (hitPos == null || headshotHitPos.get().distanceTo(hitPos) < 0.55)) {
{
hitPos = headshotHitPos.get();
headshot = true; headshot = true;
} }
if(headshot){ if (headshot) {
if(this.getOwner() instanceof LivingEntity living){ if (this.getOwner() instanceof LivingEntity living) {
setBaseDamage(getBaseDamage() * 2); setBaseDamage(getBaseDamage() * 2);
double _setval = 25; double _setval = 25;
living.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { living.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
capability.headind = _setval; capability.headind = _setval;
capability.syncPlayerVariables(living); capability.syncPlayerVariables(living);
}); });
Entity _ent = living; if (!living.level().isClientSide() && living.getServer() != null) {
if (!_ent.level().isClientSide() && _ent.getServer() != null) { living.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, living.position(), living.getRotationVector(), living.level() instanceof ServerLevel ? (ServerLevel) living.level() : null, 4,
_ent.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, _ent.position(), _ent.getRotationVector(), _ent.level() instanceof ServerLevel ? (ServerLevel) _ent.level() : null, 4, living.getName().getString(), living.getDisplayName(), living.level().getServer(), living), "playsound target:headshot voice @a ~ ~ ~ 1 1");
_ent.getName().getString(), _ent.getDisplayName(), _ent.level().getServer(), _ent), "playsound target:headshot voice @a ~ ~ ~ 1 1");
} }
} }
} }
@ -154,7 +144,7 @@ public class GunGrenadeEntity extends AbstractArrow implements ItemSupplier {
public void tick() { public void tick() {
super.tick(); super.tick();
GunGrenadeDanSheWuFeiXingShiMeiKeFaShengProcedure.execute(this); GunGrenadeDanSheWuFeiXingShiMeiKeFaShengProcedure.execute(this);
if(this.tickCount>200){ if (this.tickCount > 200) {
this.discard(); this.discard();
} }
} }

View file

@ -1,54 +1,41 @@
package net.mcreator.target.entity; package net.mcreator.target.entity;
import software.bernie.geckolib.util.GeckoLibUtil;
import software.bernie.geckolib.core.object.PlayState;
import software.bernie.geckolib.core.animation.RawAnimation;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.core.animation.AnimationController;
import software.bernie.geckolib.core.animation.AnimatableManager;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.animatable.GeoEntity;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.network.PlayMessages;
import net.minecraftforge.network.NetworkHooks;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.Level;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.entity.projectile.ThrownPotion;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.SpawnGroupData;
import net.minecraft.world.entity.Pose;
import net.minecraft.world.entity.PathfinderMob;
import net.minecraft.world.entity.MobType;
import net.minecraft.world.entity.MobSpawnType;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.EntityDimensions;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.AreaEffectCloud;
import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.protocol.Packet;
import net.minecraft.nbt.CompoundTag;
import net.mcreator.target.procedures.MortarYouJiShiTiShiProcedure;
import net.mcreator.target.procedures.MortarShiTiChuShiShengChengShiProcedure;
import net.mcreator.target.procedures.MortarDangXiaoShiShiJianDaoShiProcedure;
import net.mcreator.target.init.TargetModEntities; import net.mcreator.target.init.TargetModEntities;
import net.mcreator.target.procedures.MortarDangXiaoShiShiJianDaoShiProcedure;
import net.mcreator.target.procedures.MortarShiTiChuShiShengChengShiProcedure;
import net.mcreator.target.procedures.MortarYouJiShiTiShiProcedure;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.entity.*;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.projectile.ThrownPotion;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.network.PlayMessages;
import net.minecraftforge.registries.ForgeRegistries;
import software.bernie.geckolib.animatable.GeoEntity;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.core.animation.AnimatableManager;
import software.bernie.geckolib.core.animation.AnimationController;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.core.animation.RawAnimation;
import software.bernie.geckolib.core.object.PlayState;
import software.bernie.geckolib.util.GeckoLibUtil;
import javax.annotation.Nullable; import javax.annotation.Nullable;

View file

@ -1,30 +1,27 @@
package net.mcreator.target.entity; package net.mcreator.target.entity;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.network.PlayMessages;
import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.Level;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.entity.projectile.ItemSupplier;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.util.RandomSource;
import net.minecraft.sounds.SoundSource;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.protocol.Packet;
import net.mcreator.target.procedures.MortarShellDanSheWuJiZhongShiTiShiProcedure;
import net.mcreator.target.procedures.MortarShellDanSheWuFeiXingShiMeiKeFaShengProcedure;
import net.mcreator.target.init.TargetModEntities; import net.mcreator.target.init.TargetModEntities;
import net.mcreator.target.procedures.MortarShellDanSheWuFeiXingShiMeiKeFaShengProcedure;
import net.mcreator.target.procedures.MortarShellDanSheWuJiZhongShiTiShiProcedure;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundSource;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.entity.projectile.ItemSupplier;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.network.PlayMessages;
import net.minecraftforge.registries.ForgeRegistries;
@OnlyIn(value = Dist.CLIENT, _interface = ItemSupplier.class) @OnlyIn(value = Dist.CLIENT, _interface = ItemSupplier.class)
public class MortarShellEntity extends AbstractArrow implements ItemSupplier { public class MortarShellEntity extends AbstractArrow implements ItemSupplier {

View file

@ -1,45 +1,36 @@
package net.mcreator.target.entity; package net.mcreator.target.entity;
import net.minecraft.advancements.CriteriaTriggers;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.stats.Stats;
import net.minecraft.util.Mth;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.level.ClipContext;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.level.Level;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
import net.minecraft.world.item.Item;
import net.minecraft.world.phys.*;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.CommandSource;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Player;
import net.mcreator.target.headshot.BoundingBoxManager; import net.mcreator.target.headshot.BoundingBoxManager;
import net.mcreator.target.headshot.IHeadshotBox; import net.mcreator.target.headshot.IHeadshotBox;
import net.mcreator.target.init.TargetCustomModEntities; import net.mcreator.target.init.TargetCustomModEntities;
import net.mcreator.target.init.TargetModItems; import net.mcreator.target.init.TargetModItems;
import net.mcreator.target.procedures.ProjectileHitEntity;
import net.mcreator.target.procedures.ProjectileHeadshotEntity; import net.mcreator.target.procedures.ProjectileHeadshotEntity;
import net.minecraft.world.phys.shapes.VoxelShape; import net.mcreator.target.procedures.ProjectileHitEntity;
import net.minecraftforge.common.MinecraftForge;
import net.mcreator.target.util.math.ExtendedEntityRayTraceResult; import net.mcreator.target.util.math.ExtendedEntityRayTraceResult;
import net.minecraft.commands.CommandSource;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.ClipContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.LeavesBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.phys.*;
import net.minecraft.world.phys.shapes.VoxelShape;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.function.BiFunction; import java.util.function.BiFunction;
@ -73,25 +64,27 @@ public class ProjectileEntity extends ThrowableItemProjectile {
super(TargetCustomModEntities.PROJECTILE.get(), p_i1775_2_, p_i1775_4_, p_i1775_6_, p_i1775_1_); super(TargetCustomModEntities.PROJECTILE.get(), p_i1775_2_, p_i1775_4_, p_i1775_6_, p_i1775_1_);
} }
@Override
protected void onHitEntity(EntityHitResult result) {
super.onHitEntity(result);
}
@Nullable @Nullable
protected EntityResult findEntityOnPath(Vec3 startVec, Vec3 endVec) protected EntityResult findEntityOnPath(Vec3 startVec, Vec3 endVec) {
{
Vec3 hitVec = null; Vec3 hitVec = null;
Entity hitEntity = null; Entity hitEntity = null;
boolean headshot = false; boolean headshot = false;
List<Entity> entities = this.level().getEntities(this, this.getBoundingBox().expandTowards(this.getDeltaMovement()).inflate(1.0), PROJECTILE_TARGETS); List<Entity> entities = this.level().getEntities(this, this.getBoundingBox().expandTowards(this.getDeltaMovement()).inflate(1.0), PROJECTILE_TARGETS);
double closestDistance = Double.MAX_VALUE; double closestDistance = Double.MAX_VALUE;
for(Entity entity : entities) for (Entity entity : entities) {
{ if (!entity.equals(this.shooter)) {
if(!entity.equals(this.shooter))
{
EntityResult result = this.getHitResult(entity, startVec, endVec); EntityResult result = this.getHitResult(entity, startVec, endVec);
if(result == null) if (result == null)
continue; continue;
Vec3 hitPos = result.getHitPos(); Vec3 hitPos = result.getHitPos();
double distanceToHit = startVec.distanceTo(hitPos); double distanceToHit = startVec.distanceTo(hitPos);
if(distanceToHit < closestDistance) if (distanceToHit < closestDistance) {
{
hitVec = hitPos; hitVec = hitPos;
hitEntity = entity; hitEntity = entity;
closestDistance = distanceToHit; closestDistance = distanceToHit;
@ -103,16 +96,13 @@ public class ProjectileEntity extends ThrowableItemProjectile {
} }
@Nullable @Nullable
protected List<EntityResult> findEntitiesOnPath(Vec3 startVec, Vec3 endVec) protected List<EntityResult> findEntitiesOnPath(Vec3 startVec, Vec3 endVec) {
{
List<EntityResult> hitEntities = new ArrayList<>(); List<EntityResult> hitEntities = new ArrayList<>();
List<Entity> entities = this.level().getEntities(this, this.getBoundingBox().expandTowards(this.getDeltaMovement()).inflate(1.0), PROJECTILE_TARGETS); List<Entity> entities = this.level().getEntities(this, this.getBoundingBox().expandTowards(this.getDeltaMovement()).inflate(1.0), PROJECTILE_TARGETS);
for(Entity entity : entities) for (Entity entity : entities) {
{ if (!entity.equals(this.shooter)) {
if(!entity.equals(this.shooter))
{
EntityResult result = this.getHitResult(entity, startVec, endVec); EntityResult result = this.getHitResult(entity, startVec, endVec);
if(result == null) if (result == null)
continue; continue;
hitEntities.add(result); hitEntities.add(result);
} }
@ -122,12 +112,12 @@ public class ProjectileEntity extends ThrowableItemProjectile {
@Nullable @Nullable
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private EntityResult getHitResult(Entity entity, Vec3 startVec, Vec3 endVec) private EntityResult getHitResult(Entity entity, Vec3 startVec, Vec3 endVec) {
{
double expandHeight = entity instanceof Player && !entity.isCrouching() ? 0.0625 : 0.0; double expandHeight = entity instanceof Player && !entity.isCrouching() ? 0.0625 : 0.0;
AABB boundingBox = entity.getBoundingBox(); AABB boundingBox = entity.getBoundingBox();
if(entity instanceof ServerPlayer && this.shooter != null)
{ // 延迟补偿
if (entity instanceof ServerPlayer && this.shooter != null) {
int ping = (int) Math.floor((((ServerPlayer) this.shooter).latency / 1000.0) * 20.0 + 3.5); int ping = (int) Math.floor((((ServerPlayer) this.shooter).latency / 1000.0) * 20.0 + 3.5);
boundingBox = BoundingBoxManager.getBoundingBox((Player) entity, ping); boundingBox = BoundingBoxManager.getBoundingBox((Player) entity, ping);
} }
@ -135,11 +125,9 @@ public class ProjectileEntity extends ThrowableItemProjectile {
Vec3 hitPos = boundingBox.clip(startVec, endVec).orElse(null); Vec3 hitPos = boundingBox.clip(startVec, endVec).orElse(null);
Vec3 grownHitPos = boundingBox.inflate(0.2, 0, 0.2).clip(startVec, endVec).orElse(null); Vec3 grownHitPos = boundingBox.inflate(0.2, 0, 0.2).clip(startVec, endVec).orElse(null);
if(hitPos == null && grownHitPos != null) if (hitPos == null && grownHitPos != null) {
{ HitResult result = rayTraceBlocks(this.level(), new ClipContext(startVec, grownHitPos, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this), IGNORE_LEAVES);
HitResult raytraceresult = rayTraceBlocks(this.level(), new ClipContext(startVec, grownHitPos, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this), IGNORE_LEAVES); if (result.getType() == HitResult.Type.BLOCK) {
if(raytraceresult.getType() == HitResult.Type.BLOCK)
{
return null; return null;
} }
hitPos = grownHitPos; hitPos = grownHitPos;
@ -147,23 +135,18 @@ public class ProjectileEntity extends ThrowableItemProjectile {
/* Check for headshot */ /* Check for headshot */
boolean headshot = false; boolean headshot = false;
if(entity instanceof LivingEntity) if (entity instanceof LivingEntity) {
{
IHeadshotBox<LivingEntity> headshotBox = (IHeadshotBox<LivingEntity>) BoundingBoxManager.getHeadshotBoxes(entity.getType()); IHeadshotBox<LivingEntity> headshotBox = (IHeadshotBox<LivingEntity>) BoundingBoxManager.getHeadshotBoxes(entity.getType());
if(headshotBox != null) if (headshotBox != null) {
{
AABB box = headshotBox.getHeadshotBox((LivingEntity) entity); AABB box = headshotBox.getHeadshotBox((LivingEntity) entity);
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.isPresent()) {
{
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);
} }
if(headshotHitPos.isPresent() && (hitPos == null || headshotHitPos.get().distanceTo(hitPos) < 0.55)) if (headshotHitPos.isPresent() && (hitPos == null || headshotHitPos.get().distanceTo(hitPos) < 0.55)) {
{
hitPos = headshotHitPos.get(); hitPos = headshotHitPos.get();
headshot = true; headshot = true;
} }
@ -171,8 +154,7 @@ public class ProjectileEntity extends ThrowableItemProjectile {
} }
} }
if(hitPos == null) if (hitPos == null) {
{
return null; return null;
} }
@ -180,70 +162,42 @@ public class ProjectileEntity extends ThrowableItemProjectile {
} }
@Override @Override
public void tick() public void tick() {
{
super.tick(); super.tick();
this.updateHeading(); this.updateHeading();
this.onProjectileTick(); this.onProjectileTick();
if(!this.level().isClientSide()) if (!this.level().isClientSide()) {
{
Vec3 startVec = this.position(); Vec3 startVec = this.position();
Vec3 endVec = startVec.add(this.getDeltaMovement()); Vec3 endVec = startVec.add(this.getDeltaMovement());
HitResult result = rayTraceBlocks(this.level(), new ClipContext(startVec, endVec, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this), IGNORE_LEAVES); HitResult result = rayTraceBlocks(this.level(), new ClipContext(startVec, endVec, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this), IGNORE_LEAVES);
if(result.getType() != HitResult.Type.MISS) if (result.getType() != HitResult.Type.MISS) {
{
endVec = result.getLocation(); endVec = result.getLocation();
} }
List<EntityResult> hitEntities = null;
int level = 0;
if(level == 0)
{
EntityResult entityResult = this.findEntityOnPath(startVec, endVec); EntityResult entityResult = this.findEntityOnPath(startVec, endVec);
if(entityResult != null)
{
hitEntities = Collections.singletonList(entityResult);
}
}
else
{
hitEntities = this.findEntitiesOnPath(startVec, endVec);
}
if(hitEntities != null && hitEntities.size() > 0) if (entityResult != null) {
{
for(EntityResult entityResult : hitEntities)
{
result = new ExtendedEntityRayTraceResult(entityResult); result = new ExtendedEntityRayTraceResult(entityResult);
if(((EntityHitResult) result).getEntity() instanceof Player) if (((EntityHitResult) result).getEntity() instanceof Player player) {
{ if (this.shooter instanceof Player && !((Player) this.shooter).canHarmPlayer(player)) {
Player player = (Player) ((EntityHitResult) result).getEntity();
if(this.shooter instanceof Player && !((Player) this.shooter).canHarmPlayer(player))
{
result = null; result = null;
} }
} }
if(result != null) if (result != null) {
{
this.onHit(result, startVec, endVec); this.onHit(result, startVec, endVec);
} }
} } else {
}
else
{
this.onHit(result, startVec, endVec); this.onHit(result, startVec, endVec);
} }
} }
if(this.tickCount>200){ if (this.tickCount > 200) {
this.discard(); this.discard();
} }
} }
protected void onProjectileTick() protected void onProjectileTick() {
{
} }
@Override @Override
@ -264,38 +218,27 @@ public class ProjectileEntity extends ThrowableItemProjectile {
this.discard(); this.discard();
} }
private void onHit(HitResult result, Vec3 startVec, Vec3 endVec) private void onHit(HitResult result, Vec3 startVec, Vec3 endVec) {
{ if (result instanceof ExtendedEntityRayTraceResult entityHitResult) {
if(result instanceof ExtendedEntityRayTraceResult entityHitResult)
{
Entity entity = entityHitResult.getEntity(); Entity entity = entityHitResult.getEntity();
if(entity.getId() == this.shooterId) if (entity.getId() == this.shooterId) {
{
return; return;
} }
if(this.shooter instanceof Player player) if (this.shooter instanceof Player player) {
{ if (entity.hasIndirectPassenger(player)) {
if(entity.hasIndirectPassenger(player))
{
return; return;
} }
} }
this.onHitEntity(entity, result.getLocation(), startVec, endVec, entityHitResult.isHeadshot()); this.onHitEntity(entity, result.getLocation(), startVec, endVec, entityHitResult.isHeadshot());
entity.invulnerableTime = 0; entity.invulnerableTime = 0;
} }
} }
protected void onHitEntity(Entity entity, Vec3 hitVec, Vec3 startVec, Vec3 endVec, boolean headshot) protected void onHitEntity(Entity entity, Vec3 hitVec, Vec3 startVec, Vec3 endVec, boolean headshot) {
{ if (headshot) {
if(headshot){
ProjectileHeadshotEntity.execute(this.level(), entity, this, this.shooter); ProjectileHeadshotEntity.execute(this.level(), entity, this, this.shooter);
} }
ProjectileHitEntity.execute(this.level(), entity, this, this.shooter); ProjectileHitEntity.execute(this.level(), entity, this, this.shooter);
} }
@ -313,11 +256,10 @@ public class ProjectileEntity extends ThrowableItemProjectile {
return this.damage; return this.damage;
} }
private static BlockHitResult rayTraceBlocks(Level world, ClipContext context, Predicate<BlockState> ignorePredicate) private static BlockHitResult rayTraceBlocks(Level world, ClipContext context, Predicate<BlockState> ignorePredicate) {
{
return performRayTrace(context, (rayTraceContext, blockPos) -> { return performRayTrace(context, (rayTraceContext, blockPos) -> {
BlockState blockState = world.getBlockState(blockPos); BlockState blockState = world.getBlockState(blockPos);
if(ignorePredicate.test(blockState)) return null; if (ignorePredicate.test(blockState)) return null;
FluidState fluidState = world.getFluidState(blockPos); FluidState fluidState = world.getFluidState(blockPos);
Vec3 startVec = rayTraceContext.getFrom(); Vec3 startVec = rayTraceContext.getFrom();
Vec3 endVec = rayTraceContext.getTo(); Vec3 endVec = rayTraceContext.getTo();
@ -334,16 +276,12 @@ public class ProjectileEntity extends ThrowableItemProjectile {
}); });
} }
private static <T> T performRayTrace(ClipContext context, BiFunction<ClipContext, BlockPos, T> hitFunction, Function<ClipContext, T> p_217300_2_) private static <T> T performRayTrace(ClipContext context, BiFunction<ClipContext, BlockPos, T> hitFunction, Function<ClipContext, T> p_217300_2_) {
{
Vec3 startVec = context.getFrom(); Vec3 startVec = context.getFrom();
Vec3 endVec = context.getTo(); Vec3 endVec = context.getTo();
if(startVec.equals(endVec)) if (startVec.equals(endVec)) {
{
return p_217300_2_.apply(context); return p_217300_2_.apply(context);
} } else {
else
{
double startX = Mth.lerp(-0.0000001, endVec.x, startVec.x); double startX = Mth.lerp(-0.0000001, endVec.x, startVec.x);
double startY = Mth.lerp(-0.0000001, endVec.y, startVec.y); double startY = Mth.lerp(-0.0000001, endVec.y, startVec.y);
double startZ = Mth.lerp(-0.0000001, endVec.z, startVec.z); double startZ = Mth.lerp(-0.0000001, endVec.z, startVec.z);
@ -355,8 +293,7 @@ public class ProjectileEntity extends ThrowableItemProjectile {
int blockZ = Mth.floor(endZ); int blockZ = Mth.floor(endZ);
BlockPos.MutableBlockPos mutablePos = new BlockPos.MutableBlockPos(blockX, blockY, blockZ); BlockPos.MutableBlockPos mutablePos = new BlockPos.MutableBlockPos(blockX, blockY, blockZ);
T t = hitFunction.apply(context, mutablePos); T t = hitFunction.apply(context, mutablePos);
if(t != null) if (t != null) {
{
return t; return t;
} }
@ -373,35 +310,25 @@ public class ProjectileEntity extends ThrowableItemProjectile {
double d13 = d10 * (signY > 0 ? 1.0D - Mth.frac(endY) : Mth.frac(endY)); double d13 = d10 * (signY > 0 ? 1.0D - Mth.frac(endY) : Mth.frac(endY));
double d14 = d11 * (signZ > 0 ? 1.0D - Mth.frac(endZ) : Mth.frac(endZ)); double d14 = d11 * (signZ > 0 ? 1.0D - Mth.frac(endZ) : Mth.frac(endZ));
while(d12 <= 1.0D || d13 <= 1.0D || d14 <= 1.0D) while (d12 <= 1.0D || d13 <= 1.0D || d14 <= 1.0D) {
{ if (d12 < d13) {
if(d12 < d13) if (d12 < d14) {
{
if(d12 < d14)
{
blockX += signX; blockX += signX;
d12 += d9; d12 += d9;
} } else {
else
{
blockZ += signZ; blockZ += signZ;
d14 += d11; d14 += d11;
} }
} } else if (d13 < d14) {
else if(d13 < d14)
{
blockY += signY; blockY += signY;
d13 += d10; d13 += d10;
} } else {
else
{
blockZ += signZ; blockZ += signZ;
d14 += d11; d14 += d11;
} }
T t1 = hitFunction.apply(context, mutablePos.set(blockX, blockY, blockZ)); T t1 = hitFunction.apply(context, mutablePos.set(blockX, blockY, blockZ));
if(t1 != null) if (t1 != null) {
{
return t1; return t1;
} }
} }
@ -410,17 +337,15 @@ public class ProjectileEntity extends ThrowableItemProjectile {
} }
} }
public LivingEntity getShooter() public LivingEntity getShooter() {
{
return this.shooter; return this.shooter;
} }
public int getShooterId()
{ public int getShooterId() {
return this.shooterId; return this.shooterId;
} }
public void updateHeading() public void updateHeading() {
{
double horizontalDistance = this.getDeltaMovement().horizontalDistance(); double horizontalDistance = this.getDeltaMovement().horizontalDistance();
this.setYRot((float) (Mth.atan2(this.getDeltaMovement().x(), this.getDeltaMovement().z()) * (180D / Math.PI))); this.setYRot((float) (Mth.atan2(this.getDeltaMovement().x(), this.getDeltaMovement().z()) * (180D / Math.PI)));
this.setXRot((float) (Mth.atan2(this.getDeltaMovement().y(), horizontalDistance) * (180D / Math.PI))); this.setXRot((float) (Mth.atan2(this.getDeltaMovement().y(), horizontalDistance) * (180D / Math.PI)));
@ -428,14 +353,12 @@ public class ProjectileEntity extends ThrowableItemProjectile {
this.xRotO = this.getXRot(); this.xRotO = this.getXRot();
} }
public static class EntityResult public static class EntityResult {
{ private final Entity entity;
private Entity entity; private final Vec3 hitVec;
private Vec3 hitVec; private final boolean headshot;
private boolean headshot;
public EntityResult(Entity entity, Vec3 hitVec, boolean headshot) public EntityResult(Entity entity, Vec3 hitVec, boolean headshot) {
{
this.entity = entity; this.entity = entity;
this.hitVec = hitVec; this.hitVec = hitVec;
this.headshot = headshot; this.headshot = headshot;
@ -444,24 +367,21 @@ public class ProjectileEntity extends ThrowableItemProjectile {
/** /**
* Gets the entity that was hit by the projectile * Gets the entity that was hit by the projectile
*/ */
public Entity getEntity() public Entity getEntity() {
{
return this.entity; return this.entity;
} }
/** /**
* Gets the position the projectile hit * Gets the position the projectile hit
*/ */
public Vec3 getHitPos() public Vec3 getHitPos() {
{
return this.hitVec; return this.hitVec;
} }
/** /**
* Gets if this was a headshot * Gets if this was a headshot
*/ */
public boolean isHeadshot() public boolean isHeadshot() {
{
return this.headshot; return this.headshot;
} }
} }

View file

@ -1,36 +1,34 @@
package net.mcreator.target.entity; package net.mcreator.target.entity;
import net.minecraft.commands.CommandSource;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.block.*;
import net.minecraft.world.phys.*;
import net.mcreator.target.headshot.BoundingBoxManager; import net.mcreator.target.headshot.BoundingBoxManager;
import net.mcreator.target.headshot.IHeadshotBox; import net.mcreator.target.headshot.IHeadshotBox;
import net.mcreator.target.init.TargetModEntities; import net.mcreator.target.init.TargetModEntities;
import net.minecraftforge.network.PlayMessages;
import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraft.world.level.Level;
import net.minecraft.world.entity.projectile.ItemSupplier;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.ItemStack;
import net.minecraft.util.RandomSource;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.protocol.Packet;
import net.mcreator.target.procedures.RpgRocketDanSheWuJiZhongFangKuaiShiProcedure;
import net.mcreator.target.procedures.RpgRocketDanSheWuFeiXingShiMeiKeFaShengProcedure;
import net.mcreator.target.procedures.RocketHitProcedure;
import net.mcreator.target.network.TargetModVariables; import net.mcreator.target.network.TargetModVariables;
import net.mcreator.target.procedures.RocketHitProcedure;
import net.mcreator.target.procedures.RpgRocketDanSheWuFeiXingShiMeiKeFaShengProcedure;
import net.mcreator.target.procedures.RpgRocketDanSheWuJiZhongFangKuaiShiProcedure;
import net.minecraft.commands.CommandSource;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.entity.projectile.ItemSupplier;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.network.PlayMessages;
import java.util.Optional; import java.util.Optional;
@ -80,20 +78,19 @@ public class RpgRocketEntity extends AbstractArrow implements ItemSupplier {
protected void onHitEntity(EntityHitResult result) { protected void onHitEntity(EntityHitResult result) {
final Vec3 position = this.position(); 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;
living.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { living.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
capability.hitind = _setval; capability.hitind = _setval;
capability.syncPlayerVariables(living); capability.syncPlayerVariables(living);
}); });
Entity _ent = living; if (!living.level().isClientSide() && living.getServer() != null) {
if (!_ent.level().isClientSide() && _ent.getServer() != null) { living.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, living.position(), living.getRotationVector(), living.level() instanceof ServerLevel ? (ServerLevel) living.level() : null, 4,
_ent.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, _ent.position(), _ent.getRotationVector(), _ent.level() instanceof ServerLevel ? (ServerLevel) _ent.level() : null, 4, living.getName().getString(), living.getDisplayName(), living.level().getServer(), living), "playsound target:indication voice @a ~ ~ ~ 1 1");
_ent.getName().getString(), _ent.getDisplayName(), _ent.level().getServer(), _ent), "playsound target:indication voice @a ~ ~ ~ 1 1");
} }
} }
RocketHitProcedure.execute(this.level(), this); RocketHitProcedure.execute(this.level(), this);
if (entity instanceof LivingEntity livingEntity) { if (entity instanceof LivingEntity) {
entity.invulnerableTime = 0; entity.invulnerableTime = 0;
} }
AABB boundingBox = entity.getBoundingBox(); AABB boundingBox = entity.getBoundingBox();
@ -102,38 +99,31 @@ public class RpgRocketEntity extends AbstractArrow implements ItemSupplier {
Vec3 hitPos = boundingBox.clip(startVec, endVec).orElse(null); Vec3 hitPos = boundingBox.clip(startVec, endVec).orElse(null);
/* Check for headshot */ /* Check for headshot */
boolean headshot = false; boolean headshot = false;
if(entity instanceof LivingEntity) if (entity instanceof LivingEntity) {
{
IHeadshotBox<LivingEntity> headshotBox = (IHeadshotBox<LivingEntity>) BoundingBoxManager.getHeadshotBoxes(entity.getType()); IHeadshotBox<LivingEntity> headshotBox = (IHeadshotBox<LivingEntity>) BoundingBoxManager.getHeadshotBoxes(entity.getType());
if(headshotBox != null) if (headshotBox != null) {
{
AABB box = headshotBox.getHeadshotBox((LivingEntity) entity); AABB box = headshotBox.getHeadshotBox((LivingEntity) entity);
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.isPresent()) {
{ 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);
} }
if(headshotHitPos.isPresent() && (hitPos == null || headshotHitPos.get().distanceTo(hitPos) < 0.55)) if (headshotHitPos.isPresent() && (hitPos == null || headshotHitPos.get().distanceTo(hitPos) < 0.55)) {
{
hitPos = headshotHitPos.get();
headshot = true; headshot = true;
} }
if(headshot){ if (headshot) {
if(this.getOwner() instanceof LivingEntity living){ if (this.getOwner() instanceof LivingEntity living) {
setBaseDamage(getBaseDamage() * 5); setBaseDamage(getBaseDamage() * 5);
double _setval = 25; double _setval = 25;
living.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { living.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
capability.headind = _setval; capability.headind = _setval;
capability.syncPlayerVariables(living); capability.syncPlayerVariables(living);
}); });
Entity _ent = living; if (!living.level().isClientSide() && living.getServer() != null) {
if (!_ent.level().isClientSide() && _ent.getServer() != null) { living.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, living.position(), living.getRotationVector(), living.level() instanceof ServerLevel ? (ServerLevel) living.level() : null, 4,
_ent.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, _ent.position(), _ent.getRotationVector(), _ent.level() instanceof ServerLevel ? (ServerLevel) _ent.level() : null, 4, living.getName().getString(), living.getDisplayName(), living.level().getServer(), living), "playsound target:headshot voice @a ~ ~ ~ 1 1");
_ent.getName().getString(), _ent.getDisplayName(), _ent.level().getServer(), _ent), "playsound target:headshot voice @a ~ ~ ~ 1 1");
} }
} }
} }
@ -154,7 +144,7 @@ public class RpgRocketEntity extends AbstractArrow implements ItemSupplier {
public void tick() { public void tick() {
super.tick(); super.tick();
RpgRocketDanSheWuFeiXingShiMeiKeFaShengProcedure.execute(this); RpgRocketDanSheWuFeiXingShiMeiKeFaShengProcedure.execute(this);
if(this.tickCount>100){ if (this.tickCount > 100) {
this.discard(); this.discard();
} }
} }

View file

@ -1,57 +1,47 @@
package net.mcreator.target.entity; package net.mcreator.target.entity;
import software.bernie.geckolib.util.GeckoLibUtil;
import software.bernie.geckolib.core.object.PlayState;
import software.bernie.geckolib.core.animation.RawAnimation;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.core.animation.AnimationController;
import software.bernie.geckolib.core.animation.AnimatableManager;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.animatable.GeoEntity;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.network.PlayMessages;
import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.common.DungeonHooks;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.Level;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.monster.Spider;
import net.minecraft.world.entity.monster.Monster;
import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal;
import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal;
import net.minecraft.world.entity.ai.goal.RandomStrollGoal;
import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal;
import net.minecraft.world.entity.ai.goal.MeleeAttackGoal;
import net.minecraft.world.entity.ai.goal.FloatGoal;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.SpawnPlacements;
import net.minecraft.world.entity.Pose;
import net.minecraft.world.entity.MobType;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.EntityDimensions;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.Difficulty;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.protocol.Packet;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.core.BlockPos;
import net.mcreator.target.procedures.SenpaiDangShiTiGengXinKeShiProcedure;
import net.mcreator.target.init.TargetModEntities; import net.mcreator.target.init.TargetModEntities;
import net.mcreator.target.procedures.SenpaiDangShiTiGengXinKeShiProcedure;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.Difficulty;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.*;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.goal.FloatGoal;
import net.minecraft.world.entity.ai.goal.MeleeAttackGoal;
import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal;
import net.minecraft.world.entity.ai.goal.RandomStrollGoal;
import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal;
import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal;
import net.minecraft.world.entity.monster.Monster;
import net.minecraft.world.entity.monster.Spider;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraftforge.common.DungeonHooks;
import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.network.PlayMessages;
import net.minecraftforge.registries.ForgeRegistries;
import software.bernie.geckolib.animatable.GeoEntity;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.core.animation.AnimatableManager;
import software.bernie.geckolib.core.animation.AnimationController;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.core.animation.RawAnimation;
import software.bernie.geckolib.core.object.PlayState;
import software.bernie.geckolib.util.GeckoLibUtil;
public class SenpaiEntity extends Spider implements GeoEntity { public class SenpaiEntity extends Spider implements GeoEntity {
public static final EntityDataAccessor<Boolean> SHOOT = SynchedEntityData.defineId(SenpaiEntity.class, EntityDataSerializers.BOOLEAN); public static final EntityDataAccessor<Boolean> SHOOT = SynchedEntityData.defineId(SenpaiEntity.class, EntityDataSerializers.BOOLEAN);

View file

@ -1,58 +1,41 @@
package net.mcreator.target.entity; package net.mcreator.target.entity;
import software.bernie.geckolib.util.GeckoLibUtil;
import software.bernie.geckolib.core.object.PlayState;
import software.bernie.geckolib.core.animation.RawAnimation;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.core.animation.AnimationController;
import software.bernie.geckolib.core.animation.AnimatableManager;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.animatable.GeoEntity;
import net.minecraftforge.network.PlayMessages;
import net.minecraftforge.network.NetworkHooks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.Level;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.entity.projectile.ThrownPotion;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.ai.navigation.PathNavigation;
import net.minecraft.world.entity.ai.navigation.FlyingPathNavigation;
import net.minecraft.world.entity.ai.control.FlyingMoveControl;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.SpawnGroupData;
import net.minecraft.world.entity.Pose;
import net.minecraft.world.entity.PathfinderMob;
import net.minecraft.world.entity.MobType;
import net.minecraft.world.entity.MobSpawnType;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.EntityDimensions;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.AreaEffectCloud;
import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.protocol.Packet;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.core.BlockPos;
import net.mcreator.target.procedures.Target1ShiTiChuShiShengChengShiProcedure;
import net.mcreator.target.procedures.Target1DangYouJiShiTiShiProcedure;
import net.mcreator.target.procedures.Target1DangShiTiShouShangShiProcedure;
import net.mcreator.target.procedures.Target1DangShiTiGengXinKeShiProcedure;
import net.mcreator.target.procedures.BazipengzhuangProcedure;
import net.mcreator.target.init.TargetModEntities; import net.mcreator.target.init.TargetModEntities;
import net.mcreator.target.procedures.*;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.entity.*;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.control.FlyingMoveControl;
import net.minecraft.world.entity.ai.navigation.FlyingPathNavigation;
import net.minecraft.world.entity.ai.navigation.PathNavigation;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.projectile.ThrownPotion;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.network.PlayMessages;
import software.bernie.geckolib.animatable.GeoEntity;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.core.animation.AnimatableManager;
import software.bernie.geckolib.core.animation.AnimationController;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.core.animation.RawAnimation;
import software.bernie.geckolib.core.object.PlayState;
import software.bernie.geckolib.util.GeckoLibUtil;
import javax.annotation.Nullable; import javax.annotation.Nullable;

View file

@ -1,48 +1,37 @@
package net.mcreator.target.entity; package net.mcreator.target.entity;
import software.bernie.geckolib.util.GeckoLibUtil;
import software.bernie.geckolib.core.object.PlayState;
import software.bernie.geckolib.core.animation.RawAnimation;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.core.animation.AnimationController;
import software.bernie.geckolib.core.animation.AnimatableManager;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.animatable.GeoEntity;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.network.PlayMessages;
import net.minecraftforge.network.NetworkHooks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.Level;
import net.minecraft.world.entity.projectile.ThrownPotion;
import net.minecraft.world.entity.ai.navigation.PathNavigation;
import net.minecraft.world.entity.ai.navigation.FlyingPathNavigation;
import net.minecraft.world.entity.ai.control.FlyingMoveControl;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.Pose;
import net.minecraft.world.entity.PathfinderMob;
import net.minecraft.world.entity.MobType;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.EntityDimensions;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.AreaEffectCloud;
import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.protocol.Packet;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.core.BlockPos;
import net.mcreator.target.init.TargetModEntities; import net.mcreator.target.init.TargetModEntities;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.entity.*;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.control.FlyingMoveControl;
import net.minecraft.world.entity.ai.navigation.FlyingPathNavigation;
import net.minecraft.world.entity.ai.navigation.PathNavigation;
import net.minecraft.world.entity.projectile.ThrownPotion;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.network.PlayMessages;
import net.minecraftforge.registries.ForgeRegistries;
import software.bernie.geckolib.animatable.GeoEntity;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.core.animation.AnimatableManager;
import software.bernie.geckolib.core.animation.AnimationController;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.core.animation.RawAnimation;
import software.bernie.geckolib.core.object.PlayState;
import software.bernie.geckolib.util.GeckoLibUtil;
public class TargetEntity extends PathfinderMob implements GeoEntity { public class TargetEntity extends PathfinderMob implements GeoEntity {
public static final EntityDataAccessor<Boolean> SHOOT = SynchedEntityData.defineId(TargetEntity.class, EntityDataSerializers.BOOLEAN); public static final EntityDataAccessor<Boolean> SHOOT = SynchedEntityData.defineId(TargetEntity.class, EntityDataSerializers.BOOLEAN);

View file

@ -1,37 +1,32 @@
package net.mcreator.target.entity; package net.mcreator.target.entity;
import net.minecraft.commands.CommandSource;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.block.*;
import net.minecraft.world.phys.*;
import net.mcreator.target.headshot.BoundingBoxManager; import net.mcreator.target.headshot.BoundingBoxManager;
import net.mcreator.target.headshot.IHeadshotBox; import net.mcreator.target.headshot.IHeadshotBox;
import net.mcreator.target.init.TargetModEntities; import net.mcreator.target.init.TargetModEntities;
import net.minecraftforge.network.PlayMessages;
import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.level.Level;
import net.minecraft.world.entity.projectile.ItemSupplier;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.ItemStack;
import net.minecraft.util.RandomSource;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.protocol.Packet;
import net.mcreator.target.procedures.TaserBulletTouZhiWuFeiXingKeProcedure;
import net.mcreator.target.procedures.TaserBulletDangTouZhiWuJiZhongShiTiShiProcedure;
import net.mcreator.target.network.TargetModVariables; import net.mcreator.target.network.TargetModVariables;
import net.mcreator.target.procedures.TaserBulletDangTouZhiWuJiZhongShiTiShiProcedure;
import net.mcreator.target.procedures.TaserBulletTouZhiWuFeiXingKeProcedure;
import net.minecraft.commands.CommandSource;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.entity.projectile.ItemSupplier;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.network.PlayMessages;
import java.util.Optional; import java.util.Optional;
@ -81,19 +76,18 @@ public class TaserBulletProjectileEntity extends AbstractArrow implements ItemSu
protected void onHitEntity(EntityHitResult result) { protected void onHitEntity(EntityHitResult result) {
final Vec3 position = this.position(); 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;
living.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { living.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
capability.hitind = _setval; capability.hitind = _setval;
capability.syncPlayerVariables(living); capability.syncPlayerVariables(living);
}); });
Entity _ent = living; if (!living.level().isClientSide() && living.getServer() != null) {
if (!_ent.level().isClientSide() && _ent.getServer() != null) { living.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, living.position(), living.getRotationVector(), living.level() instanceof ServerLevel ? (ServerLevel) living.level() : null, 4,
_ent.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, _ent.position(), _ent.getRotationVector(), _ent.level() instanceof ServerLevel ? (ServerLevel) _ent.level() : null, 4, living.getName().getString(), living.getDisplayName(), living.level().getServer(), living), "playsound target:indication voice @a ~ ~ ~ 1 1");
_ent.getName().getString(), _ent.getDisplayName(), _ent.level().getServer(), _ent), "playsound target:indication voice @a ~ ~ ~ 1 1");
} }
} }
if (entity instanceof LivingEntity livingEntity) { if (entity instanceof LivingEntity) {
entity.invulnerableTime = 0; entity.invulnerableTime = 0;
} }
AABB boundingBox = entity.getBoundingBox(); AABB boundingBox = entity.getBoundingBox();
@ -102,38 +96,31 @@ public class TaserBulletProjectileEntity extends AbstractArrow implements ItemSu
Vec3 hitPos = boundingBox.clip(startVec, endVec).orElse(null); Vec3 hitPos = boundingBox.clip(startVec, endVec).orElse(null);
/* Check for headshot */ /* Check for headshot */
boolean headshot = false; boolean headshot = false;
if(entity instanceof LivingEntity) if (entity instanceof LivingEntity) {
{
IHeadshotBox<LivingEntity> headshotBox = (IHeadshotBox<LivingEntity>) BoundingBoxManager.getHeadshotBoxes(entity.getType()); IHeadshotBox<LivingEntity> headshotBox = (IHeadshotBox<LivingEntity>) BoundingBoxManager.getHeadshotBoxes(entity.getType());
if(headshotBox != null) if (headshotBox != null) {
{
AABB box = headshotBox.getHeadshotBox((LivingEntity) entity); AABB box = headshotBox.getHeadshotBox((LivingEntity) entity);
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);
} }
if(headshotHitPos.isPresent() && (hitPos == null || headshotHitPos.get().distanceTo(hitPos) < 0.55)) if (headshotHitPos.isPresent() && (hitPos == null || headshotHitPos.get().distanceTo(hitPos) < 0.55)) {
{
hitPos = headshotHitPos.get();
headshot = true; headshot = true;
} }
if(headshot){ if (headshot) {
if(this.getOwner() instanceof LivingEntity living){ if (this.getOwner() instanceof LivingEntity living) {
setBaseDamage(getBaseDamage() * 1.5f); setBaseDamage(getBaseDamage() * 1.5f);
double _setval = 25; double _setval = 25;
living.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { living.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
capability.headind = _setval; capability.headind = _setval;
capability.syncPlayerVariables(living); capability.syncPlayerVariables(living);
}); });
Entity _ent = living; if (!living.level().isClientSide() && living.getServer() != null) {
if (!_ent.level().isClientSide() && _ent.getServer() != null) { living.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, living.position(), living.getRotationVector(), living.level() instanceof ServerLevel ? (ServerLevel) living.level() : null, 4,
_ent.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, _ent.position(), _ent.getRotationVector(), _ent.level() instanceof ServerLevel ? (ServerLevel) _ent.level() : null, 4, living.getName().getString(), living.getDisplayName(), living.level().getServer(), living), "playsound target:headshot voice @a ~ ~ ~ 1 1");
_ent.getName().getString(), _ent.getDisplayName(), _ent.level().getServer(), _ent), "playsound target:headshot voice @a ~ ~ ~ 1 1");
} }
} }
} }
@ -149,7 +136,7 @@ public class TaserBulletProjectileEntity extends AbstractArrow implements ItemSu
public void tick() { public void tick() {
super.tick(); super.tick();
TaserBulletTouZhiWuFeiXingKeProcedure.execute(this); TaserBulletTouZhiWuFeiXingKeProcedure.execute(this);
if(this.tickCount>200){ if (this.tickCount > 200) {
this.discard(); this.discard();
} }
} }

View file

@ -1,18 +1,15 @@
package net.mcreator.target.entity.layer; package net.mcreator.target.entity.layer;
import software.bernie.geckolib.renderer.layer.GeoRenderLayer;
import software.bernie.geckolib.renderer.GeoRenderer;
import software.bernie.geckolib.cache.object.BakedGeoModel;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.MultiBufferSource;
import net.mcreator.target.entity.TargetEntity;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.mcreator.target.entity.TargetEntity;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.ResourceLocation;
import software.bernie.geckolib.cache.object.BakedGeoModel;
import software.bernie.geckolib.renderer.GeoRenderer;
import software.bernie.geckolib.renderer.layer.GeoRenderLayer;
public class TargetLayer extends GeoRenderLayer<TargetEntity> { public class TargetLayer extends GeoRenderLayer<TargetEntity> {
private static final ResourceLocation LAYER = new ResourceLocation("target", "textures/entities/target_e.png"); private static final ResourceLocation LAYER = new ResourceLocation("target", "textures/entities/target_e.png");

View file

@ -1,10 +1,8 @@
package net.mcreator.target.entity.model; package net.mcreator.target.entity.model;
import software.bernie.geckolib.model.GeoModel;
import net.minecraft.resources.ResourceLocation;
import net.mcreator.target.entity.ClaymoreEntity; import net.mcreator.target.entity.ClaymoreEntity;
import net.minecraft.resources.ResourceLocation;
import software.bernie.geckolib.model.GeoModel;
public class ClaymoreModel extends GeoModel<ClaymoreEntity> { public class ClaymoreModel extends GeoModel<ClaymoreEntity> {
@Override @Override

View file

@ -1,15 +1,13 @@
package net.mcreator.target.entity.model; package net.mcreator.target.entity.model;
import software.bernie.geckolib.model.data.EntityModelData;
import software.bernie.geckolib.model.GeoModel;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
import software.bernie.geckolib.constant.DataTickets;
import net.minecraft.util.Mth;
import net.minecraft.resources.ResourceLocation;
import net.mcreator.target.entity.MortarEntity; import net.mcreator.target.entity.MortarEntity;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import software.bernie.geckolib.constant.DataTickets;
import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.model.GeoModel;
import software.bernie.geckolib.model.data.EntityModelData;
public class MortarModel extends GeoModel<MortarEntity> { public class MortarModel extends GeoModel<MortarEntity> {
@Override @Override

View file

@ -1,15 +1,13 @@
package net.mcreator.target.entity.model; package net.mcreator.target.entity.model;
import software.bernie.geckolib.model.data.EntityModelData;
import software.bernie.geckolib.model.GeoModel;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
import software.bernie.geckolib.constant.DataTickets;
import net.minecraft.util.Mth;
import net.minecraft.resources.ResourceLocation;
import net.mcreator.target.entity.SenpaiEntity; import net.mcreator.target.entity.SenpaiEntity;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import software.bernie.geckolib.constant.DataTickets;
import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.model.GeoModel;
import software.bernie.geckolib.model.data.EntityModelData;
public class SenpaiModel extends GeoModel<SenpaiEntity> { public class SenpaiModel extends GeoModel<SenpaiEntity> {
@Override @Override

View file

@ -1,15 +1,13 @@
package net.mcreator.target.entity.model; package net.mcreator.target.entity.model;
import software.bernie.geckolib.model.data.EntityModelData;
import software.bernie.geckolib.model.GeoModel;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
import software.bernie.geckolib.constant.DataTickets;
import net.minecraft.util.Mth;
import net.minecraft.resources.ResourceLocation;
import net.mcreator.target.entity.Target1Entity; import net.mcreator.target.entity.Target1Entity;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import software.bernie.geckolib.constant.DataTickets;
import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.model.GeoModel;
import software.bernie.geckolib.model.data.EntityModelData;
public class Target1Model extends GeoModel<Target1Entity> { public class Target1Model extends GeoModel<Target1Entity> {
@Override @Override

View file

@ -1,10 +1,8 @@
package net.mcreator.target.entity.model; package net.mcreator.target.entity.model;
import software.bernie.geckolib.model.GeoModel;
import net.minecraft.resources.ResourceLocation;
import net.mcreator.target.entity.TargetEntity; import net.mcreator.target.entity.TargetEntity;
import net.minecraft.resources.ResourceLocation;
import software.bernie.geckolib.model.GeoModel;
public class TargetModel extends GeoModel<TargetEntity> { public class TargetModel extends GeoModel<TargetEntity> {
@Override @Override

View file

@ -8,21 +8,18 @@ import javax.annotation.Nullable;
/** /**
* Author: MrCrayfish * Author: MrCrayfish
*/ */
public class BasicHeadshotBox<T extends LivingEntity> implements IHeadshotBox<T> public class BasicHeadshotBox<T extends LivingEntity> implements IHeadshotBox<T> {
{
protected double headWidth; protected double headWidth;
protected double headHeight; protected double headHeight;
protected double headYOffset; protected double headYOffset;
public BasicHeadshotBox(double headSize, double headYOffset) public BasicHeadshotBox(double headSize, double headYOffset) {
{
this.headWidth = headSize; this.headWidth = headSize;
this.headHeight = headSize; this.headHeight = headSize;
this.headYOffset = headYOffset; this.headYOffset = headYOffset;
} }
public BasicHeadshotBox(double headWidth, double headHeight, double headYOffset) public BasicHeadshotBox(double headWidth, double headHeight, double headYOffset) {
{
this.headWidth = headWidth; this.headWidth = headWidth;
this.headHeight = headHeight; this.headHeight = headHeight;
this.headYOffset = headYOffset; this.headYOffset = headYOffset;
@ -30,8 +27,7 @@ public class BasicHeadshotBox<T extends LivingEntity> implements IHeadshotBox<T>
@Nullable @Nullable
@Override @Override
public AABB getHeadshotBox(T entity) public AABB getHeadshotBox(T entity) {
{
double halfWidth = this.headWidth / 2.0; double halfWidth = this.headWidth / 2.0;
AABB headBox = new AABB(-halfWidth * 0.0625, 0, -halfWidth * 0.0625, halfWidth * 0.0625, this.headHeight * 0.0625, halfWidth * 0.0625); AABB headBox = new AABB(-halfWidth * 0.0625, 0, -halfWidth * 0.0625, halfWidth * 0.0625, this.headHeight * 0.0625, halfWidth * 0.0625);
headBox = headBox.move(0, this.headYOffset * 0.0625, 0); headBox = headBox.move(0, this.headYOffset * 0.0625, 0);

View file

@ -1,5 +1,7 @@
package net.mcreator.target.headshot; package net.mcreator.target.headshot;
//import com.mrcrayfish.guns.Config; //import com.mrcrayfish.guns.Config;
import net.mcreator.target.init.TargetModEntities;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
@ -11,9 +13,6 @@ 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;
import net.minecraftforge.fml.LogicalSide; import net.minecraftforge.fml.LogicalSide;
import net.mcreator.target.entity.Target1Entity;
import net.mcreator.target.entity.SenpaiEntity;
import net.mcreator.target.init.TargetModEntities;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.HashMap; import java.util.HashMap;
@ -26,25 +25,20 @@ import java.util.WeakHashMap;
/** /**
* Author: MrCrayfish * Author: MrCrayfish
*/ */
public class BoundingBoxManager public class BoundingBoxManager {
{ private static final Map<EntityType<?>, IHeadshotBox<?>> headshotBoxes = new HashMap<>();
private static Map<EntityType<?>, IHeadshotBox<?>> headshotBoxes = new HashMap<>(); private static final WeakHashMap<Player, LinkedList<AABB>> playerBoxes = new WeakHashMap<>();
private static WeakHashMap<Player, LinkedList<AABB>> playerBoxes = new WeakHashMap<>();
static static {
{
/* Player */ /* Player */
registerHeadshotBox(EntityType.PLAYER, (entity) -> { registerHeadshotBox(EntityType.PLAYER, (entity) -> {
AABB headBox = new AABB(-4 * 0.0625, 0, -4 * 0.0625, 4 * 0.0625, 8 * 0.0625, 4 * 0.0625); AABB headBox = new AABB(-4 * 0.0625, 0, -4 * 0.0625, 4 * 0.0625, 8 * 0.0625, 4 * 0.0625);
double scale = 30.0 / 32.0; double scale = 30.0 / 32.0;
if(entity.getBbHeight() <= 1) if (entity.getBbHeight() <= 1) {
{
headBox = headBox.move(0, 3 * 0.0625, 0); headBox = headBox.move(0, 3 * 0.0625, 0);
Vec3 pos = Vec3.directionFromRotation(entity.getXRot(), entity.yBodyRot).normalize().scale(0.8); Vec3 pos = Vec3.directionFromRotation(entity.getXRot(), entity.yBodyRot).normalize().scale(0.8);
headBox = headBox.move(pos); headBox = headBox.move(pos);
} } else {
else
{
headBox = headBox.move(0, entity.isShiftKeyDown() ? 20 * 0.0625 : 24 * 0.0625, 0); headBox = headBox.move(0, entity.isShiftKeyDown() ? 20 * 0.0625 : 24 * 0.0625, 0);
} }
return new AABB(headBox.minX * scale, headBox.minY * scale, headBox.minZ * scale, headBox.maxX * scale, headBox.maxY * scale, headBox.maxZ * scale); return new AABB(headBox.minX * scale, headBox.minY * scale, headBox.minZ * scale, headBox.maxX * scale, headBox.maxY * scale, headBox.maxZ * scale);
@ -96,50 +90,41 @@ public class BoundingBoxManager
* @param headshotBox a {@link IHeadshotBox} get * @param headshotBox a {@link IHeadshotBox} get
* @param <T> a type that extends {@link LivingEntity} * @param <T> a type that extends {@link LivingEntity}
*/ */
public static <T extends LivingEntity> void registerHeadshotBox(EntityType<T> type, IHeadshotBox<T> headshotBox) public static <T extends LivingEntity> void registerHeadshotBox(EntityType<T> type, IHeadshotBox<T> headshotBox) {
{
headshotBoxes.putIfAbsent(type, headshotBox); headshotBoxes.putIfAbsent(type, headshotBox);
} }
@Nullable @Nullable
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <T extends Entity> IHeadshotBox<T> getHeadshotBoxes(EntityType<T> type) public static <T extends Entity> IHeadshotBox<T> getHeadshotBoxes(EntityType<T> type) {
{
return (IHeadshotBox<T>) headshotBoxes.get(type); return (IHeadshotBox<T>) headshotBoxes.get(type);
} }
@SubscribeEvent(receiveCanceled = true) @SubscribeEvent(receiveCanceled = true)
public void onPlayerTick(TickEvent.PlayerTickEvent event) public void onPlayerTick(TickEvent.PlayerTickEvent event) {
{
// if(!Config.COMMON.gameplay.improvedHitboxes.get()) // if(!Config.COMMON.gameplay.improvedHitboxes.get())
// return; // return;
if(event.side == LogicalSide.SERVER && event.phase == TickEvent.Phase.END) if (event.side == LogicalSide.SERVER && event.phase == TickEvent.Phase.END) {
{ if (event.player.isSpectator()) {
if(event.player.isSpectator())
{
playerBoxes.remove(event.player); playerBoxes.remove(event.player);
return; return;
} }
LinkedList<AABB> boxes = playerBoxes.computeIfAbsent(event.player, player -> new LinkedList<>()); LinkedList<AABB> boxes = playerBoxes.computeIfAbsent(event.player, player -> new LinkedList<>());
boxes.addFirst(event.player.getBoundingBox()); boxes.addFirst(event.player.getBoundingBox());
if(boxes.size() > 20) if (boxes.size() > 20) {
{
boxes.removeLast(); boxes.removeLast();
} }
} }
} }
@SubscribeEvent(receiveCanceled = true) @SubscribeEvent(receiveCanceled = true)
public void onPlayerLoggedOut(PlayerEvent.PlayerLoggedOutEvent event) public void onPlayerLoggedOut(PlayerEvent.PlayerLoggedOutEvent event) {
{
playerBoxes.remove(event.getEntity()); playerBoxes.remove(event.getEntity());
} }
public static AABB getBoundingBox(Player entity, int ping) public static AABB getBoundingBox(Player entity, int ping) {
{ if (playerBoxes.containsKey(entity)) {
if(playerBoxes.containsKey(entity))
{
LinkedList<AABB> boxes = playerBoxes.get(entity); LinkedList<AABB> boxes = playerBoxes.get(entity);
int index = Mth.clamp(ping, 0, boxes.size() - 1); int index = Mth.clamp(ping, 0, boxes.size() - 1);
return boxes.get(index); return boxes.get(index);

View file

@ -8,20 +8,17 @@ import javax.annotation.Nullable;
/** /**
* Author: MrCrayfish * Author: MrCrayfish
*/ */
public class ChildHeadshotBox<T extends LivingEntity> extends BasicHeadshotBox<T> public class ChildHeadshotBox<T extends LivingEntity> extends BasicHeadshotBox<T> {
{ private final double childHeadScale;
private double childHeadScale; private final double headYOffsetScale;
private double headYOffsetScale;
public ChildHeadshotBox(double headSize, double headYOffset, double childHeadScale, double headYOffsetScale) public ChildHeadshotBox(double headSize, double headYOffset, double childHeadScale, double headYOffsetScale) {
{
super(headSize, headYOffset); super(headSize, headYOffset);
this.childHeadScale = childHeadScale; this.childHeadScale = childHeadScale;
this.headYOffsetScale = headYOffsetScale; this.headYOffsetScale = headYOffsetScale;
} }
public ChildHeadshotBox(double headWidth, double headHeight, double headYOffset, double childHeadScale, double headYOffsetScale) public ChildHeadshotBox(double headWidth, double headHeight, double headYOffset, double childHeadScale, double headYOffsetScale) {
{
super(headWidth, headHeight, headYOffset); super(headWidth, headHeight, headYOffset);
this.childHeadScale = childHeadScale; this.childHeadScale = childHeadScale;
this.headYOffsetScale = headYOffsetScale; this.headYOffsetScale = headYOffsetScale;
@ -29,11 +26,9 @@ public class ChildHeadshotBox<T extends LivingEntity> extends BasicHeadshotBox<T
@Nullable @Nullable
@Override @Override
public AABB getHeadshotBox(T entity) public AABB getHeadshotBox(T entity) {
{
AABB headBox = super.getHeadshotBox(entity); AABB headBox = super.getHeadshotBox(entity);
if(headBox != null && entity.isBaby()) if (headBox != null && entity.isBaby()) {
{
return new AABB(headBox.minX * this.childHeadScale, headBox.minY * this.headYOffsetScale, headBox.minZ * this.childHeadScale, headBox.maxX * this.childHeadScale, headBox.maxY * (this.headYOffsetScale + 0.065), headBox.maxZ * this.childHeadScale); return new AABB(headBox.minX * this.childHeadScale, headBox.minY * this.headYOffsetScale, headBox.minZ * this.childHeadScale, headBox.maxX * this.childHeadScale, headBox.maxY * (this.headYOffsetScale + 0.065), headBox.maxZ * this.childHeadScale);
} }
return headBox; return headBox;

View file

@ -13,8 +13,7 @@ import javax.annotation.Nullable;
* <p> * <p>
* Author: MrCrayfish * Author: MrCrayfish
*/ */
public interface IHeadshotBox<T extends Entity> public interface IHeadshotBox<T extends Entity> {
{
/** /**
* Gets a bounding box of the given entity's head in the world. This method can either return an * Gets a bounding box of the given entity's head in the world. This method can either return an
* axis aligned box or null for no hit box. * axis aligned box or null for no hit box.

View file

@ -8,23 +8,19 @@ import javax.annotation.Nullable;
/** /**
* Author: MrCrayfish * Author: MrCrayfish
*/ */
public class NoChildHeadshotBox<T extends LivingEntity> extends BasicHeadshotBox<T> public class NoChildHeadshotBox<T extends LivingEntity> extends BasicHeadshotBox<T> {
{ public NoChildHeadshotBox(double headSize, double headYOffset) {
public NoChildHeadshotBox(double headSize, double headYOffset)
{
super(headSize, headYOffset); super(headSize, headYOffset);
} }
public NoChildHeadshotBox(double headWidth, double headHeight, double headYOffset) public NoChildHeadshotBox(double headWidth, double headHeight, double headYOffset) {
{
super(headWidth, headHeight, headYOffset); super(headWidth, headHeight, headYOffset);
} }
@Nullable @Nullable
@Override @Override
public AABB getHeadshotBox(T entity) public AABB getHeadshotBox(T entity) {
{ if (entity.isBaby()) return null;
if(entity.isBaby()) return null;
return super.getHeadshotBox(entity); return super.getHeadshotBox(entity);
} }
} }

View file

@ -8,23 +8,19 @@ import javax.annotation.Nullable;
/** /**
* Author: MrCrayfish * Author: MrCrayfish
*/ */
public class NoChildRotatedHeadshotBox<T extends LivingEntity> extends RotatedHeadshotBox<T> public class NoChildRotatedHeadshotBox<T extends LivingEntity> extends RotatedHeadshotBox<T> {
{ public NoChildRotatedHeadshotBox(double headSize, double headYOffset, double headZOffset, boolean rotatePitch, boolean rotateYaw) {
public NoChildRotatedHeadshotBox(double headSize, double headYOffset, double headZOffset, boolean rotatePitch, boolean rotateYaw)
{
super(headSize, headYOffset, headZOffset, rotatePitch, rotateYaw); super(headSize, headYOffset, headZOffset, rotatePitch, rotateYaw);
} }
public NoChildRotatedHeadshotBox(double headWidth, double headHeight, double headYOffset, double headZOffset, boolean rotatePitch, boolean rotateYaw) public NoChildRotatedHeadshotBox(double headWidth, double headHeight, double headYOffset, double headZOffset, boolean rotatePitch, boolean rotateYaw) {
{
super(headWidth, headHeight, headYOffset, headZOffset, rotatePitch, rotateYaw); super(headWidth, headHeight, headYOffset, headZOffset, rotatePitch, rotateYaw);
} }
@Nullable @Nullable
@Override @Override
public AABB getHeadshotBox(T entity) public AABB getHeadshotBox(T entity) {
{ if (entity.isBaby()) return null;
if(entity.isBaby()) return null;
return super.getHeadshotBox(entity); return super.getHeadshotBox(entity);
} }
} }

View file

@ -9,22 +9,19 @@ import javax.annotation.Nullable;
/** /**
* Author: MrCrayfish * Author: MrCrayfish
*/ */
public class RotatedHeadshotBox<T extends LivingEntity> extends BasicHeadshotBox<T> public class RotatedHeadshotBox<T extends LivingEntity> extends BasicHeadshotBox<T> {
{
protected double headZOffset; protected double headZOffset;
protected boolean rotatePitch; protected boolean rotatePitch;
protected boolean rotateYaw; protected boolean rotateYaw;
public RotatedHeadshotBox(double headSize, double headYOffset, double headZOffset, boolean rotatePitch, boolean rotateYaw) public RotatedHeadshotBox(double headSize, double headYOffset, double headZOffset, boolean rotatePitch, boolean rotateYaw) {
{
super(headSize, headSize, headYOffset); super(headSize, headSize, headYOffset);
this.headZOffset = headZOffset; this.headZOffset = headZOffset;
this.rotatePitch = rotatePitch; this.rotatePitch = rotatePitch;
this.rotateYaw = rotateYaw; this.rotateYaw = rotateYaw;
} }
public RotatedHeadshotBox(double headWidth, double headHeight, double headYOffset, double headZOffset, boolean rotatePitch, boolean rotateYaw) public RotatedHeadshotBox(double headWidth, double headHeight, double headYOffset, double headZOffset, boolean rotatePitch, boolean rotateYaw) {
{
super(headWidth, headHeight, headYOffset); super(headWidth, headHeight, headYOffset);
this.headZOffset = headZOffset; this.headZOffset = headZOffset;
this.rotatePitch = rotatePitch; this.rotatePitch = rotatePitch;
@ -33,11 +30,9 @@ public class RotatedHeadshotBox<T extends LivingEntity> extends BasicHeadshotBox
@Nullable @Nullable
@Override @Override
public AABB getHeadshotBox(T entity) public AABB getHeadshotBox(T entity) {
{
AABB headBox = super.getHeadshotBox(entity); AABB headBox = super.getHeadshotBox(entity);
if(headBox != null) if (headBox != null) {
{
headBox = headBox.move(Vec3.directionFromRotation(this.rotatePitch ? entity.getXRot() : 0.0F, this.rotateYaw ? entity.yBodyRot : 0.0F).normalize().scale(this.headZOffset * 0.0625)); headBox = headBox.move(Vec3.directionFromRotation(this.rotatePitch ? entity.getXRot() : 0.0F, this.rotateYaw ? entity.yBodyRot : 0.0F).normalize().scale(this.headZOffset * 0.0625));
return headBox; return headBox;
} }

View file

@ -1,14 +1,9 @@
package net.mcreator.target.init; package net.mcreator.target.init;
import net.minecraftforge.fml.common.Mod; import net.mcreator.target.entity.*;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.mcreator.target.entity.TargetEntity; import net.minecraftforge.fml.common.Mod;
import net.mcreator.target.entity.Target1Entity;
import net.mcreator.target.entity.SenpaiEntity;
import net.mcreator.target.entity.MortarEntity;
import net.mcreator.target.entity.ClaymoreEntity;
@Mod.EventBusSubscriber @Mod.EventBusSubscriber
public class EntityAnimationFactory { public class EntityAnimationFactory {

View file

@ -1,53 +1,23 @@
package net.mcreator.target.init; package net.mcreator.target.init;
import software.bernie.geckolib.animatable.GeoItem; import net.mcreator.target.item.*;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.event.TickEvent;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.client.renderer.ItemInHandRenderer;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemInHandRenderer;
import net.mcreator.target.item.VectorItem; import net.minecraft.world.item.ArmorItem;
import net.mcreator.target.item.TracheliumItem; import net.minecraftforge.event.TickEvent;
import net.mcreator.target.item.TaserItem; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.mcreator.target.item.SvdItem; import net.minecraftforge.fml.common.Mod;
import net.mcreator.target.item.SksItem; import software.bernie.geckolib.animatable.GeoItem;
import net.mcreator.target.item.SentinelItem;
import net.mcreator.target.item.RpkItem;
import net.mcreator.target.item.RpgItem;
import net.mcreator.target.item.RocketItem;
import net.mcreator.target.item.Mk14Item;
import net.mcreator.target.item.MinigunItem;
import net.mcreator.target.item.MarlinItem;
import net.mcreator.target.item.M98bItem;
import net.mcreator.target.item.M870Item;
import net.mcreator.target.item.M79Item;
import net.mcreator.target.item.M60Item;
import net.mcreator.target.item.M4Item;
import net.mcreator.target.item.LightSaberItem;
import net.mcreator.target.item.KraberItem;
import net.mcreator.target.item.HuntingRifleItem;
import net.mcreator.target.item.Hk416Item;
import net.mcreator.target.item.DevotionItem;
import net.mcreator.target.item.BocekItem;
import net.mcreator.target.item.AbekiriItem;
import net.mcreator.target.item.Aa12Item;
import net.mcreator.target.item.AK47Item;
@Mod.EventBusSubscriber @Mod.EventBusSubscriber
public class ItemAnimationFactory { public class ItemAnimationFactory {
public static void disableUseAnim() { public static void disableUseAnim() {
try { try {
ItemInHandRenderer renderer = Minecraft.getInstance().gameRenderer.itemInHandRenderer; ItemInHandRenderer renderer = Minecraft.getInstance().gameRenderer.itemInHandRenderer;
if (renderer != null) {
renderer.mainHandHeight = 1F; renderer.mainHandHeight = 1F;
renderer.oMainHandHeight = 1F; renderer.oMainHandHeight = 1F;
renderer.offHandHeight = 1F; renderer.offHandHeight = 1F;
renderer.oOffHandHeight = 1F; renderer.oOffHandHeight = 1F;
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -57,7 +27,7 @@ public class ItemAnimationFactory {
public static void animatedItems(TickEvent.PlayerTickEvent event) { public static void animatedItems(TickEvent.PlayerTickEvent event) {
String animation = ""; String animation = "";
if (event.phase == TickEvent.Phase.START && (event.player.getMainHandItem().getItem() instanceof GeoItem || event.player.getOffhandItem().getItem() instanceof GeoItem)) { if (event.phase == TickEvent.Phase.START && (event.player.getMainHandItem().getItem() instanceof GeoItem || event.player.getOffhandItem().getItem() instanceof GeoItem)) {
if (!event.player.getMainHandItem().getOrCreateTag().getString("geckoAnim").equals("") && !(event.player.getMainHandItem().getItem() instanceof ArmorItem)) { if (!event.player.getMainHandItem().getOrCreateTag().getString("geckoAnim").isEmpty() && !(event.player.getMainHandItem().getItem() instanceof ArmorItem)) {
animation = event.player.getMainHandItem().getOrCreateTag().getString("geckoAnim"); animation = event.player.getMainHandItem().getOrCreateTag().getString("geckoAnim");
event.player.getMainHandItem().getOrCreateTag().putString("geckoAnim", ""); event.player.getMainHandItem().getOrCreateTag().putString("geckoAnim", "");
if (event.player.getMainHandItem().getItem() instanceof TaserItem animatable) if (event.player.getMainHandItem().getItem() instanceof TaserItem animatable)

View file

@ -4,17 +4,14 @@
*/ */
package net.mcreator.target.init; package net.mcreator.target.init;
import net.minecraftforge.registries.RegistryObject;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.fml.common.Mod;
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.entity.EntityType;
import net.mcreator.target.entity.ProjectileEntity;
import net.mcreator.target.TargetMod; import net.mcreator.target.TargetMod;
import net.mcreator.target.entity.ProjectileEntity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public class TargetCustomModEntities { public class TargetCustomModEntities {

View file

@ -1,12 +1,10 @@
package net.mcreator.target.init; package net.mcreator.target.init;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.client.event.EntityRenderersEvent;
import net.minecraftforge.api.distmarker.Dist;
import net.mcreator.target.client.renderer.ProjectileRenderer; import net.mcreator.target.client.renderer.ProjectileRenderer;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.EntityRenderersEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public class TargetCustomModEntityRenderers { public class TargetCustomModEntityRenderers {

View file

@ -3,20 +3,18 @@
*/ */
package net.mcreator.target.init; package net.mcreator.target.init;
import net.minecraftforge.registries.RegistryObject;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.event.lifecycle.FMLConstructModEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.event.entity.EntityAttributeModificationEvent;
import net.minecraft.world.entity.ai.attributes.RangedAttribute;
import net.minecraft.world.entity.ai.attributes.Attribute;
import net.minecraft.world.entity.EntityType;
import net.mcreator.target.TargetMod; import net.mcreator.target.TargetMod;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.ai.attributes.Attribute;
import net.minecraft.world.entity.ai.attributes.RangedAttribute;
import net.minecraftforge.event.entity.EntityAttributeModificationEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLConstructModEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public class TargetModAttributes { public class TargetModAttributes {

View file

@ -4,30 +4,21 @@
*/ */
package net.mcreator.target.init; package net.mcreator.target.init;
import net.minecraftforge.registries.RegistryObject;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraft.world.level.block.Block;
import net.mcreator.target.block.ScheeliteOreBlock;
import net.mcreator.target.block.SandbagBlock;
import net.mcreator.target.block.JumppadBlockBlock;
import net.mcreator.target.block.GunRecycleBlock;
import net.mcreator.target.block.GalenaOreBlock;
import net.mcreator.target.block.DeepslateScheeliteOreBlock;
import net.mcreator.target.block.DeepslateGalenaOreBlock;
import net.mcreator.target.block.BarbedWireBlock;
import net.mcreator.target.TargetMod; import net.mcreator.target.TargetMod;
import net.mcreator.target.block.*;
import net.minecraft.world.level.block.Block;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
public class TargetModBlocks { public class TargetModBlocks {
public static final DeferredRegister<Block> REGISTRY = DeferredRegister.create(ForgeRegistries.BLOCKS, TargetMod.MODID); public static final DeferredRegister<Block> REGISTRY = DeferredRegister.create(ForgeRegistries.BLOCKS, TargetMod.MODID);
public static final RegistryObject<Block> SANDBAG = REGISTRY.register("sandbag", () -> new SandbagBlock()); public static final RegistryObject<Block> SANDBAG = REGISTRY.register("sandbag", SandbagBlock::new);
public static final RegistryObject<Block> BARBED_WIRE = REGISTRY.register("barbed_wire", () -> new BarbedWireBlock()); public static final RegistryObject<Block> BARBED_WIRE = REGISTRY.register("barbed_wire", BarbedWireBlock::new);
public static final RegistryObject<Block> JUMPPAD_BLOCK = REGISTRY.register("jumppad_block", () -> new JumppadBlockBlock()); public static final RegistryObject<Block> JUMPPAD_BLOCK = REGISTRY.register("jumppad_block", JumppadBlockBlock::new);
public static final RegistryObject<Block> GALENA_ORE = REGISTRY.register("galena_ore", () -> new GalenaOreBlock()); public static final RegistryObject<Block> GALENA_ORE = REGISTRY.register("galena_ore", GalenaOreBlock::new);
public static final RegistryObject<Block> DEEPSLATE_GALENA_ORE = REGISTRY.register("deepslate_galena_ore", () -> new DeepslateGalenaOreBlock()); public static final RegistryObject<Block> DEEPSLATE_GALENA_ORE = REGISTRY.register("deepslate_galena_ore", DeepslateGalenaOreBlock::new);
public static final RegistryObject<Block> SCHEELITE_ORE = REGISTRY.register("scheelite_ore", () -> new ScheeliteOreBlock()); public static final RegistryObject<Block> SCHEELITE_ORE = REGISTRY.register("scheelite_ore", ScheeliteOreBlock::new);
public static final RegistryObject<Block> DEEPSLATE_SCHEELITE_ORE = REGISTRY.register("deepslate_scheelite_ore", () -> new DeepslateScheeliteOreBlock()); public static final RegistryObject<Block> DEEPSLATE_SCHEELITE_ORE = REGISTRY.register("deepslate_scheelite_ore", DeepslateScheeliteOreBlock::new);
public static final RegistryObject<Block> GUN_RECYCLE = REGISTRY.register("gun_recycle", () -> new GunRecycleBlock()); public static final RegistryObject<Block> GUN_RECYCLE = REGISTRY.register("gun_recycle", GunRecycleBlock::new);
} }

View file

@ -4,29 +4,18 @@
*/ */
package net.mcreator.target.init; package net.mcreator.target.init;
import net.minecraftforge.registries.RegistryObject;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.event.entity.EntityAttributeCreationEvent;
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Entity;
import net.mcreator.target.entity.TaserBulletProjectileEntity;
import net.mcreator.target.entity.TargetEntity;
import net.mcreator.target.entity.Target1Entity;
import net.mcreator.target.entity.SenpaiEntity;
import net.mcreator.target.entity.RpgRocketEntity;
import net.mcreator.target.entity.MortarShellEntity;
import net.mcreator.target.entity.MortarEntity;
import net.mcreator.target.entity.GunGrenadeEntity;
import net.mcreator.target.entity.ClaymoreEntity;
import net.mcreator.target.entity.BocekarrowEntity;
import net.mcreator.target.TargetMod; import net.mcreator.target.TargetMod;
import net.mcreator.target.entity.*;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
import net.minecraftforge.event.entity.EntityAttributeCreationEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public class TargetModEntities { public class TargetModEntities {
@ -57,7 +46,7 @@ public class TargetModEntities {
private static <T extends Entity> RegistryObject<EntityType<T>> register(String registryname, EntityType.Builder<T> entityTypeBuilder) { private static <T extends Entity> RegistryObject<EntityType<T>> register(String registryname, EntityType.Builder<T> entityTypeBuilder) {
return REGISTRY.register(registryname, () -> (EntityType<T>) entityTypeBuilder.build(registryname)); return REGISTRY.register(registryname, () -> entityTypeBuilder.build(registryname));
} }
@SubscribeEvent @SubscribeEvent

View file

@ -1,20 +1,10 @@
package net.mcreator.target.init; package net.mcreator.target.init;
import net.minecraftforge.fml.common.Mod; import net.mcreator.target.client.renderer.*;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.client.event.EntityRenderersEvent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.EntityRenderersEvent;
import net.mcreator.target.client.renderer.TaserBulletProjectileRenderer; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.mcreator.target.client.renderer.TargetRenderer; import net.minecraftforge.fml.common.Mod;
import net.mcreator.target.client.renderer.Target1Renderer;
import net.mcreator.target.client.renderer.SenpaiRenderer;
import net.mcreator.target.client.renderer.RpgRocketRenderer;
import net.mcreator.target.client.renderer.MortarShellRenderer;
import net.mcreator.target.client.renderer.MortarRenderer;
import net.mcreator.target.client.renderer.GunGrenadeRenderer;
import net.mcreator.target.client.renderer.ClaymoreRenderer;
import net.mcreator.target.client.renderer.BocekarrowRenderer;
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public class TargetModEntityRenderers { public class TargetModEntityRenderers {

View file

@ -1,19 +1,16 @@
package net.mcreator.target.init; package net.mcreator.target.init;
import net.minecraftforge.registries.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.network.chat.Component;
import net.minecraft.core.registries.Registries;
import net.mcreator.target.TargetMod; import net.mcreator.target.TargetMod;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public class TargetModGunTabs { public class TargetModGunTabs {

View file

@ -4,238 +4,132 @@
*/ */
package net.mcreator.target.init; package net.mcreator.target.init;
import net.minecraftforge.registries.RegistryObject;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.common.ForgeSpawnEggItem;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.BlockItem;
import net.mcreator.target.item.VectorItem;
import net.mcreator.target.item.VectorBlueprintItem;
import net.mcreator.target.item.UnblastedcementedcarbidepodwerItem;
import net.mcreator.target.item.TungstenPowderItem;
import net.mcreator.target.item.TungstenIngotItem;
import net.mcreator.target.item.TracheliumItem;
import net.mcreator.target.item.TracheliumBlueprintItem;
import net.mcreator.target.item.TaserItem;
import net.mcreator.target.item.TaserElectrodeItem;
import net.mcreator.target.item.TaserBlueprintItem;
import net.mcreator.target.item.TargetdeployerItem;
import net.mcreator.target.item.SvdItem;
import net.mcreator.target.item.SvdBlueprintItem;
import net.mcreator.target.item.SteelTriggerItem;
import net.mcreator.target.item.SteelSpringItem;
import net.mcreator.target.item.SteelBarrelItem;
import net.mcreator.target.item.SteelActionItem;
import net.mcreator.target.item.SpecialmaterialpackItem;
import net.mcreator.target.item.SoulsteelnuggetItem;
import net.mcreator.target.item.SoulsteelIngotItem;
import net.mcreator.target.item.SniperAmmoItem;
import net.mcreator.target.item.SniperAmmoBoxItem;
import net.mcreator.target.item.SksItem;
import net.mcreator.target.item.ShotgunAmmoItem;
import net.mcreator.target.item.ShotgunAmmoBoxItem;
import net.mcreator.target.item.SentinelItem;
import net.mcreator.target.item.SentinelBlueprintItem;
import net.mcreator.target.item.ScheeliteItem;
import net.mcreator.target.item.SKSBlueprintItem;
import net.mcreator.target.item.RpkItem;
import net.mcreator.target.item.RpgItem;
import net.mcreator.target.item.RpgBlueprintItem;
import net.mcreator.target.item.RocketItem;
import net.mcreator.target.item.RifleAmmoItem;
import net.mcreator.target.item.RifleAmmoBoxItem;
import net.mcreator.target.item.RarematerialpackItem;
import net.mcreator.target.item.RPKBlueprintItem;
import net.mcreator.target.item.NetheriteTriggerItem;
import net.mcreator.target.item.NetheriteSpringItem;
import net.mcreator.target.item.NetheriteBarrelItem;
import net.mcreator.target.item.NetheriteActionItem;
import net.mcreator.target.item.MortarbipodItem;
import net.mcreator.target.item.MortarbarrelItem;
import net.mcreator.target.item.MortarShellsItem;
import net.mcreator.target.item.MortarDepolyerItem;
import net.mcreator.target.item.MoratrBasePlateItem;
import net.mcreator.target.item.Mk14Item;
import net.mcreator.target.item.Mk14BlueprintItem;
import net.mcreator.target.item.MinigunItem;
import net.mcreator.target.item.MinigunBlueprintItem;
import net.mcreator.target.item.MarlinItem;
import net.mcreator.target.item.MarlinBlueprintItem;
import net.mcreator.target.item.M98bItem;
import net.mcreator.target.item.M98bBlueprintItem;
import net.mcreator.target.item.M870Item;
import net.mcreator.target.item.M870BlueprintItem;
import net.mcreator.target.item.M79Item;
import net.mcreator.target.item.M79BlueprintItem;
import net.mcreator.target.item.M60Item;
import net.mcreator.target.item.M60BlueprintItem;
import net.mcreator.target.item.M4Item;
import net.mcreator.target.item.M4BlueprintItem;
import net.mcreator.target.item.LightSaberItem;
import net.mcreator.target.item.LegendarymaterialpackItem;
import net.mcreator.target.item.LeadIngotItem;
import net.mcreator.target.item.KraberItem;
import net.mcreator.target.item.KRABERBlueprintItem;
import net.mcreator.target.item.IronTriggerItem;
import net.mcreator.target.item.IronSpringItem;
import net.mcreator.target.item.IronPowderItem;
import net.mcreator.target.item.IronBarrelItem;
import net.mcreator.target.item.IronActionItem;
import net.mcreator.target.item.IngotSteelItem;
import net.mcreator.target.item.HuntingRifleItem;
import net.mcreator.target.item.HuntingRifleBlueprintItem;
import net.mcreator.target.item.Hk416Item;
import net.mcreator.target.item.HandgunAmmoItem;
import net.mcreator.target.item.HandgunAmmoBoxItem;
import net.mcreator.target.item.HammerItem;
import net.mcreator.target.item.HK416BlueprintItem;
import net.mcreator.target.item.Grenade40mmItem;
import net.mcreator.target.item.GalenaItem;
import net.mcreator.target.item.FuseeItem;
import net.mcreator.target.item.EpicmaterialpackItem;
import net.mcreator.target.item.DevotionItem;
import net.mcreator.target.item.DevotionBluprintItem;
import net.mcreator.target.item.CreativeAmmoBoxItem;
import net.mcreator.target.item.CopperplateItem;
import net.mcreator.target.item.CommonmaterialpackItem;
import net.mcreator.target.item.CoalPowderItem;
import net.mcreator.target.item.CoalIronPowderItem;
import net.mcreator.target.item.ClaymoreMineItem;
import net.mcreator.target.item.CementedcarbidespringItem;
import net.mcreator.target.item.CementedcarbideTriggerItem;
import net.mcreator.target.item.CementedCarbideIngotItem;
import net.mcreator.target.item.CementedCarbideBarrelItem;
import net.mcreator.target.item.CementedCarbideActionItem;
import net.mcreator.target.item.BuckshotItem;
import net.mcreator.target.item.BocekItem;
import net.mcreator.target.item.BocekBlueprintItem;
import net.mcreator.target.item.AbekiriItem;
import net.mcreator.target.item.Aa12Item;
import net.mcreator.target.item.Aa12BlueprintItem;
import net.mcreator.target.item.AK47Item;
import net.mcreator.target.item.AK47BlueprintItem;
import net.mcreator.target.TargetMod; import net.mcreator.target.TargetMod;
import net.mcreator.target.item.*;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraftforge.common.ForgeSpawnEggItem;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
public class TargetModItems { public class TargetModItems {
public static final DeferredRegister<Item> REGISTRY = DeferredRegister.create(ForgeRegistries.ITEMS, TargetMod.MODID); public static final DeferredRegister<Item> REGISTRY = DeferredRegister.create(ForgeRegistries.ITEMS, TargetMod.MODID);
public static final RegistryObject<Item> TASER = REGISTRY.register("taser", () -> new TaserItem()); public static final RegistryObject<Item> TASER = REGISTRY.register("taser", TaserItem::new);
public static final RegistryObject<Item> ABEKIRI = REGISTRY.register("abekiri", () -> new AbekiriItem()); public static final RegistryObject<Item> ABEKIRI = REGISTRY.register("abekiri", AbekiriItem::new);
public static final RegistryObject<Item> TRACHELIUM = REGISTRY.register("trachelium", () -> new TracheliumItem()); public static final RegistryObject<Item> TRACHELIUM = REGISTRY.register("trachelium", TracheliumItem::new);
public static final RegistryObject<Item> VECTOR = REGISTRY.register("vector", () -> new VectorItem()); public static final RegistryObject<Item> VECTOR = REGISTRY.register("vector", VectorItem::new);
public static final RegistryObject<Item> AK_47 = REGISTRY.register("ak_47", () -> new AK47Item()); public static final RegistryObject<Item> AK_47 = REGISTRY.register("ak_47", AK47Item::new);
public static final RegistryObject<Item> SKS = REGISTRY.register("sks", () -> new SksItem()); public static final RegistryObject<Item> SKS = REGISTRY.register("sks", SksItem::new);
public static final RegistryObject<Item> M_4 = REGISTRY.register("m_4", () -> new M4Item()); public static final RegistryObject<Item> M_4 = REGISTRY.register("m_4", M4Item::new);
public static final RegistryObject<Item> HK_416 = REGISTRY.register("hk_416", () -> new Hk416Item()); public static final RegistryObject<Item> HK_416 = REGISTRY.register("hk_416", Hk416Item::new);
public static final RegistryObject<Item> MK_14 = REGISTRY.register("mk_14", () -> new Mk14Item()); public static final RegistryObject<Item> MK_14 = REGISTRY.register("mk_14", Mk14Item::new);
public static final RegistryObject<Item> MARLIN = REGISTRY.register("marlin", () -> new MarlinItem()); public static final RegistryObject<Item> MARLIN = REGISTRY.register("marlin", MarlinItem::new);
public static final RegistryObject<Item> SVD = REGISTRY.register("svd", () -> new SvdItem()); public static final RegistryObject<Item> SVD = REGISTRY.register("svd", SvdItem::new);
public static final RegistryObject<Item> M_98B = REGISTRY.register("m_98b", () -> new M98bItem()); public static final RegistryObject<Item> M_98B = REGISTRY.register("m_98b", M98bItem::new);
public static final RegistryObject<Item> SENTINEL = REGISTRY.register("sentinel", () -> new SentinelItem()); public static final RegistryObject<Item> SENTINEL = REGISTRY.register("sentinel", SentinelItem::new);
public static final RegistryObject<Item> HUNTING_RIFLE = REGISTRY.register("hunting_rifle", () -> new HuntingRifleItem()); public static final RegistryObject<Item> HUNTING_RIFLE = REGISTRY.register("hunting_rifle", HuntingRifleItem::new);
public static final RegistryObject<Item> KRABER = REGISTRY.register("kraber", () -> new KraberItem()); public static final RegistryObject<Item> KRABER = REGISTRY.register("kraber", KraberItem::new);
public static final RegistryObject<Item> M_870 = REGISTRY.register("m_870", () -> new M870Item()); public static final RegistryObject<Item> M_870 = REGISTRY.register("m_870", M870Item::new);
public static final RegistryObject<Item> AA_12 = REGISTRY.register("aa_12", () -> new Aa12Item()); public static final RegistryObject<Item> AA_12 = REGISTRY.register("aa_12", Aa12Item::new);
public static final RegistryObject<Item> DEVOTION = REGISTRY.register("devotion", () -> new DevotionItem()); public static final RegistryObject<Item> DEVOTION = REGISTRY.register("devotion", DevotionItem::new);
public static final RegistryObject<Item> RPK = REGISTRY.register("rpk", () -> new RpkItem()); public static final RegistryObject<Item> RPK = REGISTRY.register("rpk", RpkItem::new);
public static final RegistryObject<Item> M_60 = REGISTRY.register("m_60", () -> new M60Item()); public static final RegistryObject<Item> M_60 = REGISTRY.register("m_60", M60Item::new);
public static final RegistryObject<Item> MINIGUN = REGISTRY.register("minigun", () -> new MinigunItem()); public static final RegistryObject<Item> MINIGUN = REGISTRY.register("minigun", MinigunItem::new);
public static final RegistryObject<Item> M_79 = REGISTRY.register("m_79", () -> new M79Item()); public static final RegistryObject<Item> M_79 = REGISTRY.register("m_79", M79Item::new);
public static final RegistryObject<Item> RPG = REGISTRY.register("rpg", () -> new RpgItem()); public static final RegistryObject<Item> RPG = REGISTRY.register("rpg", RpgItem::new);
public static final RegistryObject<Item> BOCEK = REGISTRY.register("bocek", () -> new BocekItem()); public static final RegistryObject<Item> BOCEK = REGISTRY.register("bocek", BocekItem::new);
public static final RegistryObject<Item> SENPAI_SPAWN_EGG = REGISTRY.register("senpai_spawn_egg", () -> new ForgeSpawnEggItem(TargetModEntities.SENPAI, -11584987, -14014413, new Item.Properties())); public static final RegistryObject<Item> SENPAI_SPAWN_EGG = REGISTRY.register("senpai_spawn_egg", () -> new ForgeSpawnEggItem(TargetModEntities.SENPAI, -11584987, -14014413, new Item.Properties()));
public static final RegistryObject<Item> TARGETDEPLOYER = REGISTRY.register("targetdeployer", () -> new TargetdeployerItem()); public static final RegistryObject<Item> TARGETDEPLOYER = REGISTRY.register("targetdeployer", TargetdeployerItem::new);
public static final RegistryObject<Item> SANDBAG = block(TargetModBlocks.SANDBAG); public static final RegistryObject<Item> SANDBAG = block(TargetModBlocks.SANDBAG);
public static final RegistryObject<Item> BARBED_WIRE = block(TargetModBlocks.BARBED_WIRE); public static final RegistryObject<Item> BARBED_WIRE = block(TargetModBlocks.BARBED_WIRE);
public static final RegistryObject<Item> CLAYMORE_MINE = REGISTRY.register("claymore_mine", () -> new ClaymoreMineItem()); public static final RegistryObject<Item> CLAYMORE_MINE = REGISTRY.register("claymore_mine", ClaymoreMineItem::new);
public static final RegistryObject<Item> JUMPPAD_BLOCK = block(TargetModBlocks.JUMPPAD_BLOCK); public static final RegistryObject<Item> JUMPPAD_BLOCK = block(TargetModBlocks.JUMPPAD_BLOCK);
public static final RegistryObject<Item> LIGHT_SABER = REGISTRY.register("light_saber", () -> new LightSaberItem()); public static final RegistryObject<Item> LIGHT_SABER = REGISTRY.register("light_saber", LightSaberItem::new);
public static final RegistryObject<Item> HAMMER = REGISTRY.register("hammer", () -> new HammerItem()); public static final RegistryObject<Item> HAMMER = REGISTRY.register("hammer", HammerItem::new);
public static final RegistryObject<Item> MORTAR_DEPOLYER = REGISTRY.register("mortar_depolyer", () -> new MortarDepolyerItem()); public static final RegistryObject<Item> MORTAR_DEPOLYER = REGISTRY.register("mortar_depolyer", MortarDepolyerItem::new);
public static final RegistryObject<Item> MORTARBARREL = REGISTRY.register("mortarbarrel", () -> new MortarbarrelItem()); public static final RegistryObject<Item> MORTARBARREL = REGISTRY.register("mortarbarrel", MortarbarrelItem::new);
public static final RegistryObject<Item> MORATR_BASE_PLATE = REGISTRY.register("moratr_base_plate", () -> new MoratrBasePlateItem()); public static final RegistryObject<Item> MORATR_BASE_PLATE = REGISTRY.register("moratr_base_plate", MoratrBasePlateItem::new);
public static final RegistryObject<Item> MORTARBIPOD = REGISTRY.register("mortarbipod", () -> new MortarbipodItem()); public static final RegistryObject<Item> MORTARBIPOD = REGISTRY.register("mortarbipod", MortarbipodItem::new);
public static final RegistryObject<Item> FUSEE = REGISTRY.register("fusee", () -> new FuseeItem()); public static final RegistryObject<Item> FUSEE = REGISTRY.register("fusee", FuseeItem::new);
public static final RegistryObject<Item> SOULSTEELNUGGET = REGISTRY.register("soulsteelnugget", () -> new SoulsteelnuggetItem()); public static final RegistryObject<Item> SOULSTEELNUGGET = REGISTRY.register("soulsteelnugget", SoulsteelnuggetItem::new);
public static final RegistryObject<Item> COPPERPLATE = REGISTRY.register("copperplate", () -> new CopperplateItem()); public static final RegistryObject<Item> COPPERPLATE = REGISTRY.register("copperplate", CopperplateItem::new);
public static final RegistryObject<Item> INGOT_STEEL = REGISTRY.register("ingot_steel", () -> new IngotSteelItem()); public static final RegistryObject<Item> INGOT_STEEL = REGISTRY.register("ingot_steel", IngotSteelItem::new);
public static final RegistryObject<Item> LEAD_INGOT = REGISTRY.register("lead_ingot", () -> new LeadIngotItem()); public static final RegistryObject<Item> LEAD_INGOT = REGISTRY.register("lead_ingot", LeadIngotItem::new);
public static final RegistryObject<Item> TUNGSTEN_INGOT = REGISTRY.register("tungsten_ingot", () -> new TungstenIngotItem()); public static final RegistryObject<Item> TUNGSTEN_INGOT = REGISTRY.register("tungsten_ingot", TungstenIngotItem::new);
public static final RegistryObject<Item> CEMENTED_CARBIDE_INGOT = REGISTRY.register("cemented_carbide_ingot", () -> new CementedCarbideIngotItem()); public static final RegistryObject<Item> CEMENTED_CARBIDE_INGOT = REGISTRY.register("cemented_carbide_ingot", CementedCarbideIngotItem::new);
public static final RegistryObject<Item> SOULSTEEL_INGOT = REGISTRY.register("soulsteel_ingot", () -> new SoulsteelIngotItem()); public static final RegistryObject<Item> SOULSTEEL_INGOT = REGISTRY.register("soulsteel_ingot", SoulsteelIngotItem::new);
public static final RegistryObject<Item> IRON_POWDER = REGISTRY.register("iron_powder", () -> new IronPowderItem()); public static final RegistryObject<Item> IRON_POWDER = REGISTRY.register("iron_powder", IronPowderItem::new);
public static final RegistryObject<Item> TUNGSTEN_POWDER = REGISTRY.register("tungsten_powder", () -> new TungstenPowderItem()); public static final RegistryObject<Item> TUNGSTEN_POWDER = REGISTRY.register("tungsten_powder", TungstenPowderItem::new);
public static final RegistryObject<Item> COAL_POWDER = REGISTRY.register("coal_powder", () -> new CoalPowderItem()); public static final RegistryObject<Item> COAL_POWDER = REGISTRY.register("coal_powder", CoalPowderItem::new);
public static final RegistryObject<Item> COAL_IRON_POWDER = REGISTRY.register("coal_iron_powder", () -> new CoalIronPowderItem()); public static final RegistryObject<Item> COAL_IRON_POWDER = REGISTRY.register("coal_iron_powder", CoalIronPowderItem::new);
public static final RegistryObject<Item> UNBLASTEDCEMENTEDCARBIDEPODWER = REGISTRY.register("unblastedcementedcarbidepodwer", () -> new UnblastedcementedcarbidepodwerItem()); public static final RegistryObject<Item> UNBLASTEDCEMENTEDCARBIDEPODWER = REGISTRY.register("unblastedcementedcarbidepodwer", UnblastedcementedcarbidepodwerItem::new);
public static final RegistryObject<Item> GALENA_ORE = block(TargetModBlocks.GALENA_ORE); public static final RegistryObject<Item> GALENA_ORE = block(TargetModBlocks.GALENA_ORE);
public static final RegistryObject<Item> DEEPSLATE_GALENA_ORE = block(TargetModBlocks.DEEPSLATE_GALENA_ORE); public static final RegistryObject<Item> DEEPSLATE_GALENA_ORE = block(TargetModBlocks.DEEPSLATE_GALENA_ORE);
public static final RegistryObject<Item> SCHEELITE_ORE = block(TargetModBlocks.SCHEELITE_ORE); public static final RegistryObject<Item> SCHEELITE_ORE = block(TargetModBlocks.SCHEELITE_ORE);
public static final RegistryObject<Item> DEEPSLATE_SCHEELITE_ORE = block(TargetModBlocks.DEEPSLATE_SCHEELITE_ORE); public static final RegistryObject<Item> DEEPSLATE_SCHEELITE_ORE = block(TargetModBlocks.DEEPSLATE_SCHEELITE_ORE);
public static final RegistryObject<Item> GALENA = REGISTRY.register("galena", () -> new GalenaItem()); public static final RegistryObject<Item> GALENA = REGISTRY.register("galena", GalenaItem::new);
public static final RegistryObject<Item> SCHEELITE = REGISTRY.register("scheelite", () -> new ScheeliteItem()); public static final RegistryObject<Item> SCHEELITE = REGISTRY.register("scheelite", ScheeliteItem::new);
public static final RegistryObject<Item> BUCKSHOT = REGISTRY.register("buckshot", () -> new BuckshotItem()); public static final RegistryObject<Item> BUCKSHOT = REGISTRY.register("buckshot", BuckshotItem::new);
public static final RegistryObject<Item> IRON_BARREL = REGISTRY.register("iron_barrel", () -> new IronBarrelItem()); public static final RegistryObject<Item> IRON_BARREL = REGISTRY.register("iron_barrel", IronBarrelItem::new);
public static final RegistryObject<Item> IRON_ACTION = REGISTRY.register("iron_action", () -> new IronActionItem()); public static final RegistryObject<Item> IRON_ACTION = REGISTRY.register("iron_action", IronActionItem::new);
public static final RegistryObject<Item> IRON_TRIGGER = REGISTRY.register("iron_trigger", () -> new IronTriggerItem()); public static final RegistryObject<Item> IRON_TRIGGER = REGISTRY.register("iron_trigger", IronTriggerItem::new);
public static final RegistryObject<Item> IRON_SPRING = REGISTRY.register("iron_spring", () -> new IronSpringItem()); public static final RegistryObject<Item> IRON_SPRING = REGISTRY.register("iron_spring", IronSpringItem::new);
public static final RegistryObject<Item> STEEL_BARREL = REGISTRY.register("steel_barrel", () -> new SteelBarrelItem()); public static final RegistryObject<Item> STEEL_BARREL = REGISTRY.register("steel_barrel", SteelBarrelItem::new);
public static final RegistryObject<Item> STEEL_ACTION = REGISTRY.register("steel_action", () -> new SteelActionItem()); public static final RegistryObject<Item> STEEL_ACTION = REGISTRY.register("steel_action", SteelActionItem::new);
public static final RegistryObject<Item> STEEL_TRIGGER = REGISTRY.register("steel_trigger", () -> new SteelTriggerItem()); public static final RegistryObject<Item> STEEL_TRIGGER = REGISTRY.register("steel_trigger", SteelTriggerItem::new);
public static final RegistryObject<Item> STEEL_SPRING = REGISTRY.register("steel_spring", () -> new SteelSpringItem()); public static final RegistryObject<Item> STEEL_SPRING = REGISTRY.register("steel_spring", SteelSpringItem::new);
public static final RegistryObject<Item> CEMENTED_CARBIDE_BARREL = REGISTRY.register("cemented_carbide_barrel", () -> new CementedCarbideBarrelItem()); public static final RegistryObject<Item> CEMENTED_CARBIDE_BARREL = REGISTRY.register("cemented_carbide_barrel", CementedCarbideBarrelItem::new);
public static final RegistryObject<Item> CEMENTED_CARBIDE_ACTION = REGISTRY.register("cemented_carbide_action", () -> new CementedCarbideActionItem()); public static final RegistryObject<Item> CEMENTED_CARBIDE_ACTION = REGISTRY.register("cemented_carbide_action", CementedCarbideActionItem::new);
public static final RegistryObject<Item> CEMENTEDCARBIDE_TRIGGER = REGISTRY.register("cementedcarbide_trigger", () -> new CementedcarbideTriggerItem()); public static final RegistryObject<Item> CEMENTEDCARBIDE_TRIGGER = REGISTRY.register("cementedcarbide_trigger", CementedcarbideTriggerItem::new);
public static final RegistryObject<Item> CEMENTEDCARBIDESPRING = REGISTRY.register("cementedcarbidespring", () -> new CementedcarbidespringItem()); public static final RegistryObject<Item> CEMENTEDCARBIDESPRING = REGISTRY.register("cementedcarbidespring", CementedcarbidespringItem::new);
public static final RegistryObject<Item> NETHERITE_BARREL = REGISTRY.register("netherite_barrel", () -> new NetheriteBarrelItem()); public static final RegistryObject<Item> NETHERITE_BARREL = REGISTRY.register("netherite_barrel", NetheriteBarrelItem::new);
public static final RegistryObject<Item> NETHERITE_ACTION = REGISTRY.register("netherite_action", () -> new NetheriteActionItem()); public static final RegistryObject<Item> NETHERITE_ACTION = REGISTRY.register("netherite_action", NetheriteActionItem::new);
public static final RegistryObject<Item> NETHERITE_TRIGGER = REGISTRY.register("netherite_trigger", () -> new NetheriteTriggerItem()); public static final RegistryObject<Item> NETHERITE_TRIGGER = REGISTRY.register("netherite_trigger", NetheriteTriggerItem::new);
public static final RegistryObject<Item> NETHERITE_SPRING = REGISTRY.register("netherite_spring", () -> new NetheriteSpringItem()); public static final RegistryObject<Item> NETHERITE_SPRING = REGISTRY.register("netherite_spring", NetheriteSpringItem::new);
public static final RegistryObject<Item> COMMONMATERIALPACK = REGISTRY.register("commonmaterialpack", () -> new CommonmaterialpackItem()); public static final RegistryObject<Item> COMMONMATERIALPACK = REGISTRY.register("commonmaterialpack", CommonmaterialpackItem::new);
public static final RegistryObject<Item> RAREMATERIALPACK = REGISTRY.register("rarematerialpack", () -> new RarematerialpackItem()); public static final RegistryObject<Item> RAREMATERIALPACK = REGISTRY.register("rarematerialpack", RarematerialpackItem::new);
public static final RegistryObject<Item> EPICMATERIALPACK = REGISTRY.register("epicmaterialpack", () -> new EpicmaterialpackItem()); public static final RegistryObject<Item> EPICMATERIALPACK = REGISTRY.register("epicmaterialpack", EpicmaterialpackItem::new);
public static final RegistryObject<Item> LEGENDARYMATERIALPACK = REGISTRY.register("legendarymaterialpack", () -> new LegendarymaterialpackItem()); public static final RegistryObject<Item> LEGENDARYMATERIALPACK = REGISTRY.register("legendarymaterialpack", LegendarymaterialpackItem::new);
public static final RegistryObject<Item> SPECIALMATERIALPACK = REGISTRY.register("specialmaterialpack", () -> new SpecialmaterialpackItem()); public static final RegistryObject<Item> SPECIALMATERIALPACK = REGISTRY.register("specialmaterialpack", SpecialmaterialpackItem::new);
public static final RegistryObject<Item> TRACHELIUM_BLUEPRINT = REGISTRY.register("trachelium_blueprint", () -> new TracheliumBlueprintItem()); public static final RegistryObject<Item> TRACHELIUM_BLUEPRINT = REGISTRY.register("trachelium_blueprint", TracheliumBlueprintItem::new);
public static final RegistryObject<Item> HUNTING_RIFLE_BLUEPRINT = REGISTRY.register("hunting_rifle_blueprint", () -> new HuntingRifleBlueprintItem()); public static final RegistryObject<Item> HUNTING_RIFLE_BLUEPRINT = REGISTRY.register("hunting_rifle_blueprint", HuntingRifleBlueprintItem::new);
public static final RegistryObject<Item> M_79_BLUEPRINT = REGISTRY.register("m_79_blueprint", () -> new M79BlueprintItem()); public static final RegistryObject<Item> M_79_BLUEPRINT = REGISTRY.register("m_79_blueprint", M79BlueprintItem::new);
public static final RegistryObject<Item> RPG_BLUEPRINT = REGISTRY.register("rpg_blueprint", () -> new RpgBlueprintItem()); public static final RegistryObject<Item> RPG_BLUEPRINT = REGISTRY.register("rpg_blueprint", RpgBlueprintItem::new);
public static final RegistryObject<Item> BOCEK_BLUEPRINT = REGISTRY.register("bocek_blueprint", () -> new BocekBlueprintItem()); public static final RegistryObject<Item> BOCEK_BLUEPRINT = REGISTRY.register("bocek_blueprint", BocekBlueprintItem::new);
public static final RegistryObject<Item> M_4_BLUEPRINT = REGISTRY.register("m_4_blueprint", () -> new M4BlueprintItem()); public static final RegistryObject<Item> M_4_BLUEPRINT = REGISTRY.register("m_4_blueprint", M4BlueprintItem::new);
public static final RegistryObject<Item> AA_12_BLUEPRINT = REGISTRY.register("aa_12_blueprint", () -> new Aa12BlueprintItem()); public static final RegistryObject<Item> AA_12_BLUEPRINT = REGISTRY.register("aa_12_blueprint", Aa12BlueprintItem::new);
public static final RegistryObject<Item> HK_416_BLUEPRINT = REGISTRY.register("hk_416_blueprint", () -> new HK416BlueprintItem()); public static final RegistryObject<Item> HK_416_BLUEPRINT = REGISTRY.register("hk_416_blueprint", HK416BlueprintItem::new);
public static final RegistryObject<Item> RPK_BLUEPRINT = REGISTRY.register("rpk_blueprint", () -> new RPKBlueprintItem()); public static final RegistryObject<Item> RPK_BLUEPRINT = REGISTRY.register("rpk_blueprint", RPKBlueprintItem::new);
public static final RegistryObject<Item> SKS_BLUEPRINT = REGISTRY.register("sks_blueprint", () -> new SKSBlueprintItem()); public static final RegistryObject<Item> SKS_BLUEPRINT = REGISTRY.register("sks_blueprint", SKSBlueprintItem::new);
public static final RegistryObject<Item> KRABER_BLUEPRINT = REGISTRY.register("kraber_blueprint", () -> new KRABERBlueprintItem()); public static final RegistryObject<Item> KRABER_BLUEPRINT = REGISTRY.register("kraber_blueprint", KRABERBlueprintItem::new);
public static final RegistryObject<Item> VECTOR_BLUEPRINT = REGISTRY.register("vector_blueprint", () -> new VectorBlueprintItem()); public static final RegistryObject<Item> VECTOR_BLUEPRINT = REGISTRY.register("vector_blueprint", VectorBlueprintItem::new);
public static final RegistryObject<Item> MINIGUN_BLUEPRINT = REGISTRY.register("minigun_blueprint", () -> new MinigunBlueprintItem()); public static final RegistryObject<Item> MINIGUN_BLUEPRINT = REGISTRY.register("minigun_blueprint", MinigunBlueprintItem::new);
public static final RegistryObject<Item> MK_14_BLUEPRINT = REGISTRY.register("mk_14_blueprint", () -> new Mk14BlueprintItem()); public static final RegistryObject<Item> MK_14_BLUEPRINT = REGISTRY.register("mk_14_blueprint", Mk14BlueprintItem::new);
public static final RegistryObject<Item> SENTINEL_BLUEPRINT = REGISTRY.register("sentinel_blueprint", () -> new SentinelBlueprintItem()); public static final RegistryObject<Item> SENTINEL_BLUEPRINT = REGISTRY.register("sentinel_blueprint", SentinelBlueprintItem::new);
public static final RegistryObject<Item> M_60_BLUEPRINT = REGISTRY.register("m_60_blueprint", () -> new M60BlueprintItem()); public static final RegistryObject<Item> M_60_BLUEPRINT = REGISTRY.register("m_60_blueprint", M60BlueprintItem::new);
public static final RegistryObject<Item> SVD_BLUEPRINT = REGISTRY.register("svd_blueprint", () -> new SvdBlueprintItem()); public static final RegistryObject<Item> SVD_BLUEPRINT = REGISTRY.register("svd_blueprint", SvdBlueprintItem::new);
public static final RegistryObject<Item> MARLIN_BLUEPRINT = REGISTRY.register("marlin_blueprint", () -> new MarlinBlueprintItem()); public static final RegistryObject<Item> MARLIN_BLUEPRINT = REGISTRY.register("marlin_blueprint", MarlinBlueprintItem::new);
public static final RegistryObject<Item> M_870_BLUEPRINT = REGISTRY.register("m_870_blueprint", () -> new M870BlueprintItem()); public static final RegistryObject<Item> M_870_BLUEPRINT = REGISTRY.register("m_870_blueprint", M870BlueprintItem::new);
public static final RegistryObject<Item> M_98B_BLUEPRINT = REGISTRY.register("m_98b_blueprint", () -> new M98bBlueprintItem()); public static final RegistryObject<Item> M_98B_BLUEPRINT = REGISTRY.register("m_98b_blueprint", M98bBlueprintItem::new);
public static final RegistryObject<Item> AK_47_BLUEPRINT = REGISTRY.register("ak_47_blueprint", () -> new AK47BlueprintItem()); public static final RegistryObject<Item> AK_47_BLUEPRINT = REGISTRY.register("ak_47_blueprint", AK47BlueprintItem::new);
public static final RegistryObject<Item> DEVOTION_BLUPRINT = REGISTRY.register("devotion_bluprint", () -> new DevotionBluprintItem()); public static final RegistryObject<Item> DEVOTION_BLUPRINT = REGISTRY.register("devotion_bluprint", DevotionBluprintItem::new);
public static final RegistryObject<Item> TASER_BLUEPRINT = REGISTRY.register("taser_blueprint", () -> new TaserBlueprintItem()); public static final RegistryObject<Item> TASER_BLUEPRINT = REGISTRY.register("taser_blueprint", TaserBlueprintItem::new);
public static final RegistryObject<Item> GUN_RECYCLE = block(TargetModBlocks.GUN_RECYCLE); public static final RegistryObject<Item> GUN_RECYCLE = block(TargetModBlocks.GUN_RECYCLE);
public static final RegistryObject<Item> HANDGUN_AMMO = REGISTRY.register("handgun_ammo", () -> new HandgunAmmoItem()); public static final RegistryObject<Item> HANDGUN_AMMO = REGISTRY.register("handgun_ammo", HandgunAmmoItem::new);
public static final RegistryObject<Item> RIFLE_AMMO = REGISTRY.register("rifle_ammo", () -> new RifleAmmoItem()); public static final RegistryObject<Item> RIFLE_AMMO = REGISTRY.register("rifle_ammo", RifleAmmoItem::new);
public static final RegistryObject<Item> SNIPER_AMMO = REGISTRY.register("sniper_ammo", () -> new SniperAmmoItem()); public static final RegistryObject<Item> SNIPER_AMMO = REGISTRY.register("sniper_ammo", SniperAmmoItem::new);
public static final RegistryObject<Item> SHOTGUN_AMMO = REGISTRY.register("shotgun_ammo", () -> new ShotgunAmmoItem()); public static final RegistryObject<Item> SHOTGUN_AMMO = REGISTRY.register("shotgun_ammo", ShotgunAmmoItem::new);
public static final RegistryObject<Item> HANDGUN_AMMO_BOX = REGISTRY.register("handgun_ammo_box", () -> new HandgunAmmoBoxItem()); public static final RegistryObject<Item> HANDGUN_AMMO_BOX = REGISTRY.register("handgun_ammo_box", HandgunAmmoBoxItem::new);
public static final RegistryObject<Item> RIFLE_AMMO_BOX = REGISTRY.register("rifle_ammo_box", () -> new RifleAmmoBoxItem()); public static final RegistryObject<Item> RIFLE_AMMO_BOX = REGISTRY.register("rifle_ammo_box", RifleAmmoBoxItem::new);
public static final RegistryObject<Item> SNIPER_AMMO_BOX = REGISTRY.register("sniper_ammo_box", () -> new SniperAmmoBoxItem()); public static final RegistryObject<Item> SNIPER_AMMO_BOX = REGISTRY.register("sniper_ammo_box", SniperAmmoBoxItem::new);
public static final RegistryObject<Item> SHOTGUN_AMMO_BOX = REGISTRY.register("shotgun_ammo_box", () -> new ShotgunAmmoBoxItem()); public static final RegistryObject<Item> SHOTGUN_AMMO_BOX = REGISTRY.register("shotgun_ammo_box", ShotgunAmmoBoxItem::new);
public static final RegistryObject<Item> CREATIVE_AMMO_BOX = REGISTRY.register("creative_ammo_box", () -> new CreativeAmmoBoxItem()); public static final RegistryObject<Item> CREATIVE_AMMO_BOX = REGISTRY.register("creative_ammo_box", CreativeAmmoBoxItem::new);
public static final RegistryObject<Item> TASER_ELECTRODE = REGISTRY.register("taser_electrode", () -> new TaserElectrodeItem()); public static final RegistryObject<Item> TASER_ELECTRODE = REGISTRY.register("taser_electrode", TaserElectrodeItem::new);
public static final RegistryObject<Item> GRENADE_40MM = REGISTRY.register("grenade_40mm", () -> new Grenade40mmItem()); public static final RegistryObject<Item> GRENADE_40MM = REGISTRY.register("grenade_40mm", Grenade40mmItem::new);
public static final RegistryObject<Item> MORTAR_SHELLS = REGISTRY.register("mortar_shells", () -> new MortarShellsItem()); public static final RegistryObject<Item> MORTAR_SHELLS = REGISTRY.register("mortar_shells", MortarShellsItem::new);
public static final RegistryObject<Item> ROCKET = REGISTRY.register("rocket", () -> new RocketItem()); public static final RegistryObject<Item> ROCKET = REGISTRY.register("rocket", RocketItem::new);
private static RegistryObject<Item> block(RegistryObject<Block> block) { private static RegistryObject<Item> block(RegistryObject<Block> block) {
return REGISTRY.register(block.getId().getPath(), () -> new BlockItem(block.get(), new Item.Properties())); return REGISTRY.register(block.getId().getPath(), () -> new BlockItem(block.get(), new Item.Properties()));

View file

@ -4,24 +4,20 @@
*/ */
package net.mcreator.target.init; package net.mcreator.target.init;
import org.lwjgl.glfw.GLFW;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraft.client.Minecraft;
import net.minecraft.client.KeyMapping;
import net.mcreator.target.network.ZoomMessage;
import net.mcreator.target.network.ReloadMessage;
import net.mcreator.target.network.FiremodeMessage;
import net.mcreator.target.network.DoublejumpinputMessage;
import net.mcreator.target.TargetMod;
import com.mojang.blaze3d.platform.InputConstants; import com.mojang.blaze3d.platform.InputConstants;
import net.mcreator.target.TargetMod;
import net.mcreator.target.network.DoublejumpinputMessage;
import net.mcreator.target.network.FiremodeMessage;
import net.mcreator.target.network.ReloadMessage;
import net.mcreator.target.network.ZoomMessage;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import org.lwjgl.glfw.GLFW;
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, value = {Dist.CLIENT}) @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, value = {Dist.CLIENT})
public class TargetModKeyMappings { public class TargetModKeyMappings {
@ -74,7 +70,7 @@ public class TargetModKeyMappings {
TargetMod.PACKET_HANDLER.sendToServer(new ZoomMessage(0, 0)); TargetMod.PACKET_HANDLER.sendToServer(new ZoomMessage(0, 0));
ZoomMessage.pressAction(Minecraft.getInstance().player, 0, 0); ZoomMessage.pressAction(Minecraft.getInstance().player, 0, 0);
ZOOM_LASTPRESS = System.currentTimeMillis(); ZOOM_LASTPRESS = System.currentTimeMillis();
} else if (isDownOld != isDown && !isDown) { } else if (isDownOld != isDown) {
int dt = (int) (System.currentTimeMillis() - ZOOM_LASTPRESS); int dt = (int) (System.currentTimeMillis() - ZOOM_LASTPRESS);
TargetMod.PACKET_HANDLER.sendToServer(new ZoomMessage(1, dt)); TargetMod.PACKET_HANDLER.sendToServer(new ZoomMessage(1, dt));
ZoomMessage.pressAction(Minecraft.getInstance().player, 1, dt); ZoomMessage.pressAction(Minecraft.getInstance().player, 1, dt);

View file

@ -1,34 +1,27 @@
package net.mcreator.target.init; package net.mcreator.target.init;
import org.checkerframework.checker.units.qual.m; import com.google.common.base.Suppliers;
import com.mojang.serialization.Codec;
import net.minecraftforge.registries.RegistryObject; import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraftforge.registries.ForgeRegistries; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.event.lifecycle.FMLConstructModEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.common.loot.LootModifier;
import net.minecraftforge.common.loot.IGlobalLootModifier;
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.item.ItemStack;
import net.minecraft.resources.ResourceLocation;
import net.mcreator.target.TargetMod; import net.mcreator.target.TargetMod;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition;
import net.minecraftforge.common.loot.IGlobalLootModifier;
import net.minecraftforge.common.loot.LootModifier;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLConstructModEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
import java.util.function.Supplier; import java.util.function.Supplier;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.mojang.serialization.Codec;
import com.google.common.base.Suppliers;
@Mod.EventBusSubscriber(modid = TargetMod.MODID, bus = Mod.EventBusSubscriber.Bus.MOD) @Mod.EventBusSubscriber(modid = TargetMod.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class TargetModLootModifier { public class TargetModLootModifier {
public static class TargetModLootTableModifier extends LootModifier { public static class TargetModLootTableModifier extends LootModifier {

View file

@ -4,16 +4,14 @@
*/ */
package net.mcreator.target.init; package net.mcreator.target.init;
import net.minecraftforge.registries.RegistryObject;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.common.extensions.IForgeMenuType;
import net.minecraft.world.inventory.MenuType;
import net.mcreator.target.world.inventory.MortarGUIMenu;
import net.mcreator.target.world.inventory.GunRecycleGuiMenu;
import net.mcreator.target.TargetMod; import net.mcreator.target.TargetMod;
import net.mcreator.target.world.inventory.GunRecycleGuiMenu;
import net.mcreator.target.world.inventory.MortarGUIMenu;
import net.minecraft.world.inventory.MenuType;
import net.minecraftforge.common.extensions.IForgeMenuType;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
public class TargetModMenus { public class TargetModMenus {
public static final DeferredRegister<MenuType<?>> REGISTRY = DeferredRegister.create(ForgeRegistries.MENU_TYPES, TargetMod.MODID); public static final DeferredRegister<MenuType<?>> REGISTRY = DeferredRegister.create(ForgeRegistries.MENU_TYPES, TargetMod.MODID);

View file

@ -4,16 +4,14 @@
*/ */
package net.mcreator.target.init; package net.mcreator.target.init;
import net.minecraftforge.registries.RegistryObject;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraft.world.effect.MobEffect;
import net.mcreator.target.potion.ShockMobEffect;
import net.mcreator.target.TargetMod; import net.mcreator.target.TargetMod;
import net.mcreator.target.potion.ShockMobEffect;
import net.minecraft.world.effect.MobEffect;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
public class TargetModMobEffects { public class TargetModMobEffects {
public static final DeferredRegister<MobEffect> REGISTRY = DeferredRegister.create(ForgeRegistries.MOB_EFFECTS, TargetMod.MODID); public static final DeferredRegister<MobEffect> REGISTRY = DeferredRegister.create(ForgeRegistries.MOB_EFFECTS, TargetMod.MODID);
public static final RegistryObject<MobEffect> SHOCK = REGISTRY.register("shock", () -> new ShockMobEffect()); public static final RegistryObject<MobEffect> SHOCK = REGISTRY.register("shock", ShockMobEffect::new);
} }

View file

@ -4,18 +4,11 @@
*/ */
package net.mcreator.target.init; package net.mcreator.target.init;
import net.minecraftforge.fml.common.Mod; import net.mcreator.target.client.model.*;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.client.event.EntityRenderersEvent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.EntityRenderersEvent;
import net.mcreator.target.client.model.Modeltaser_rod; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.mcreator.target.client.model.Modelrpg7_rocket_Converted; import net.minecraftforge.fml.common.Mod;
import net.mcreator.target.client.model.Modelmortar_shell_Converted;
import net.mcreator.target.client.model.Modelclaymore;
import net.mcreator.target.client.model.Modelbullet;
import net.mcreator.target.client.model.Modelbocekarrow;
import net.mcreator.target.client.model.ModelGrenade;
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, value = {Dist.CLIENT}) @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, value = {Dist.CLIENT})
public class TargetModModels { public class TargetModModels {

View file

@ -1,14 +1,11 @@
package net.mcreator.target.init; package net.mcreator.target.init;
import net.minecraftforge.registries.RegistryObject;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraft.core.particles.ParticleType;
import net.mcreator.target.TargetMod; import net.mcreator.target.TargetMod;
import net.minecraft.core.particles.ParticleType;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
public class TargetModParticleTypes { public class TargetModParticleTypes {
public static final DeferredRegister<ParticleType<?>> REGISTRY = DeferredRegister.create(ForgeRegistries.PARTICLE_TYPES, TargetMod.MODID); public static final DeferredRegister<ParticleType<?>> REGISTRY = DeferredRegister.create(ForgeRegistries.PARTICLE_TYPES, TargetMod.MODID);

View file

@ -1,13 +1,11 @@
package net.mcreator.target.init; package net.mcreator.target.init;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.client.event.RegisterParticleProvidersEvent;
import net.minecraftforge.api.distmarker.Dist;
import net.mcreator.target.client.particle.FirestarParticle;
import net.mcreator.target.client.particle.BulltholeParticle; import net.mcreator.target.client.particle.BulltholeParticle;
import net.mcreator.target.client.particle.FirestarParticle;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.RegisterParticleProvidersEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public class TargetModParticles { public class TargetModParticles {

View file

@ -4,15 +4,13 @@
*/ */
package net.mcreator.target.init; package net.mcreator.target.init;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraft.client.gui.screens.MenuScreens;
import net.mcreator.target.client.gui.MortarGUIScreen;
import net.mcreator.target.client.gui.GunRecycleGuiScreen; import net.mcreator.target.client.gui.GunRecycleGuiScreen;
import net.mcreator.target.client.gui.MortarGUIScreen;
import net.minecraft.client.gui.screens.MenuScreens;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public class TargetModScreens { public class TargetModScreens {

View file

@ -4,14 +4,12 @@
*/ */
package net.mcreator.target.init; package net.mcreator.target.init;
import net.minecraftforge.registries.RegistryObject;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.resources.ResourceLocation;
import net.mcreator.target.TargetMod; import net.mcreator.target.TargetMod;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
public class TargetModSounds { public class TargetModSounds {
public static final DeferredRegister<SoundEvent> REGISTRY = DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, TargetMod.MODID); public static final DeferredRegister<SoundEvent> REGISTRY = DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, TargetMod.MODID);

View file

@ -4,19 +4,17 @@
*/ */
package net.mcreator.target.init; package net.mcreator.target.init;
import net.minecraftforge.registries.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.network.chat.Component;
import net.minecraft.core.registries.Registries;
import net.mcreator.target.TargetMod; import net.mcreator.target.TargetMod;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public class TargetModTabs { public class TargetModTabs {

View file

@ -1,17 +1,16 @@
/* /*
* MCreator note: This file will be REGENERATED on each build. * MCreator note: This file will be REGENERATED on each build.
*/ */
package net.mcreator.target.init; package net.mcreator.target.init;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.event.village.VillagerTradesEvent;
import net.minecraftforge.common.BasicItemListing;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.entity.npc.VillagerProfession; import net.minecraft.world.entity.npc.VillagerProfession;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraftforge.common.BasicItemListing;
import net.minecraftforge.event.village.VillagerTradesEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.FORGE) @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.FORGE)
public class TargetModTrades { public class TargetModTrades {

View file

@ -1,12 +1,11 @@
package net.mcreator.target.item; package net.mcreator.target.item;
import net.minecraft.world.level.Level;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Item;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import java.util.List; import java.util.List;

View file

@ -1,49 +1,36 @@
package net.mcreator.target.item; package net.mcreator.target.item;
import software.bernie.geckolib.util.GeckoLibUtil;
import software.bernie.geckolib.core.object.PlayState;
import software.bernie.geckolib.core.animation.RawAnimation;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.core.animation.AnimationController;
import software.bernie.geckolib.core.animation.AnimatableManager;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.animatable.GeoItem;
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
import net.minecraft.world.level.Level;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.Item;
import net.minecraft.world.entity.Entity;
import net.minecraft.network.chat.Component;
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.world.entity.HumanoidArm;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.Minecraft;
import com.google.common.collect.HashMultimap; import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import net.mcreator.target.item.renderer.AK47ItemRenderer;
import net.mcreator.target.procedures.AK47WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
import net.minecraft.network.chat.Component;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.Attribute;
import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.world.entity.ai.attributes.AttributeModifier;
import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.*;
import com.google.common.collect.ImmutableMultimap; import net.minecraft.world.level.Level;
import java.util.UUID; import net.minecraftforge.client.extensions.common.IClientItemExtensions;
import software.bernie.geckolib.animatable.GeoItem;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.core.animation.AnimatableManager;
import software.bernie.geckolib.core.animation.AnimationController;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.core.animation.RawAnimation;
import software.bernie.geckolib.core.object.PlayState;
import software.bernie.geckolib.util.GeckoLibUtil;
import net.mcreator.target.procedures.AK47WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure;
import net.mcreator.target.item.renderer.AK47ItemRenderer;
import java.util.function.Consumer;
import java.util.List; import java.util.List;
import java.util.UUID;
import java.util.function.Consumer;
public class AK47Item extends Item implements GeoItem { public class AK47Item extends Item implements GeoItem {
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
@ -73,7 +60,7 @@ public class AK47Item extends Item implements GeoItem {
} }
public void getTransformType(ItemDisplayContext type) { public void getTransformType(ItemDisplayContext type) {
this.transformType = type; transformType = type;
} }
private PlayState idlePredicate(AnimationState event) { private PlayState idlePredicate(AnimationState event) {
@ -82,27 +69,27 @@ public class AK47Item extends Item implements GeoItem {
if (this.animationprocedure.equals("empty")) { if (this.animationprocedure.equals("empty")) {
if (stack.getOrCreateTag().getDouble("drawtime") < 16){ if (stack.getOrCreateTag().getDouble("drawtime") < 16) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ak47.draw")); return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ak47.draw"));
} }
if (stack.getOrCreateTag().getDouble("fireanim") > 0){ if (stack.getOrCreateTag().getDouble("fireanim") > 0) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.fire")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.fire"));
} }
if (stack.getOrCreateTag().getDouble("reloading") == 1 && stack.getOrCreateTag().getDouble("emptyreload") == 1){ if (stack.getOrCreateTag().getDouble("reloading") == 1 && stack.getOrCreateTag().getDouble("emptyreload") == 1) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.reload")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.reload"));
} }
if (stack.getOrCreateTag().getDouble("reloading") == 1 && stack.getOrCreateTag().getDouble("emptyreload") == 0){ if (stack.getOrCreateTag().getDouble("reloading") == 1 && stack.getOrCreateTag().getDouble("emptyreload") == 0) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.reload2")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.reload2"));
} }
if (stack.getOrCreateTag().getDouble("firemode") == 0 && stack.getOrCreateTag().getDouble("cg") > 0){ if (stack.getOrCreateTag().getDouble("firemode") == 0 && stack.getOrCreateTag().getDouble("cg") > 0) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.changefirerate2")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.changefirerate2"));
} }
if (stack.getOrCreateTag().getDouble("firemode") == 2 && stack.getOrCreateTag().getDouble("cg") > 0){ if (stack.getOrCreateTag().getDouble("firemode") == 2 && stack.getOrCreateTag().getDouble("cg") > 0) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.changefirerate")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.changefirerate"));
} }
@ -116,7 +103,7 @@ public class AK47Item extends Item implements GeoItem {
} }
private PlayState procedurePredicate(AnimationState event) { private PlayState procedurePredicate(AnimationState event) {
if (this.transformType != null ? this.transformType.firstPerson() : false) { if (transformType != null && transformType.firstPerson()) {
if (!this.animationprocedure.equals("empty") && event.getController().getAnimationState() == AnimationController.State.STOPPED) { if (!this.animationprocedure.equals("empty") && event.getController().getAnimationState() == AnimationController.State.STOPPED) {
event.getController().setAnimation(RawAnimation.begin().thenPlay(this.animationprocedure)); event.getController().setAnimation(RawAnimation.begin().thenPlay(this.animationprocedure));
if (event.getController().getAnimationState() == AnimationController.State.STOPPED) { if (event.getController().getAnimationState() == AnimationController.State.STOPPED) {

View file

@ -1,14 +1,11 @@
package net.mcreator.target.item; package net.mcreator.target.item;
import net.minecraft.world.level.Level;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Item;
import net.minecraft.network.chat.Component;
import net.mcreator.target.rarity.RarityTool; import net.mcreator.target.rarity.RarityTool;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import java.util.List; import java.util.List;

View file

@ -1,51 +1,40 @@
package net.mcreator.target.item; package net.mcreator.target.item;
import software.bernie.geckolib.util.GeckoLibUtil;
import software.bernie.geckolib.core.object.PlayState;
import software.bernie.geckolib.core.animation.RawAnimation;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.core.animation.AnimationController;
import software.bernie.geckolib.core.animation.AnimatableManager;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.animatable.GeoItem;
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
import net.minecraft.world.level.Level;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.Item;
import net.minecraft.world.entity.Entity;
import net.minecraft.network.chat.Component;
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.world.entity.HumanoidArm;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.Minecraft;
import com.google.common.collect.HashMultimap; import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import net.mcreator.target.item.renderer.Aa12ItemRenderer;
import net.mcreator.target.procedures.Aa12WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure;
import net.mcreator.target.rarity.RarityTool;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
import net.minecraft.network.chat.Component;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.Attribute;
import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.world.entity.ai.attributes.AttributeModifier;
import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.Item;
import com.google.common.collect.ImmutableMultimap; import net.minecraft.world.item.ItemDisplayContext;
import java.util.UUID; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
import software.bernie.geckolib.animatable.GeoItem;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.core.animation.AnimatableManager;
import software.bernie.geckolib.core.animation.AnimationController;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.core.animation.RawAnimation;
import software.bernie.geckolib.core.object.PlayState;
import software.bernie.geckolib.util.GeckoLibUtil;
import net.mcreator.target.rarity.RarityTool;
import net.mcreator.target.procedures.Aa12WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure;
import net.mcreator.target.item.renderer.Aa12ItemRenderer;
import java.util.function.Consumer;
import java.util.List; import java.util.List;
import java.util.UUID;
import java.util.function.Consumer;
public class Aa12Item extends Item implements GeoItem { public class Aa12Item extends Item implements GeoItem {
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
@ -75,7 +64,7 @@ public class Aa12Item extends Item implements GeoItem {
} }
public void getTransformType(ItemDisplayContext type) { public void getTransformType(ItemDisplayContext type) {
this.transformType = type; transformType = type;
} }
private PlayState idlePredicate(AnimationState event) { private PlayState idlePredicate(AnimationState event) {
@ -84,27 +73,27 @@ public class Aa12Item extends Item implements GeoItem {
if (this.animationprocedure.equals("empty")) { if (this.animationprocedure.equals("empty")) {
if (stack.getOrCreateTag().getDouble("drawtime") < 16){ if (stack.getOrCreateTag().getDouble("drawtime") < 16) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.aa12.draw")); return event.setAndContinue(RawAnimation.begin().thenLoop("animation.aa12.draw"));
} }
if (stack.getOrCreateTag().getDouble("fireanim") > 0){ if (stack.getOrCreateTag().getDouble("fireanim") > 0) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.aa12.fire")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.aa12.fire"));
} }
if (stack.getOrCreateTag().getDouble("reloading") == 1 && stack.getOrCreateTag().getDouble("emptyreload") == 1){ if (stack.getOrCreateTag().getDouble("reloading") == 1 && stack.getOrCreateTag().getDouble("emptyreload") == 1) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.aa12.reloadempty")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.aa12.reloadempty"));
} }
if (stack.getOrCreateTag().getDouble("reloading") == 1 && stack.getOrCreateTag().getDouble("emptyreload") == 0){ if (stack.getOrCreateTag().getDouble("reloading") == 1 && stack.getOrCreateTag().getDouble("emptyreload") == 0) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.aa12.reload")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.aa12.reload"));
} }
if (stack.getOrCreateTag().getDouble("firemode") == 0 && stack.getOrCreateTag().getDouble("cg") > 0){ if (stack.getOrCreateTag().getDouble("firemode") == 0 && stack.getOrCreateTag().getDouble("cg") > 0) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.aa12.changefirerate2")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.aa12.changefirerate2"));
} }
if (stack.getOrCreateTag().getDouble("firemode") == 2 && stack.getOrCreateTag().getDouble("cg") > 0){ if (stack.getOrCreateTag().getDouble("firemode") == 2 && stack.getOrCreateTag().getDouble("cg") > 0) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.aa12.changefirerate")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.aa12.changefirerate"));
} }
@ -118,7 +107,7 @@ public class Aa12Item extends Item implements GeoItem {
} }
private PlayState procedurePredicate(AnimationState event) { private PlayState procedurePredicate(AnimationState event) {
if (this.transformType != null ? this.transformType.firstPerson() : false) { if (transformType != null && transformType.firstPerson()) {
if (!this.animationprocedure.equals("empty") && event.getController().getAnimationState() == AnimationController.State.STOPPED) { if (!this.animationprocedure.equals("empty") && event.getController().getAnimationState() == AnimationController.State.STOPPED) {
event.getController().setAnimation(RawAnimation.begin().thenPlay(this.animationprocedure)); event.getController().setAnimation(RawAnimation.begin().thenPlay(this.animationprocedure));
if (event.getController().getAnimationState() == AnimationController.State.STOPPED) { if (event.getController().getAnimationState() == AnimationController.State.STOPPED) {

View file

@ -1,52 +1,36 @@
package net.mcreator.target.item; package net.mcreator.target.item;
import software.bernie.geckolib.util.GeckoLibUtil;
import software.bernie.geckolib.core.object.PlayState;
import software.bernie.geckolib.core.animation.RawAnimation;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.core.animation.AnimationController;
import software.bernie.geckolib.core.animation.AnimatableManager;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.animatable.GeoItem;
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.level.Level;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.Item;
import net.minecraft.world.entity.Entity;
import net.minecraft.network.chat.Component;
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.world.entity.HumanoidArm;
import net.mcreator.target.tools.ItemNBTTool;
import net.mcreator.target.rarity.RarityTool;
import net.mcreator.target.procedures.AbekiriWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure;
import net.mcreator.target.item.renderer.AbekiriItemRenderer;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.Minecraft;
import com.google.common.collect.HashMultimap; import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import net.mcreator.target.item.renderer.AbekiriItemRenderer;
import net.mcreator.target.procedures.AbekiriWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
import net.minecraft.network.chat.Component;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.Attribute;
import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.world.entity.ai.attributes.AttributeModifier;
import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.*;
import com.google.common.collect.ImmutableMultimap; import net.minecraft.world.level.Level;
import java.util.UUID; import net.minecraftforge.client.extensions.common.IClientItemExtensions;
import software.bernie.geckolib.animatable.GeoItem;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.core.animation.AnimatableManager;
import software.bernie.geckolib.core.animation.AnimationController;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.core.animation.RawAnimation;
import software.bernie.geckolib.core.object.PlayState;
import software.bernie.geckolib.util.GeckoLibUtil;
import java.util.function.Consumer;
import java.util.List; import java.util.List;
import java.util.UUID;
import java.util.function.Consumer;
public class AbekiriItem extends Item implements GeoItem { public class AbekiriItem extends Item implements GeoItem {
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
@ -76,7 +60,7 @@ public class AbekiriItem extends Item implements GeoItem {
} }
public void getTransformType(ItemDisplayContext type) { public void getTransformType(ItemDisplayContext type) {
this.transformType = type; transformType = type;
} }
private PlayState idlePredicate(AnimationState event) { private PlayState idlePredicate(AnimationState event) {
@ -85,19 +69,19 @@ public class AbekiriItem extends Item implements GeoItem {
if (this.animationprocedure.equals("empty")) { if (this.animationprocedure.equals("empty")) {
if (stack.getOrCreateTag().getDouble("drawtime") < 11){ if (stack.getOrCreateTag().getDouble("drawtime") < 11) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ab.draw")); return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ab.draw"));
} }
if (stack.getOrCreateTag().getDouble("fireanim") > 0){ if (stack.getOrCreateTag().getDouble("fireanim") > 0) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ab.fire")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ab.fire"));
} }
if (stack.getOrCreateTag().getDouble("reloading") == 1 && stack.getOrCreateTag().getDouble("emptyreload") == 1){ if (stack.getOrCreateTag().getDouble("reloading") == 1 && stack.getOrCreateTag().getDouble("emptyreload") == 1) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ab.reload2")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ab.reload2"));
} }
if (stack.getOrCreateTag().getDouble("reloading") == 1 && stack.getOrCreateTag().getDouble("emptyreload") == 0){ if (stack.getOrCreateTag().getDouble("reloading") == 1 && stack.getOrCreateTag().getDouble("emptyreload") == 0) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ab.reload")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ab.reload"));
} }
@ -111,7 +95,7 @@ public class AbekiriItem extends Item implements GeoItem {
} }
private PlayState procedurePredicate(AnimationState event) { private PlayState procedurePredicate(AnimationState event) {
if (this.transformType != null ? true : false) { if (transformType != null) {
if (!(this.animationprocedure.equals("empty")) && event.getController().getAnimationState() == AnimationController.State.STOPPED) { if (!(this.animationprocedure.equals("empty")) && event.getController().getAnimationState() == AnimationController.State.STOPPED) {
event.getController().setAnimation(RawAnimation.begin().thenPlay(this.animationprocedure)); event.getController().setAnimation(RawAnimation.begin().thenPlay(this.animationprocedure));
if (event.getController().getAnimationState() == AnimationController.State.STOPPED) { if (event.getController().getAnimationState() == AnimationController.State.STOPPED) {

View file

@ -1,14 +1,11 @@
package net.mcreator.target.item; package net.mcreator.target.item;
import net.minecraft.world.level.Level;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Item;
import net.minecraft.network.chat.Component;
import net.mcreator.target.rarity.RarityTool; import net.mcreator.target.rarity.RarityTool;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import java.util.List; import java.util.List;

View file

@ -1,58 +1,38 @@
package net.mcreator.target.item; package net.mcreator.target.item;
import software.bernie.geckolib.util.GeckoLibUtil;
import software.bernie.geckolib.core.object.PlayState;
import software.bernie.geckolib.core.animation.RawAnimation;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.core.animation.AnimationController;
import software.bernie.geckolib.core.animation.AnimatableManager;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.animatable.GeoItem;
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.level.Level;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.Item;
import net.minecraft.world.entity.Entity;
import net.minecraft.network.chat.Component;
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.world.entity.HumanoidArm;
import net.mcreator.target.tools.ItemNBTTool;
import net.mcreator.target.rarity.RarityTool;
import net.mcreator.target.init.TargetModItems;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.Minecraft;
import com.google.common.collect.HashMultimap; import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import net.mcreator.target.item.renderer.BocekItemRenderer;
import net.mcreator.target.procedures.BocekreloadProcedure;
import net.mcreator.target.rarity.RarityTool;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
import net.minecraft.network.chat.Component;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.Attribute;
import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.world.entity.ai.attributes.AttributeModifier;
import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.player.Player;
import com.google.common.collect.ImmutableMultimap; import net.minecraft.world.item.*;
import net.minecraft.world.level.Level;
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
import software.bernie.geckolib.animatable.GeoItem;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.core.animation.AnimatableManager;
import software.bernie.geckolib.core.animation.AnimationController;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.core.animation.RawAnimation;
import software.bernie.geckolib.core.object.PlayState;
import software.bernie.geckolib.util.GeckoLibUtil;
import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.List;
import net.mcreator.target.procedures.BocekreloadProcedure;
import net.mcreator.target.item.renderer.BocekItemRenderer;
import net.minecraft.world.item.Items;
import java.util.function.Consumer;
import java.util.List;
public class BocekItem extends Item implements GeoItem { public class BocekItem extends Item implements GeoItem {
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
@ -82,15 +62,15 @@ public class BocekItem extends Item implements GeoItem {
} }
public void getTransformType(ItemDisplayContext type) { public void getTransformType(ItemDisplayContext type) {
this.transformType = type; transformType = type;
} }
private PlayState idlePredicate(AnimationState event) { private PlayState idlePredicate(AnimationState event) {
if (this.transformType != null ? this.transformType.firstPerson() : false) { if (transformType != null && transformType.firstPerson()) {
LocalPlayer player = Minecraft.getInstance().player; LocalPlayer player = Minecraft.getInstance().player;
ItemStack stack = player.getMainHandItem(); ItemStack stack = player.getMainHandItem();
if (stack.getOrCreateTag().getDouble("drawtime") < 16){ if (stack.getOrCreateTag().getDouble("drawtime") < 16) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.bocek.draw")); return event.setAndContinue(RawAnimation.begin().thenLoop("animation.bocek.draw"));
} }
@ -103,7 +83,7 @@ public class BocekItem extends Item implements GeoItem {
} }
private PlayState procedurePredicate(AnimationState event) { private PlayState procedurePredicate(AnimationState event) {
if (this.transformType != null ? this.transformType.firstPerson() : false) { if (transformType != null && transformType.firstPerson()) {
if (!this.animationprocedure.equals("empty") && event.getController().getAnimationState() == AnimationController.State.STOPPED) { if (!this.animationprocedure.equals("empty") && event.getController().getAnimationState() == AnimationController.State.STOPPED) {
event.getController().setAnimation(RawAnimation.begin().thenPlay(this.animationprocedure)); event.getController().setAnimation(RawAnimation.begin().thenPlay(this.animationprocedure));
if (event.getController().getAnimationState() == AnimationController.State.STOPPED) { if (event.getController().getAnimationState() == AnimationController.State.STOPPED) {

View file

@ -1,12 +1,11 @@
package net.mcreator.target.item; package net.mcreator.target.item;
import net.minecraft.world.level.Level;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Item;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import java.util.List; import java.util.List;

View file

@ -1,12 +1,11 @@
package net.mcreator.target.item; package net.mcreator.target.item;
import net.minecraft.world.level.Level;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Item;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import java.util.List; import java.util.List;

View file

@ -1,12 +1,11 @@
package net.mcreator.target.item; package net.mcreator.target.item;
import net.minecraft.world.level.Level;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Item;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import java.util.List; import java.util.List;

View file

@ -1,12 +1,11 @@
package net.mcreator.target.item; package net.mcreator.target.item;
import net.minecraft.world.level.Level;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Item;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import java.util.List; import java.util.List;

View file

@ -1,4 +1,3 @@
package net.mcreator.target.item; package net.mcreator.target.item;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;

Some files were not shown because too many files have changed in this diff Show more