epstein file
This commit is contained in:
30
src/main/java/dev/tggamesyt/szar/EpsteinFile.java
Normal file
30
src/main/java/dev/tggamesyt/szar/EpsteinFile.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package dev.tggamesyt.szar;
|
||||
|
||||
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
|
||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EpsteinFile extends Item {
|
||||
public EpsteinFile(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {
|
||||
if (!world.isClient && player instanceof ServerPlayerEntity serverPlayer) {
|
||||
PacketByteBuf buf = PacketByteBufs.create();
|
||||
|
||||
ServerPlayNetworking.send(serverPlayer, Szar.OPEN_URL, buf);
|
||||
}
|
||||
|
||||
return TypedActionResult.success(player.getStackInHand(hand));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -77,6 +77,8 @@ public class Szar implements ModInitializer {
|
||||
public static MinecraftServer SERVER;
|
||||
public static final Identifier PLANE_ANIM_PACKET =
|
||||
new Identifier("szar", "plane_anim");
|
||||
public static final Identifier OPEN_URL = new Identifier(MOD_ID, "epsteinfiles");
|
||||
|
||||
public static final Block SZAR_BLOCK =
|
||||
new SzarBlock();
|
||||
public static final TrackedData<Long> LAST_CRIME_TICK =
|
||||
@@ -588,7 +590,7 @@ public class Szar implements ModInitializer {
|
||||
public static final Item EPSTEIN_FILES = Registry.register(
|
||||
Registries.ITEM,
|
||||
new Identifier(MOD_ID, "epstein_files"),
|
||||
new Item(new Item.Settings())
|
||||
new EpsteinFile(new Item.Settings())
|
||||
);
|
||||
public static final Item HANDCUFF_ITEM = Registry.register(
|
||||
Registries.ITEM,
|
||||
|
||||
Reference in New Issue
Block a user