Jump to content

Recommended Posts

Posted (edited)

I am trying to develop a mod for 1.16.1, and I am having trouble rending a throwable item when it is in flight. My main problem is that most other tutorials or suggestions use RendererSnowball (or Snowball Renderer, I can't remember) which doesn't seem to exist for versions after 1.15. So is there an adequate subsuite that could help me? For reference this is my ClientEventBusSubscriber class: 

package com.codex.cottage_craft.util;

import...

@Mod.EventBusSubscriber(value=Dist.CLIENT,modid= CottageCraft.MOD_ID)
public class ClientEventBusSubscriber {

	/* -main methods- */
	/** A method that registers the models through a model registry event.
	 * 		@param	event	The model registry event that registers the models of entities and blocks. */
	@SubscribeEvent
    public static void onRegisterModelsEvent(ModelRegistryEvent event) {
        registerEntityRenderers();
    }
	
	
	/* -helper methods- */
	/** A helper method that targets rendering entity models specifically. */
	private static void registerEntityRenderers() {
    	
		// registers the silver pearl entity with the rendering factory that returns a sprite render.
    	RenderingRegistry.registerEntityRenderingHandler(
    			EntityCollection.SILVER_ENDER_PEARL_ENTITY.get(),
    			new IRenderFactory<SilverEnderPearlEntity> () {
					public EntityRenderer<? super SilverEnderPearlEntity> createRenderFor(EntityRendererManager manager) {
						return new SpriteRenderer<SilverEnderPearlEntity> (manager, Minecraft.getInstance().getItemRenderer());
                    }
                }
        );

    }
	
}

I was hoping to replace the "SpriteRenderer<SilverEnderPearlEntity>" with a SnowballRenderer or RendererSnowball. Any help would be appreciated, including the way Snowball and Ender Pearls are now rendered. Also, the error that is actually occurring for me is a Null Pointer error but even if I were to resolve it I don't think it would work.

Edited by Codex79
The problem is fixed.
Posted (edited)

Snowballs, ender pearls, eggs, eyes of ender...are all rendered through the SpriteRenderer..you may want to explore a bit that class and also you may find this example very useful: https://github.com/TheGreyGhost/MinecraftByExample/tree/1-16-3-final/src/main/java/minecraftbyexample/mbe81_entity_projectile

 

Edit: wooops, sorry TheGreyGhost, you were 1 second faster than me

Edited by Beethoven92
  • Haha 1

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

Posted (edited)

Thank you both. Unfortunately, I keep getting a null pointer exception whenever I throw the ender pearl and cannot for the life of me figure out why. But I think I'm just going to use EntityType.ENDER_PEARL instead of the one I made.

 

EDIT: Also I did check out the GitHub and I'm pretty sure I'm doing everything right for the registerEntityRenderingHandler. I think the exception exists in my EntityCollection where I build the entity type, but as I said before I think I'm going to forgo using a custom entity type. 

Edited by Codex79
Posted
54 minutes ago, Codex79 said:

but as I said before I think I'm going to forgo using a custom entity type. 

To create a custom entity, it needs to be specified with a custom type. Otherwise, vanilla packets will take a semi-precedent when synchronizing data which can be problematic in a lot of cases. In the case of a projectile entity, it only needs the attached renderer and the registry entry.

Posted (edited)
1 hour ago, Beethoven92 said:

Usually logs will tell you where the null pointer exception was thrown at, reading them may be useful.

I have been reading the logs; however, they only tell me where the null pointer exception occurs in the forge referenced libraries and not in my actual code so I'm at a loss. It seems to have to do with the Minecraft.getInstance().getRenderingManager() but I'm not sure if that is null or just using an associated null object. I've been trying to debug my code to no avail. Here's the relevant crash report: 

---- Minecraft Crash Report ----
// I blame Dinnerbone.

Time: 11/26/20 4:38 PM
Description: Unexpected error

java.lang.NullPointerException: Unexpected error
	at net.minecraft.client.renderer.entity.EntityRendererManager.shouldRender(EntityRendererManager.java:238) ~[forge-1.16.1-32.0.108_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.WorldRenderer.updateCameraAndRender(WorldRenderer.java:983) ~[forge-1.16.1-32.0.108_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.GameRenderer.renderWorld(GameRenderer.java:613) ~[forge-1.16.1-32.0.108_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.GameRenderer.updateCameraAndRender(GameRenderer.java:434) ~[forge-1.16.1-32.0.108_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:988) ~[forge-1.16.1-32.0.108_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:587) ~[forge-1.16.1-32.0.108_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:184) ~[forge-1.16.1-32.0.108_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121] {}
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_121] {}
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_121] {}
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121] {}
	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.16.1-32.0.108_mapped_snapshot_20200514-1.16-recomp.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-6.1.3.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-6.1.3.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-6.1.3.jar:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-6.1.3.jar:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-6.1.3.jar:?] {}
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:105) [forge-1.16.1-32.0.108_mapped_snapshot_20200514-1.16-recomp.jar:?] {}


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

