Jump to content

Recommended Posts

Posted

good nigths 

 

this is what ill  talking about

 

this happed just in the normal client, in eclipse it works well

soo i was using forge-1.8-11.14.1.1336 soo i update  it, eclipse and normal minecraft are now forge-1.8-11.14.1.1350 then  recompile and it still white and green in the normal client but eclipse works normal.

 

this looks like a textures problem but it works on eclipse

the las thing i do was create two pistols and a bullet clip,  so i check again and all textures are 512x512 png  and all folders are lowerCase  and all routes are fine

 

 

and it works on eclipse soo du not know

 

Posted

You must have done something REALLY bad in rendering code. What rendering events are you using? Codes?

Probably forgot to reset GL state or some blending mode.

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

Posted

nop

 

noting of complex rendering

all items are just plane json files

i do animations switching textures 

 

i notice someting that have cause me this teory of the limit in the textures amoung

 

the last i make was two guns and a bullet clip

every gun uses like 23 json files and the clip uses 45

there are so many coz this guns are complez every guns works whith three types of bullet clip all animated load unload

every bullet clip works whith two kinds of munition all animated

all the bullet clips are sub items from the cargadorFM9X class

 

 

 

mercenaryModTextures.java


ModelBakery.addVariantName(MercenaryModItems.pistolaFM92, new String[]{
    
    		"modmercenario:pistolamf92/pistolaFM92_icono",
    		"modmercenario:pistolamf92/pistolaFM92_SC",
    		    		
    		"modmercenario:pistolamf92/pistolaFM92_CC",
    		"modmercenario:pistolamf92/pistolaFM92_CC_A00",
    		"modmercenario:pistolamf92/pistolaFM92_CC_A01",
    		"modmercenario:pistolamf92/pistolaFM92_CC_A02",
    		"modmercenario:pistolamf92/pistolaFM92_CC_A03",
    		"modmercenario:pistolamf92/pistolaFM92_CC_A04",
    		"modmercenario:pistolamf92/pistolaFM92_CC_disparo",
    		
    		"modmercenario:pistolamf92/pistolaFM92_CL",
    		"modmercenario:pistolamf92/pistolaFM92_CL_A00",
    		"modmercenario:pistolamf92/pistolaFM92_CL_A01",
    		"modmercenario:pistolamf92/pistolaFM92_CL_A02",
    		"modmercenario:pistolamf92/pistolaFM92_CL_A03",
    		"modmercenario:pistolamf92/pistolaFM92_CL_A04",
    		"modmercenario:pistolamf92/pistolaFM92_CL_disparo",

    		"modmercenario:pistolamf92/pistolaFM92_CG",
    		"modmercenario:pistolamf92/pistolaFM92_CG_A00",
    		"modmercenario:pistolamf92/pistolaFM92_CG_A01",
    		"modmercenario:pistolamf92/pistolaFM92_CG_A02",
    		"modmercenario:pistolamf92/pistolaFM92_CG_A03",
    		"modmercenario:pistolamf92/pistolaFM92_CG_A04",
    		"modmercenario:pistolamf92/pistolaFM92_CG_disparo",
    		   		

    });
    
    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModItems.pistolaFM92,0 , 
    new ModelResourceLocation("modmercenario:pistolamf92/pistolaFM92_icono", "inventory"));
    
    
    
    ModelBakery.addVariantName(MercenaryModItems.pistolaFM93R, new String[]{
    	    
    		"modmercenario:pistolamf93r/pistolaFM93R_icono",
    		"modmercenario:pistolamf93r/pistolaFM93R_SC",
    		    		
    		"modmercenario:pistolamf93r/pistolaFM93R_CC",
    		"modmercenario:pistolamf93r/pistolaFM93R_CC_A00",
    		"modmercenario:pistolamf93r/pistolaFM93R_CC_A01",
    		"modmercenario:pistolamf93r/pistolaFM93R_CC_A02",
    		"modmercenario:pistolamf93r/pistolaFM93R_CC_A03",
    		"modmercenario:pistolamf93r/pistolaFM93R_CC_A04",
    		"modmercenario:pistolamf93r/pistolaFM93R_CC_disparo",
    		
    		"modmercenario:pistolamf93r/pistolaFM93R_CL",
    		"modmercenario:pistolamf93r/pistolaFM93R_CL_A00",
    		"modmercenario:pistolamf93r/pistolaFM93R_CL_A01",
    		"modmercenario:pistolamf93r/pistolaFM93R_CL_A02",
    		"modmercenario:pistolamf93r/pistolaFM93R_CL_A03",
    		"modmercenario:pistolamf93r/pistolaFM93R_CL_A04",
    		"modmercenario:pistolamf93r/pistolaFM93R_CL_disparo",

    		"modmercenario:pistolamf93r/pistolaFM93R_CG",
    		"modmercenario:pistolamf93r/pistolaFM93R_CG_A00",
    		"modmercenario:pistolamf93r/pistolaFM93R_CG_A01",
    		"modmercenario:pistolamf93r/pistolaFM93R_CG_A02",
    		"modmercenario:pistolamf93r/pistolaFM93R_CG_A03",
    		"modmercenario:pistolamf93r/pistolaFM93R_CG_A04",
    		"modmercenario:pistolamf93r/pistolaFM93R_CG_disparo"
    		   		

    });
    
    
    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModItems.pistolaFM93R,0 , 
    new ModelResourceLocation("modmercenario:pistolamf93r/pistolaFM93R_icono", "inventory"));
    
    
    
    ModelBakery.addVariantName(MercenaryModItems.cargadorFM9X, new String[]{
    	    
    		"modmercenario:cargadorfm9x/cargadorFM9X_CC_icono",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CG_icono",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CL_icono",
    		
    		"modmercenario:cargadorfm9x/cargadorFM9X_CC_A00",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CC_A01",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CC_A02",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CC_A03",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CC_A04",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CC_b",    // clip whith bullets
    		"modmercenario:cargadorfm9x/cargadorFM9X_CC_e",    // empty clip
    	
    		"modmercenario:cargadorfm9x/cargadorFM9X_CCr_A00",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CCr_A01",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CCr_A02",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CCr_A03",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CCr_A04",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CCr_b",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CCr_e",
    		
    		"modmercenario:cargadorfm9x/cargadorFM9X_CG_A00",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CG_A01",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CG_A02",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CG_A03",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CG_A04",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CG_b",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CG_e",
    		
    		"modmercenario:cargadorfm9x/cargadorFM9X_CGr_A00",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CGr_A01",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CGr_A02",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CGr_A03",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CGr_A04",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CGr_b",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CGr_e",
    		
    		"modmercenario:cargadorfm9x/cargadorFM9X_CL_A00",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CL_A01",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CL_A02",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CL_A03",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CL_A04",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CL_b",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CL_e",
    		
    		"modmercenario:cargadorfm9x/cargadorFM9X_CLr_A00",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CLr_A01",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CLr_A02",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CLr_A03",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CLr_A04",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CLr_b",
    		"modmercenario:cargadorfm9x/cargadorFM9X_CLr_e"
    		   		
    		
    });
    	    
    
    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModItems.cargadorFM9X,1 , 
    new ModelResourceLocation("modmercenario:cargadorfm9x/cargadorFM9X_CC_icono", "inventory"));
    
    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModItems.cargadorFM9X,2 , 
    new ModelResourceLocation("modmercenario:cargadorfm9x/cargadorFM9X_CC_icono", "inventory"));
    	    
    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModItems.cargadorFM9X,3 , 
    new ModelResourceLocation("modmercenario:cargadorfm9x/cargadorFM9X_CC_icono", "inventory"));
    
    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModItems.cargadorFM9X,4 , 
    new ModelResourceLocation("modmercenario:cargadorfm9x/cargadorFM9X_CL_icono", "inventory"));
    	    
    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModItems.cargadorFM9X,5 , 
    new ModelResourceLocation("modmercenario:cargadorfm9x/cargadorFM9X_CL_icono", "inventory"));

    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModItems.cargadorFM9X,6 , 
    new ModelResourceLocation("modmercenario:cargadorfm9x/cargadorFM9X_CL_icono", "inventory"));

    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModItems.cargadorFM9X,7 , 
    new ModelResourceLocation("modmercenario:cargadorfm9x/cargadorFM9X_CG_icono", "inventory"));

    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModItems.cargadorFM9X,8 , 
    new ModelResourceLocation("modmercenario:cargadorfm9x/cargadorFM9X_CG_icono", "inventory"));

    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModItems.cargadorFM9X,9 , 
    new ModelResourceLocation("modmercenario:cargadorfm9x/cargadorFM9X_CG_icono", "inventory"));

 

 

