Jump to content

Recommended Posts

Posted

Hello. I run a Minecraft cauldron server. I ran into an error where whenever a player hits another player, their game crashes. PvP is enabled in my server properties. Is it a problem with the mods or plugins or server properties? Any help or suggestions?

Here is the crash report:

---- Minecraft Crash Report ----
// I'm sorry, Dave.

Time: 6/29/17 11:32 AM
Description: Unexpected error

java.lang.NullPointerException: Unexpected error
    at com.unitedworldminers.BaseIO.storage.PlayerIO.get(PlayerIO.java:87)
    at com.unitedworldminers.BaseIO.storage.PlayerIO.get(PlayerIO.java:74)
    at com.unitedworldminers.CoreIO.events.EventBus.onEntityAttack(EventBus.java:190)
    at cpw.mods.fml.common.eventhandler.ASMEventHandler_298_EventBus_onEntityAttack_AttackEntityEvent.invoke(.dynamic)
    at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
    at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140)
    at net.minecraft.entity.player.EntityPlayer.func_71059_n(EntityPlayer.java:1185)
    at net.minecraft.client.multiplayer.PlayerControllerMP.func_78764_a(PlayerControllerMP.java:406)
    at net.minecraft.client.Minecraft.func_147116_af(Minecraft.java:1393)
    at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1948)
    at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:973)
    at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:898)
    at net.minecraft.client.main.Main.main(SourceFile:148)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
    at com.unitedworldminers.BaseIO.storage.PlayerIO.get(PlayerIO.java:87)
    at com.unitedworldminers.BaseIO.storage.PlayerIO.get(PlayerIO.java:74)
    at com.unitedworldminers.CoreIO.events.EventBus.onEntityAttack(EventBus.java:190)
    at cpw.mods.fml.common.eventhandler.ASMEventHandler_298_EventBus_onEntityAttack_AttackEntityEvent.invoke(.dynamic)
    at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
    at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140)
    at net.minecraft.entity.player.EntityPlayer.func_71059_n(EntityPlayer.java:1185)
    at net.minecraft.client.multiplayer.PlayerControllerMP.func_78764_a(PlayerControllerMP.java:406)
    at net.minecraft.client.Minecraft.func_147116_af(Minecraft.java:1393)

-- Affected level --
Details:
    Level name: MpServer
    All players: 2 total; [EntityClientPlayerMP['hammer345'/3058, l='MpServer', x=255.57, y=70.62, z=542.52], EntityOtherPlayerMP['Kobomi'/3067, l='MpServer', x=256.50, y=69.00, z=542.94]]
    Chunk stats: MultiplayerChunkCache: 400, 400
    Level seed: 0
    Level generator: ID 00 - default, ver 1. Features enabled: false
    Level generator options: 
    Level spawn location: World: (231,225,409), Chunk: (at 7,14,9 in 14,25; contains blocks 224,0,400 to 239,255,415), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
    Level time: 308808 game time, 318857 day time
    Level dimension: 0
    Level storage version: 0x00000 - Unknown?
    Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
    Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: false
    Forced entities: 13 total; [MoCEntityButterfly['ButterFly'/34, l='MpServer', x=299.53, y=65.00, z=511.31], MoCEntityAnt['Ant'/35, l='MpServer', x=291.50, y=64.00, z=509.50], MoCEntityButterfly['ButterFly'/36, l='MpServer', x=303.72, y=64.00, z=515.38], MoCEntityFly['Fly'/37, l='MpServer', x=299.63, y=64.00, z=515.84], EntityOtherPlayerMP['Kobomi'/3067, l='MpServer', x=256.50, y=69.00, z=542.94], MoCEntityFly['Fly'/45, l='MpServer', x=308.97, y=63.00, z=519.47], MoCEntityFirefly['Firefly'/46, l='MpServer', x=309.44, y=64.00, z=516.59], MoCEntityCricket['Cricket'/48, l='MpServer', x=316.41, y=66.00, z=514.72], EntityClientPlayerMP['hammer345'/3058, l='MpServer', x=255.57, y=70.62, z=542.52], EntityItemFrame['entity.ItemFrame.name'/22, l='MpServer', x=255.50, y=71.50, z=533.06], EntityItemFrame['entity.ItemFrame.name'/23, l='MpServer', x=250.50, y=71.50, z=533.06], EntityBat['Bat'/27, l='MpServer', x=258.56, y=53.10, z=561.25], EntityOtherPlayerMP['Kobomi'/3067, l='MpServer', x=256.50, y=69.00, z=542.94]]
    Retry entities: 0 total; []
    Server brand: cauldron,craftbukkit,mcpc,fml,forge
    Server type: Non-integrated multiplayer server