-- Head --
Thread: Render thread
Stacktrace:
	at net.minecraft.client.renderer.entity.EntityRendererManager.shouldRender(EntityRendererManager.java:238)
	at net.minecraft.client.renderer.WorldRenderer.updateCameraAndRender(WorldRenderer.java:983)
	at net.minecraft.client.renderer.GameRenderer.renderWorld(GameRenderer.java:613)

And here is my custom entity class: 

public class SilverEnderPearlEntity extends ProjectileItemEntity {

	/* -constructors- */
	/** An initialization constructor that overrides a constructor in EnderPearlEntity.
	 * 		@param	worldIn		The current world that is loaded.
	 * 		@param	throwerIn	The entity doing the throwing, e.g., a player. */
	public SilverEnderPearlEntity(World worldIn, LivingEntity throwerIn) {
		super(/*EntityType.ENDER_PEARL*/EntityCollection.SILVER_ENDER_PEARL_ENTITY.get(), throwerIn, worldIn);}
	
	/** Another initialization constructor that overrides a constructor in EnderPearlEntity.
	 * 		@param	entityType	The type of entity throwing the ender pearl.
	 * 		@param	worldIn		The current world that is loaded. */
	public SilverEnderPearlEntity(EntityType<? extends ProjectileItemEntity> entityType, World worldIn) {
		super(entityType, worldIn);}
	
	/** Another initialization constructor that overrides a constructor in EnderPearlEntity.
	 * 		@param	worldIn	The current world that is loaded.
	 *		@param	x		The x position that the entity (and player) will be sent to.
	 *		@param	y		The y position that the entity (and player) will be sent to.
	 *		@param	z		The z position that the entity (and player) will be sent to. */
	@OnlyIn(Dist.CLIENT)
	public SilverEnderPearlEntity(World worldIn, double x, double y, double z) {
		super(/*EntityType.ENDER_PEARL*/EntityCollection.SILVER_ENDER_PEARL_ENTITY.get(), x, y, z, worldIn);}
	
	
	/* -entity rendering methods- */
	/** A method that returns the spawn packet required to be overridden by custom entity classes. 
	 * 		@return	A spawn packet used by throwable entities. */
	public IPacket<?> createSpawnPacket() {
		   return NetworkHooks.getEntitySpawningPacket(this);}
	
	/** A method that returns the default item that uses this entity, i.e., the silver ender pearl. 
	 * 		@return	The default item that uses this entity. */
	protected Item getDefaultItem() {
		return /*Items.ENDER_PEARL;*/EndTab.SILVER_ENDER_PEARL.get();}
	
	
	/* -important overridden methods- */
	/** Called whenever the silver ender pearl hits only an entity.
	 * 		@param	result	The path of the ray tracing result. */
	protected void onEntityHit(EntityRayTraceResult result) {
	      super.onEntityHit(result);
	      result.getEntity().attackEntityFrom(DamageSource.causeThrownDamage(this, this.func_234616_v_()), 0.0F);}
	