if I  //coment the textures for //mf92 and for the clips //cargadorFM9X  compile and run, in the normal client

the textures of the world are now normal and the mf93r work whit all his textures

 

then revert and //coment //mf93r and //cargadorFM9x compile

the textures of the world are now normal and the mf92 work whit all his textures

 

then //coment the two guns and only left  the cargadorFM9x textures compile

ñaa the word is white and green again

 

//coment the two guns and only left  the first 17 textures from cargadorFM9x compile test

the world is normal and the clip works whit only the textures representing the shorth versions of the clip

 

//coment a lot of textures from other //items and the two //guns, and uncomment all the textures for the clip, compile

the world is normal all the clips works whit all his textures everithing else works including the two type of bullets animations, just missing the textures for all the comented items and the guns

 

afther see this tests  i come whith the teory of a limit i dont thing is for amount but for size cos i have register like 405 textures for all including tools  guns and clips and are 235 items for all and 2 blocks

most of mi items are 64x textures and the fire guns are 512x textures

 

In eclipse this is not a trouble looks like is not afected for whatever this it is,

everithing works on eclipse whitout having to comment nothing

 

and everything works individualy when tested in normal client  commenting the textures for other items soo there is no erros in routes names or png size/type

 

i dont wanna remove nothing from the actual mod, and more  i wanna add more guns but look like is no room for more

