Jump to content

[1.7.10] Server - No Class Def Found Error [SOLVED]


Recommended Posts

Posted

Used the tutorial provided by MrCaracal and some snooping around in other mods to figure out proxies. In short: entities went in the common proxy, renderer went in the client proxy. Shocker!

 

-------- SOLVED ---------

 

Yup, can't get my mod to work on a server.

 

 

---- Minecraft Crash Report ----

// Surprise! Haha. Well, this is awkward.

 

Time: 12/11/14 11:37 AM

Description: Exception in server tick loop

 

java.lang.NoClassDefFoundError: net/minecraft/client/renderer/entity/Render

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Unknown Source)

at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:420)

at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)

at cpw.mods.fml.common.Loader.loadMods(Loader.java:492)

at cpw.mods.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:87)

at cpw.mods.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:314)

at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:117)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:387)

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685)

Caused by: java.lang.ClassNotFoundException: net.minecraft.client.renderer.entity.Render

at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191)

at java.lang.ClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

... 29 more

Caused by: java.lang.NullPointerException

 

 

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

---------------------------------------------------------------------------------------

 

-- System Details --

Details:

Minecraft Version: 1.7.10

Operating System: Windows 7 (amd64) version 6.1

Java Version: 1.7.0_55, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 1926384864 bytes (1837 MB) / 2058878976 bytes (1963 MB) up to 2058878976 bytes (1963 MB)

JVM Flags: 2 total; -Xms2G -Xmx2G

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP v9.05 FML v7.10.85.1232 Minecraft Forge 10.13.2.1232 40 mods loaded, 40 mods active

mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed

FML{7.10.85.1232} [Forge Mod Loader] (forge.jar) Unloaded->Constructed

Forge{10.13.2.1232} [Minecraft Forge] (forge.jar) Unloaded->Constructed

appliedenergistics2-core{rv1-stable-1} [AppliedEnergistics2 Core] (minecraft.jar) Unloaded->Constructed

CodeChickenCore{1.0.4.29} [CodeChicken Core] (minecraft.jar) Unloaded->Constructed

ThaumicTinkerer-preloader{0.1} [Thaumic Tinkerer Core] (minecraft.jar) Unloaded->Constructed

doggytalents{v1.8.2a} [Doggy Talents] ([1.7.10] Doggy Talents - v1.8.2a.zip) Unloaded->Constructed

bspkrsCore{6.15} [bspkrsCore] ([1.7.10]bspkrsCore-universal-6.15.jar) Unloaded->Constructed

Treecapitator{1.7.10} [Treecapitator] ([1.7.10]Treecapitator-universal-2.0.4.jar) Unloaded->Constructed

AppleCore{1.0.1} [AppleCore] (AppleCore-mc1.7.10-1.0.1.jar) Unloaded->Constructed

appliedenergistics2{rv1-stable-1} [Applied Energistics 2] (appliedenergistics2-rv1-stable-1.jar) Unloaded->Constructed