	/** Called whenever the silver ender pearl hits an entity or block.
	 * 		@param	result	The resulting path that is given by throwing the ender pearl. */
	@SuppressWarnings("deprecation")
	protected void onImpact(RayTraceResult result) {
		
		// gets the entity that activated the silver ender pearl.
		super.onImpact(result);
		Entity entity = this.func_234616_v_();

		// if the world is not remote and the ender pearl entity has not been removed yet.
		if(!this.world.isRemote && !this.removed) {
			
			// if the entity is a server player entity.
			if(entity instanceof ServerPlayerEntity) {
				ServerPlayerEntity serverPlayerEntity = (ServerPlayerEntity) entity;
				if(serverPlayerEntity.connection.getNetworkManager().isChannelOpen() && serverPlayerEntity.world == this.world && !serverPlayerEntity.isSleeping()) {
					
					// creates the teleport event.
					EnderTeleportEvent event = new EnderTeleportEvent(
							serverPlayerEntity, this.getPosX(),
							this.getPosY(), this.getPosZ(), 2.5f);
					if(!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) {
						
						// spawns a random mob if the player is unlucky.
						if(this.rand.nextFloat() < 0.05F && this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING)) {
							
							EndermiteEntity endermiteEntity = EntityType.ENDERMITE.create(this.world);
							endermiteEntity.setSpawnedByPlayer(true);
							endermiteEntity.setLocationAndAngles(entity.getPosX(), entity.getPosY(), entity.getPosZ(), entity.rotationYaw, entity.rotationPitch);
							
							this.world.addEntity(endermiteEntity);}
	
						// if their is a passenger, the passenger will stop riding.
						if (entity.isPassenger())
							entity.stopRiding();
	
						// set the new position of the player.
						entity.setPositionAndUpdate(event.getTargetX(), event.getTargetY(), event.getTargetZ());
						entity.fallDistance = 0.0F;
						entity.attackEntityFrom(DamageSource.FALL, event.getAttackDamage());}}}
			
			// if the entity is something other than a player.
			else if (entity != null) {
				entity.setPositionAndUpdate(this.getPosX(), this.getPosY(), this.getPosZ());
				entity.fallDistance = 0.0F;}

			// remove this silver ender pearl entity.
			this.remove();}}
	
	
	/* -other overridden methods- */
	/** Called to update properties of the entity. */
	public void tick() {
		
		Entity entity = this.func_234616_v_();
		
		if (entity instanceof PlayerEntity && !entity.isAlive()) 
			this.remove();
		else 
			super.tick();}

	/** A method that changes the dimension if the ender pearl is thrown into an end gate way or
	 *	something to that effect.
	 *		@param	serverWorldIn	The current server world that is loaded in.
	 *		@param	teleporter		An object that handles positioning during a dimension change.
	 *		@return	An entity in a differing dimension. */
	public Entity changeDimension(ServerWorld serverWorldIn, net.minecraftforge.common.util.ITeleporter teleporter) {
		
		Entity entity = this.func_234616_v_();
		if (entity != null && entity.world.func_234923_W_() != serverWorldIn.func_234923_W_())
			this.setShooter((Entity)null);

		return super.changeDimension(serverWorldIn, teleporter);}
	
}

And where I initialize the entity type:

public class EntityCollection {

	/* -entity registry objects- */
	/** A registry object for our silver ender pearl entities. */
	public static RegistryObject< EntityType<SilverEnderPearlEntity> > SILVER_ENDER_PEARL_ENTITY;
	
	
	/* -static method initialization- */
	/** A method that acts like a constructor to initialize our static instance objects and add
	 * 	them to the registry. */
	public static void init() {
		
		SILVER_ENDER_PEARL_ENTITY = EntityRegistryHandler.ENTITIES.register("silver_ender_pearl", 
				() -> EntityType.Builder.<SilverEnderPearlEntity>create(
						SilverEnderPearlEntity::new, EntityClassification.MISC)
				.size(0.25f, 0.25f).func_233606_a_(4).func_233608_b_(10)
				.build(new ResourceLocation(CottageCraft.MOD_ID, "silver_ender_pearl").toString()));}
	
}

 

1 hour ago, ChampionAsh5357 said:

To create a custom entity, it needs to be specified with a custom type. Otherwise, vanilla packets will take a semi-precedent when synchronizing data which can be problematic in a lot of cases.

Thank you. I'll keep that in mind since I had no idea and thought using EntityType.ENDER_PEARL would be appropriate if I or someone else didn't come up with a solution.

Edited by Codex79
Posted
@Mod.EventBusSubscriber(value=Dist.CLIENT,modid= CottageCraft.MOD_ID)

You are registering your event handler to the wrong bus, so your registerEntityRenderers() is never executed. Remember that when no bus is specified, default goes to the forge bus. ModelRegistryEvent is fired on the mod bus

  • Thanks 1

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

Posted
44 minutes ago, Beethoven92 said:

@Mod.EventBusSubscriber(value=Dist.CLIENT,modid= CottageCraft.MOD_ID)

You are registering your event handler to the wrong bus, so your registerEntityRenderers() is never executed. Remember that when no bus is specified, default goes to the forge bus. ModelRegistryEvent is fired on the mod bus

Thank you so much! I added a bus = Mod.EventBusSubscriber.Bus.MOD in the parentheses and that fixed it.

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

    • 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.