i tink i have to split this mod in parts   

 

what you tink ??

Posted

I'd go with standard debugging procedure.

 

Comment out everything in your mod (at most basic level - registy) and add one after another.

1st I'd check events (if you use any) then go with item registration and rendering.

 

There is not much to say to help you, are you sure you are not using anything in RenderGameOverlay? How are you drawing your gui?

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

Posted

weel the last time i test the mod and works normal was monday

that day i begin doing the code for the guns and the clip

the Thursday end and everithing works on eclipse so i decide to test mi new guns in the normal minecraft client and there it goes green and white

 

soo the trouble begin whith the new guns,

these are new coz i alredy have colt1911 fn57 fnp90 and that 3 are are older than monday

 

so i have five guns

 

aniway i do guns the way vainilla bow works

 

lets make some tests

 

first this is in the normal client minecraft using mi mod plus this others mods i like to test aside others mod to be sure it wont mess whit something else

/home/tenchi/.minecraft/mods/bamsgrave-1.8-1.4.3.jar

/home/tenchi/.minecraft/mods/BattleTowers-1.8.jar

/home/tenchi/.minecraft/mods/Birds-mod-by-silvercatcher-1.8.jar

/home/tenchi/.minecraft/mods/Bloodmoon-1.1.jar

/home/tenchi/.minecraft/mods/Cute-mob-models-mod-by-yarrmateys-1.8.jar

/home/tenchi/.minecraft/mods/CyanosLootableBodies-1.3.4.jar

/home/tenchi/.minecraft/mods/Damage-Indicators-Mod-1.8.jar

/home/tenchi/.minecraft/mods/DynamicLights-1.8.jar

/home/tenchi/.minecraft/mods/Ender-Zoo-Mod-1.8.jar

/home/tenchi/.minecraft/mods/forge_TheEpicarnoMod-1.0.9.7.jar

/home/tenchi/.minecraft/mods/InventoryTweaks-1.59-beta-175.jar

/home/tenchi/.minecraft/mods/iPixelis-Gender-Mod-1.8.jar

/home/tenchi/.minecraft/mods/LavaBoat-Mod-1.8.jar

/home/tenchi/.minecraft/mods/Minions-1.8.jar

/home/tenchi/.minecraft/mods/MrCrayfishs-Furniture-Mod-1.8.jar

/home/tenchi/.minecraft/mods/Roguelike-Dungeons-Mod-1.8.jar

/home/tenchi/.minecraft/mods/Ruins-1.8.jar

/home/tenchi/.minecraft/mods/Sound-Filters-Mod-1.8.jar

/home/tenchi/.minecraft/mods/UpdateCheckerMod-1.8.jar

/home/tenchi/.minecraft/mods/vintagetg-1.8-1.0.2.jar

/home/tenchi/.minecraft/mods/World-Tools-Mod-1.8.jar

 

/home/tenchi/.minecraft/mods/modmercenario-1.8.jar

 

 

first test

i dont mess whit the guns code i only /*comment*/ the textures to dissabling textures for mf92 mf93r and cagadormf9x  to test the old guns.

 

second test

still whithout messing whit the code this time i /*comment*/ the textures for the old guns and let only to test the new guns

 

thirth test

whithout messing whit the code i uncoment all the textures for all the items everithing is enable

to the left eclipse minecrat all textures work  to the rigth nomrmal client minecraft everiting is green and white

 

four test

this time i coment every texture except for fireguns but the bullet clip  cargadorFM9X

 

 

conclusions

 

it is a limit aplicated to the size of the images png.  but only affect the client minecraft, but not the eclipse minecraft

cargadorFM9X is to big for this limit and if resize it to 128x128 it looks affull

 

 

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.