BiomesOPlenty{2.1.0} [biomes O' Plenty] (BiomesOPlenty-1.7.10-2.1.0.1019-universal.jar) Unloaded->Constructed

Baubles{1.0.1.10} [baubles] (Baubles-1.7.10-1.0.1.10.jar) Unloaded->Constructed

Thaumcraft{4.2.1.4} [Thaumcraft] (Thaumcraft-1.7.10-4.2.1.4.jar) Unloaded->Constructed

Botania{r1.3-141} [botania] (Botania r1.3-141.jar) Unloaded->Constructed

BuildCraft|Core{6.1.8} [buildCraft] (buildcraft-6.1.8.jar) Unloaded->Constructed

BuildCraft|Builders{6.1.8} [bC Builders] (buildcraft-6.1.8.jar) Unloaded->Constructed

BuildCraft|Energy{6.1.8} [bC Energy] (buildcraft-6.1.8.jar) Unloaded->Constructed

BuildCraft|Factory{6.1.8} [bC Factory] (buildcraft-6.1.8.jar) Unloaded->Constructed

BuildCraft|Transport{6.1.8} [bC Transport] (buildcraft-6.1.8.jar) Unloaded->Constructed

BuildCraft|Silicon{6.1.8} [bC Silicon] (buildcraft-6.1.8.jar) Unloaded->Constructed

CarpentersBlocks{3.3.3} [Carpenter's Blocks] (Carpenter's Blocks v3.3.3 - MC 1.7.10.jar) Unloaded->Constructed

ChickenChunks{1.3.4.14} [ChickenChunks] (ChickenChunks-1.7.10-1.3.4.14-universal (1).jar) Unloaded->Constructed

clockworkphase{1.7.10_1.0a} [Clockwork Phase] (clockworkphase-1.7.10_1.0a.jar) Unloaded->Constructed

craftguide{1.6.8.1} [CraftGuide] (CraftGuide-1.6.8.1.zip) Unloaded->Constructed

IC2{2.2.654-experimental} [industrialCraft 2] (industrialcraft-2-2.2.654-experimental.jar) Unloaded->Constructed

EMT{2.0.0Alpha4} [Electro-Magic Tools] (ElectroMagicTools-1.7.10-2.0.0Alpha-28.jar) Unloaded->Constructed

eplus{3.0.2-d} [Enchanting Plus] (EnchantingPlus-1.7.10-3.0.2-d.jar) Unloaded->Constructed

EnderStorage{1.4.5.26} [EnderStorage] (EnderStorage-1.7.10-1.4.5.26-universal.jar) Unloaded->Constructed

ExtraUtilities{1.2.0} [Extra Utilities] (extrautilities-1.2.0.jar) Unloaded->Constructed

FastCraft{1.9} [FastCraft] (fastcraft-1.9.jar) Unloaded->Constructed

harvestcraft{1.7.10b} [Pam's HarvestCraft] (Pam's HarvestCraft 1.7.10c.jar) Unloaded->Constructed

HungerOverhaul{1.7.10-beta.2.jenkins30} [Hunger Overhaul] (HungerOverhaul-1.7.10-beta.2.jar) Unloaded->Constructed

LivelyAnimals{0.0001} [Lively Animals] (LivelyAnimals.jar) Unloaded

magicalcrops{1.7.2 - 0.1 ALPHA} [Magical Crops] (magicalcrops-1.7.10_0.1.jar) Unloaded

SpiceOfLife{1.2.2} [The Spice of Life] (SpiceOfLife-mc1.7.10-1.2.2.jar) Unloaded

StorageDrawers{1.2.0} [storage Drawers] (StorageDrawers-1.7.10-1.2.0.jar) Unloaded

thaumicenergistics{0.8.7b} [Thaumic Energistics] (thaumicenergistics-0.8.7b.jar) Unloaded

ThaumicTinkerer{unspecified} [Thaumic Tinkerer] (ThaumicTinkerer-2.5-1.7.10-161.jar) Unloaded

YALSM{2.1.3} [Yet Another Leather Smelting Mod] (yalsm-2.1.3.jar) Unloaded

AE2 Version: stable rv1-stable-1 for Forge 10.13.0.1187

Profiler Position: N/A (disabled)

Is Modded: Definitely; Server brand changed to 'fml,forge'

Type: Dedicated Server (map_server.txt)

 

 

I assume it probably has something to do with rendering being client-side only, but I'm not sure how to account for that. I tried using the @ClientSide Only tag as a quick, temporary fix, but that didn't do it either.

 

... inexplicably, it does work on Single player but the back legs don't seem to render. I figured the problems were probably one in the same though.

Posted

1. Provide code

2. Server has no rendering, Minecraft and many other classes.

3. You need to use proxy and Side.CLIENT or world.isRemote (depends)

1.7.10 is no longer supported by forge, you are on your own.

Posted

You are correct in that this issue is caused by rendering classes being "client-side" only - meaning that the rendering classes don't exist at all on a dedicated server.

 

What you need is a way to ensure that your rendering stuff is only called upon by the Minecraft client. The way this is accomplished is by the use of a proxy class, like Ernio said. You will create two classes with identical method signatures: one that will be loaded for the client, one that will be loaded for the server. If you make your client proxy class inherit from your common proxy class and override the common proxy's methods, you will be able to call methods in your common proxy instance and have them execute one way on the "client" and one way on the "server."

 

This is useful for separating your rendering stuff between "sides". If your rendering stuff is only registered in your client proxy, it will only ever load that stuff on a client. Here's the wiki tutorial on how to write a proxy class -> http://www.minecraftforge.net/wiki/Proxies

 

Attempting to use the @ClientSideOnly or @SideOnly annotations was logical given their names, but not quite what those are meant to be used for. Those annotations simply mean "the following field or method should only exist to the specified side". They can cause problems if one side is expecting that field or method and it is tagged to only "exist" on the other, so they should be used sparingly and only on fields and methods that you know will only be used on one side; one example being IIcon fields and related methods.

Posted

Good news: Got the proxy thing figured out! I'm surprised I was able to do it without any problem.

 

Bad news: ... my pigs are still bipedal. Any ideas for why this is happening?

Posted

How's that? I overrode the original model in the hashmap for entities, so I'm not sure what more I could do.

 

Edit: Well, that is extremely bizarre. I decided to update my mod to .1240, and once I transferred the files over I could see that the back legs didn't actually have a texture. Which is WEIRD because I DID texture them, and they showed up absolutely fine on eclipse. It's only when I moved folders that that showed up.

 

In any case, problems solved!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • It is 1.12.2 - I have no idea if there is a 1.12 pack
    • Okay, but does the modpack works with 1.12 or just with 1.12.2, because I need the Forge client specifically for Minecraft 1.12, not 1.12.2
    • 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() ); } }  
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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