Stacktrace:
    at net.minecraft.client.multiplayer.WorldClient.func_72914_a(WorldClient.java:425)
    at net.minecraft.client.Minecraft.func_71396_d(Minecraft.java:2444)
    at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:927)
    at net.minecraft.client.main.Main.main(SourceFile:148)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

-- System Details --
Details:
    Minecraft Version: 1.7.10
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_25, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 4734243680 bytes (4514 MB) / 5288230912 bytes (5043 MB) up to 5288230912 bytes (5043 MB)
    JVM Flags: 26 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx5G -Xms5G -Xmn768m -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseNUMA -XX:+CMSParallelRemarkEnabled -XX:MaxTenuringThreshold=15 -XX:MaxGCPauseMillis=30 -XX:GCPauseIntervalMillis=150 -XX:+UseAdaptiveGCBoundary -XX:-UseGCOverheadLimit -XX:+UseBiasedLocking -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=15 -XX:+UseFastAccessorMethods -XX:+UseCompressedOops -XX:+OptimizeStringConcat -XX:+AggressiveOpts -XX:ReservedCodeCacheSize=2048m -XX:+UseCodeCacheFlushing -XX:SoftRefLRUPolicyMSPerMB=10000 -XX:ParallelGCThreads=10
    AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
    IntCache: cache: 0, tcache: 0, allocated: 15, tallocated: 95
    FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1614 Optifine OptiFine_1.7.10_HD_U_D6 42 mods loaded, 42 mods active
    States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
    UCHIJA    mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) 
    UCHIJA    FML{7.10.99.99} [Forge Mod Loader] (forge-1.7.10-10.13.4.1614-1.7.10.jar) 
    UCHIJA    Forge{10.13.4.1614} [Minecraft Forge] (forge-1.7.10-10.13.4.1614-1.7.10.jar) 
    UCHIJA    appliedenergistics2-core{rv2-stable-10} [AppliedEnergistics2 Core] (minecraft.jar) 
    UCHIJA    CodeChickenCore{1.0.4.29} [CodeChicken Core] (minecraft.jar) 
    UCHIJA    bspkrsCore{6.16} [bspkrsCore] ([1.7.10]bspkrsCore-universal-6.16.jar) 
    UCHIJA    ArmorStatusHUD{1.28} [ArmorStatusHUD] ([1.7.10]ArmorStatusHUD-client-1.28.jar) 
    UCHIJA    Treecapitator{1.7.10} [Treecapitator] ([1.7.10]Treecapitator-universal-2.0.4.jar) 
    UCHIJA    Baubles{1.0.1.10} [Baubles] (Baubles-1.7.10-1.0.1.10.jar) 
    UCHIJA    adventurebackpack{1.7.10-0.8b} [Adventure Backpack] (adventurebackpack-1.7.10-0.8c.jar) 
    UCHIJA    appliedenergistics2{rv2-stable-10} [Applied Energistics 2] (appliedenergistics2-rv2-stable-10.jar) 
    UCHIJA    BaseIO{0.0.0.1} [BaseIO] (BaseIO-0.0.0.1-72.jar) 
    UCHIJA    BuildCraft|Core{7.1.18} [BuildCraft] (buildcraft-7.1.18.jar) 
    UCHIJA    BuildCraft|Transport{7.1.18} [BC Transport] (buildcraft-7.1.18.jar) 
    UCHIJA    BuildCraft|Silicon{7.1.18} [BC Silicon] (buildcraft-7.1.18.jar) 
    UCHIJA    BuildCraft|Energy{7.1.18} [BC Energy] (buildcraft-7.1.18.jar) 
    UCHIJA    BuildCraft|Factory{7.1.18} [BC Factory] (buildcraft-7.1.18.jar) 
    UCHIJA    BuildCraft|Builders{7.1.18} [BC Builders] (buildcraft-7.1.18.jar) 
    UCHIJA    BuildCraft|Robotics{7.1.18} [BC Robotics] (buildcraft-7.1.18.jar) 
    UCHIJA    cfm{3.4.8} [§9MrCrayfish's Furniture Mod] (cfm-3.4.8-mc1.7.10.jar) 
    UCHIJA    chocolateQuest{1.0} [Chocolate Quest] (chocolateQuest-1.7.10-1.0 (1).jar) 
    UCHIJA    CoreIO{0} [CoreIO] (CoreIO-0.6.0.100.jar) 
    UCHIJA    MoCreatures{6.3.1} [DrZhark's Mo'Creatures Mod] (DrZharks MoCreatures Mod v6.3.1.zip) 
    UCHIJA    EnderIO{1.7.10-2.2.8.381} [Ender IO] (EnderIO-1.7.10-2.2.8.381.jar) 
    UCHIJA    ExtraUtilities{1.2.12} [Extra Utilities] (extrautilities-1.2.12 (1).jar) 
    UCHIJA    IC2{2.2.827-experimental} [IndustrialCraft 2] (industrialcraft-2-2.2.827-experimental.jar) 
    UCHIJA    InfernalMobs{1.6.0} [Infernal Mobs] (InfernalMobs-1.7.10.jar) 
    UCHIJA    IronChest{6.0.60.741} [Iron Chest] (ironchest-1.7.10-6.0.60.741-universal.jar) 
    UCHIJA    lom{1.7.10-3.2.2} [LotsOMobs] (LotsOMobs-Mod-1.7.10.jar) 
    UCHIJA    magicalcrops{1.7.2 - 0.1 ALPHA} [Magical Crops] (magicalcrops-1.7.10_0.1.jar) 
    UCHIJA    Mantle{1.7.10-0.3.2.jenkins184} [Mantle] (Mantle-1.7.10-0.3.2.jar) 
    UCHIJA    maplecrafted{2.5} [Offcial MapleCrafted Mod] (MapleCrafted2.5[1.7.10].jar) 
    UCHIJA    liege{a1} [Medieval mobs mod, part of Liege mod] (Medieval-Mobs-Mod-1.7.10.jar) 
    UCHIJA    MoreCommands{1.0.0} [MoreCommands] (MoreCommands_1.7.1710.jar) 
    UCHIJA    MSM3{3.0.0d} [More Swords 3] (MSM-SNAP-3.0.0e-For-MC-1.7.10.jar) 
    UCHIJA    Thaumcraft{4.2.3.5} [Thaumcraft] (Thaumcraft-1.7.10-4.2.3.5.jar) 
    UCHIJA    harvestcraft{1.7.10j} [Pam's HarvestCraft] (Pam's HarvestCraft 1.7.10Lb.jar) 
    UCHIJA    ropebridge{1.3} [Rope Bridge] (RopeBridge-v1.3-mc1.7.10.jar) 
    UCHIJA    SpawnCommands{2.2.2} [SpawnCommands] (SpawnCommands-2.2.2-mc1.7.10-forge.jar) 
    UCHIJA    TConstruct{1.7.10-1.8.8.build988} [Tinkers' Construct] (TConstruct-1.7.10-1.8.8 (4).jar) 
    UCHIJA    TwilightForest{2.3.7} [The Twilight Forest] (twilightforest-1.7.10-2.3.7.jar) 
    UCHIJA    weaponmod{v1.14.3} [Balkon's WeaponMod] (weaponmod-1.14.3 (1).jar) 
    GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 382.05' Renderer: 'GeForce GTX 970/PCIe/SSE2'
    AE2 Version: stable rv2-stable-10 for Forge 10.13.2.1291
    Mantle Environment: DO NOT REPORT THIS CRASH! Unsupported mods in environment: optifine
    TConstruct Environment: Environment healthy.
    AE2 Integration: IC2:ON, RotaryCraft:OFF, RC:OFF, BC:ON, RF:ON, RFItem:ON, MFR:OFF, DSU:ON, FZ:OFF, FMP:OFF, RB:OFF, CLApi:OFF, Waila:OFF, InvTweaks:OFF, NEI:OFF, CraftGuide:OFF, Mekanism:OFF, ImmibisMicroblocks:OFF, BetterStorage:OFF
    Launched Version: 1.7.10-Forge10.13.4.1614-1.7.10
    LWJGL: 2.9.1
    OpenGL: GeForce GTX 970/PCIe/SSE2 GL version 4.5.0 NVIDIA 382.05, NVIDIA Corporation
    GL Caps: Using GL 1.3 multitexturing.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Anisotropic filtering is supported and maximum anisotropy is 16.
Shaders are available because OpenGL 2.1 is supported.

    Is Modded: Definitely; Client brand changed to 'fml,forge'
    Type: Client (map_client.txt)
    Resource Packs: []
    Current Language: English (US)
    Profiler Position: N/A (disabled)
    Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
    Anisotropic Filtering: Off (1)
    OptiFine Version: OptiFine_1.7.10_HD_U_D6
    Render Distance Chunks: 14
    Mipmaps: 4
    Anisotropic Filtering: 1
    Antialiasing: 0
    Multitexture: false
    OpenGlVersion: 4.5.0 NVIDIA 382.05
    OpenGlRenderer: GeForce GTX 970/PCIe/SSE2
    OpenGlVendor: NVIDIA Corporation
    CpuCount: 8

Posted

 

7 minutes ago, Kobomi said:

java.lang.NullPointerException: Unexpected error
    at com.unitedworldminers.BaseIO.storage.PlayerIO.get(PlayerIO.java:87)

a issue is known on the BaseIO mod

https://git.unitedworldminers.com/io/BaseIO/commit/14925dd31fd7b489ca2cfe1a7fe171d2b4e9ab7d

 

Maybe you can get a BaseIO update to correct this ?

https://minecraft.curseforge.com/projects/baseio (there a link to the jenkins site you can find the lastest updates for 1.7.10 and 1.10)

  • Guest locked this topic
Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Version 1.19 - Forge 41.0.63 I want to create a wolf entity that I can ride, so far it seems to be working, but the problem is that when I get on the wolf, I can’t control it. I then discovered that the issue is that the server doesn’t detect that I’m riding the wolf, so I’m struggling with synchronization. However, it seems to not be working properly. As I understand it, the server receives the packet but doesn’t register it correctly. I’m a bit new to Java, and I’ll try to provide all the relevant code and prints *The comments and prints are translated by chatgpt since they were originally in Spanish* Thank you very much in advance No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. MountableWolfEntity package com.vals.valscraft.entity; import com.vals.valscraft.network.MountSyncPacket; import com.vals.valscraft.network.NetworkHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.network.PacketDistributor; public class MountableWolfEntity extends Wolf { private boolean hasSaddle; private static final EntityDataAccessor<Byte> DATA_ID_FLAGS = SynchedEntityData.defineId(MountableWolfEntity.class, EntityDataSerializers.BYTE); public MountableWolfEntity(EntityType<? extends Wolf> type, Level level) { super(type, level); this.hasSaddle = false; } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_ID_FLAGS, (byte)0); } public static AttributeSupplier.Builder createAttributes() { return Wolf.createAttributes() .add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.MOVEMENT_SPEED, 0.3); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); if (itemstack.getItem() == Items.SADDLE && !this.hasSaddle()) { if (!player.isCreative()) { itemstack.shrink(1); } this.setSaddle(true); return InteractionResult.SUCCESS; } else if (!level.isClientSide && this.hasSaddle()) { player.startRiding(this); MountSyncPacket packet = new MountSyncPacket(true); // 'true' means the player is mounted NetworkHandler.CHANNEL.sendToServer(packet); // Ensure the server handles the packet return InteractionResult.SUCCESS; } return InteractionResult.PASS; } @Override public void travel(Vec3 travelVector) { if (this.isVehicle() && this.getControllingPassenger() instanceof Player) { System.out.println("The wolf has a passenger."); System.out.println("The passenger is a player."); Player player = (Player) this.getControllingPassenger(); // Ensure the player is the controller this.setYRot(player.getYRot()); this.yRotO = this.getYRot(); this.setXRot(player.getXRot() * 0.5F); this.setRot(this.getYRot(), this.getXRot()); this.yBodyRot = this.getYRot(); this.yHeadRot = this.yBodyRot; float forward = player.zza; float strafe = player.xxa; if (forward <= 0.0F) { forward *= 0.25F; } this.flyingSpeed = this.getSpeed() * 0.1F; this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.5F); this.setDeltaMovement(new Vec3(strafe, travelVector.y, forward).scale(this.getSpeed())); this.calculateEntityAnimation(this, false); } else { // The wolf does not have a passenger or the passenger is not a player System.out.println("No player is mounted, or the passenger is not a player."); super.travel(travelVector); } } public boolean hasSaddle() { return this.hasSaddle; } public void setSaddle(boolean hasSaddle) { this.hasSaddle = hasSaddle; } @Override protected void dropEquipment() { super.dropEquipment(); if (this.hasSaddle()) { this.spawnAtLocation(Items.SADDLE); this.setSaddle(false); } } @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { MinecraftServer server = net.minecraftforge.server.ServerLifecycleHooks.getCurrentServer(); if (server != null) { for (ServerPlayer player : server.getPlayerList().getPlayers()) { if (player.isPassenger() && player.getVehicle() instanceof MountableWolfEntity) { MountableWolfEntity wolf = (MountableWolfEntity) player.getVehicle(); System.out.println("Tick: " + player.getName().getString() + " is correctly mounted on " + wolf); } } } } } private boolean lastMountedState = false; @Override public void tick() { super.tick(); if (!this.level.isClientSide) { // Only on the server boolean isMounted = this.isVehicle() && this.getControllingPassenger() instanceof Player; // Only print if the state changed if (isMounted != lastMountedState) { if (isMounted) { Player player = (Player) this.getControllingPassenger(); // Verify the passenger is a player System.out.println("Server: Player " + player.getName().getString() + " is now mounted."); } else { System.out.println("Server: The wolf no longer has a passenger."); } lastMountedState = isMounted; } } } @Override public void addPassenger(Entity passenger) { super.addPassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(true)); } } } @Override public void removePassenger(Entity passenger) { super.removePassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is no longer mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(false)); } } } @Override public boolean isControlledByLocalInstance() { Entity entity = this.getControllingPassenger(); return entity instanceof Player; } @Override public void positionRider(Entity passenger) { if (this.hasPassenger(passenger)) { double xOffset = Math.cos(Math.toRadians(this.getYRot() + 90)) * 0.4; double zOffset = Math.sin(Math.toRadians(this.getYRot() + 90)) * 0.4; passenger.setPos(this.getX() + xOffset, this.getY() + this.getPassengersRidingOffset() + passenger.getMyRidingOffset(), this.getZ() + zOffset); } } } MountSyncPacket package com.vals.valscraft.network; import com.vals.valscraft.entity.MountableWolfEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class MountSyncPacket { private final boolean isMounted; public MountSyncPacket(boolean isMounted) { this.isMounted = isMounted; } public void encode(FriendlyByteBuf buffer) { buffer.writeBoolean(isMounted); } public static MountSyncPacket decode(FriendlyByteBuf buffer) { return new MountSyncPacket(buffer.readBoolean()); } public void handle(NetworkEvent.Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); // Get the player from the context if (player != null) { // Verifies if the player has dismounted if (!isMounted) { Entity vehicle = player.getVehicle(); if (vehicle instanceof MountableWolfEntity wolf) { // Logic to remove the player as a passenger wolf.removePassenger(player); System.out.println("Server: Player " + player.getName().getString() + " is no longer mounted."); } } } }); context.setPacketHandled(true); // Marks the packet as handled } } networkHandler package com.vals.valscraft.network; import com.vals.valscraft.valscraft; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class NetworkHandler { private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(valscraft.MODID, "main"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals ); public static void init() { int packetId = 0; // Register the mount synchronization packet CHANNEL.registerMessage( packetId++, MountSyncPacket.class, MountSyncPacket::encode, MountSyncPacket::decode, (msg, context) -> msg.handle(context.get()) // Get the context with context.get() ); } }  
    • Do you use features of inventory profiles next (ipnext) or is there a change without it?
    • Remove rubidium - you are already using embeddium, which is a fork of rubidium
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.