Jump to content

Recommended Posts

Posted

It seems that the game crashes when trying to move a tile entity with piston (tested with vanilla chest and piston).

 

---- Minecraft Crash Report ----
// Surprise! Haha. Well, this is awkward.

Time: 3/4/19 3:12 AM
Description: Rendering Block Entity

java.lang.NullPointerException: Rendering Block Entity
at net.minecraft.client.renderer.tileentity.TileEntityPistonRenderer.func_188186_a(SourceFile:80)
at net.minecraft.client.renderer.tileentity.TileEntityPistonRenderer.func_199341_a(SourceFile:56)
at net.minecraft.client.renderer.tileentity.TileEntityPistonRenderer.func_199341_a(SourceFile:23)
at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.func_203602_a(TileEntityRendererDispatcher.java:146)
at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.func_180546_a(TileEntityRendererDispatcher.java:122)
at net.minecraft.client.renderer.WorldRenderer.func_180446_a(WorldRenderer.java:626)
at net.minecraft.client.renderer.GameRenderer.func_181560_a(GameRenderer.java:816)
at net.minecraft.client.renderer.GameRenderer.func_78471_a(GameRenderer.java:743)
at net.minecraft.client.renderer.GameRenderer.func_195458_a(GameRenderer.java:607)
at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:793)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:358)
at net.minecraft.client.main.Main.main(SourceFile:144)
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:497)
at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:51)
at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$267/2113604623.call(Unknown Source)
at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:19)
at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:32)
at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:50)
at cpw.mods.modlauncher.Launcher.run(Launcher.java:56)
at cpw.mods.modlauncher.Launcher.main(Launcher.java:42)

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

-- Head --
Thread: Client thread
Stacktrace:
at net.minecraft.client.renderer.tileentity.TileEntityPistonRenderer.func_188186_a(SourceFile:80)
at net.minecraft.client.renderer.tileentity.TileEntityPistonRenderer.func_199341_a(SourceFile:56)
at net.minecraft.client.renderer.tileentity.TileEntityPistonRenderer.func_199341_a(SourceFile:23)

-- Block Entity Details --
Details:
Name: minecraft:piston // net.minecraft.tileentity.TileEntityPiston
Block: Block{minecraft:moving_piston}[facing=north,type=sticky]
Block location: World: (148,72,225), Chunk: (at 4,4,1 in 9,14; contains blocks 144,0,224 to 159,255,239), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Block: Block{minecraft:moving_piston}[facing=north,type=sticky]
Block location: World: (148,72,225), Chunk: (at 4,4,1 in 9,14; contains blocks 144,0,224 to 159,255,239), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Stacktrace:
at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.func_203602_a(TileEntityRendererDispatcher.java:146)
at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.func_180546_a(TileEntityRendererDispatcher.java:122)
at net.minecraft.client.renderer.WorldRenderer.func_180446_a(WorldRenderer.java:626)
at net.minecraft.client.renderer.GameRenderer.func_181560_a(GameRenderer.java:816)
at net.minecraft.client.renderer.GameRenderer.func_78471_a(GameRenderer.java:743)

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityPlayerSP['ElginKhaos'/204, l='MpServer', x=147.16, y=72.00, z=224.66]]
Chunk stats: MultiplayerChunkCache: 683, 683
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options: {}
Level spawn location: World: (144,73,224), Chunk: (at 0,4,0 in 9,14; contains blocks 144,0,224 to 159,255,239), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Level time: 404 game time, 404 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: creative (ID 1). Hardcore: false. Cheats: false
Forced entities: 96 total; [EntityZombie['Zombie'/128, l='MpServer', x=185.50, y=41.00, z=291.50], EntityBat['Bat'/129, l='MpServer', x=187.66, y=31.13, z=296.02], EntitySkeleton['Skeleton'/130, l='MpServer', x=177.50, y=60.00, z=294.89], EntitySkeleton['Skeleton'/131, l='MpServer', x=180.23, y=60.00, z=294.49], EntitySkeleton['Skeleton'/132, l='MpServer', x=187.30, y=60.00, z=294.50], EntityCreeper['Creeper'/522, l='MpServer', x=140.50, y=62.00, z=160.50], EntityZombie['Zombie'/139, l='MpServer', x=206.44, y=39.00, z=171.10], EntityBat['Bat'/140, l='MpServer', x=196.46, y=35.92, z=181.47], EntitySalmon['Salmon'/141, l='MpServer', x=206.50, y=60.64, z=190.50], EntitySalmon['Salmon'/142, l='MpServer', x=203.32, y=61.01, z=185.81], EntitySkeleton['Skeleton'/143, l='MpServer', x=188.58, y=32.00, z=196.73], EntitySkeleton['Skeleton'/144, l='MpServer', x=193.50, y=34.00, z=189.68], EntityCreeper['Creeper'/145, l='MpServer', x=195.50, y=32.00, z=222.50], EntityBat['Bat'/149, l='MpServer', x=198.30, y=32.29, z=301.51], EntitySheep['Sheep'/154, l='MpServer', x=211.96, y=75.00, z=156.66], EntitySheep['Sheep'/155, l='MpServer', x=210.90, y=75.00, z=157.03], EntitySkeleton['Skeleton'/411, l='MpServer', x=84.50, y=16.00, z=144.50], EntitySheep['Sheep'/156, l='MpServer', x=214.23, y=75.00, z=156.78], EntitySheep['Sheep'/157, l='MpServer', x=212.00, y=75.00, z=159.00], EntityZombie['Zombie'/158, l='MpServer', x=211.50, y=18.00, z=200.50], EntitySalmon['Salmon'/159, l='MpServer', x=215.50, y=60.66, z=196.50], EntitySalmon['Salmon'/160, l='MpServer', x=217.56, y=62.48, z=196.59], EntitySalmon['Salmon'/161, l='MpServer', x=218.31, y=60.33, z=197.67], EntityCreeper['Creeper'/162, l='MpServer', x=222.50, y=20.00, z=216.50], EntityBat['Bat'/163, l='MpServer', x=219.37, y=42.11, z=241.70], EntityBat['Bat'/164, l='MpServer', x=225.60, y=41.01, z=235.41], EntityCreeper['Creeper'/165, l='MpServer', x=223.50, y=13.00, z=249.50], EntitySalmon['Salmon'/38, l='MpServer', x=68.96, y=58.59, z=145.32], EntitySkeleton['Skeleton'/166, l='MpServer', x=222.50, y=22.00, z=241.50], EntitySalmon['Salmon'/39, l='MpServer', x=67.66, y=61.21, z=147.22], EntityParrot['Parrot'/167, l='MpServer', x=222.00, y=97.00, z=262.91], EntityZombie['Zombie'/168, l='MpServer', x=205.23, y=29.00, z=280.69], EntityPig['Pig'/169, l='MpServer', x=218.16, y=69.17, z=302.39], EntityChicken['Chicken'/170, l='MpServer', x=226.00, y=68.00, z=239.00], EntityParrot['Parrot'/44, l='MpServer', x=69.00, y=94.00, z=207.00], EntitySheep['Sheep'/172, l='MpServer', x=224.90, y=67.00, z=225.00], EntityParrot['Parrot'/45, l='MpServer', x=72.62, y=94.00, z=205.40], EntityParrot['Parrot'/173, l='MpServer', x=226.28, y=75.41, z=238.27], EntitySkeleton['Skeleton'/174, l='MpServer', x=224.50, y=13.00, z=247.50], EntityZombie['Zombie'/431, l='MpServer', x=124.50, y=20.00, z=146.50], EntitySkeleton['Skeleton'/177, l='MpServer', x=226.50, y=30.00, z=253.50], EntityZombie['Zombie'/178, l='MpServer', x=226.50, y=30.00, z=254.50], EntityZombieVillager['Zombie Villager'/51, l='MpServer', x=90.50, y=19.00, z=171.50], EntityZombie['Zombie'/179, l='MpServer', x=225.53, y=30.00, z=253.50], EntitySkeleton['Skeleton'/52, l='MpServer', x=95.50, y=22.00, z=192.50], EntityZombie['Zombie'/53, l='MpServer', x=85.50, y=65.00, z=287.50], EntityZombie['Zombie'/54, l='MpServer', x=89.08, y=66.00, z=298.63], EntityBat['Bat'/65, l='MpServer', x=108.13, y=44.11, z=151.30], EntityBat['Bat'/66, l='MpServer', x=103.31, y=43.06, z=155.95], EntityZombie['Zombie'/67, l='MpServer', x=100.50, y=18.00, z=168.50], EntityBat['Bat'/68, l='MpServer', x=104.25, y=45.10, z=164.35], EntitySkeleton['Skeleton'/70, l='MpServer', x=96.50, y=22.00, z=192.50], EntityPig['Pig'/71, l='MpServer', x=100.00, y=65.00, z=197.00], EntityParrot['Parrot'/72, l='MpServer', x=103.98, y=65.00, z=298.94], EntityParrot['Parrot'/73, l='MpServer', x=105.85, y=66.00, z=297.21], EntityItem['Red Mushroom'/203, l='MpServer', x=114.36, y=50.96, z=288.03], EntitySkeleton['Skeleton'/77, l='MpServer', x=114.50, y=12.00, z=158.50], EntitySkeleton['Skeleton'/78, l='MpServer', x=127.50, y=19.00, z=150.50], EntitySkeleton['Skeleton'/79, l='MpServer', x=123.50, y=19.00, z=149.50], EntitySkeleton['Skeleton'/80, l='MpServer', x=125.50, y=19.00, z=147.50], EntityParrot['Parrot'/81, l='MpServer', x=114.00, y=95.00, z=244.00], EntityParrot['Parrot'/82, l='MpServer', x=111.57, y=93.00, z=240.54], EntityBat['Bat'/93, l='MpServer', x=151.68, y=25.03, z=152.65], EntitySpider['Spider'/349, l='MpServer', x=214.04, y=40.00, z=171.29], EntityCreeper['Creeper'/94, l='MpServer', x=150.50, y=25.00, z=198.50], EntityCreeper['Creeper'/95, l='MpServer', x=155.15, y=25.00, z=200.48], EntitySpider['Spider'/96, l='MpServer', x=153.59, y=25.00, z=201.80], EntitySpider['Spider'/480, l='MpServer', x=216.50, y=37.00, z=255.50], EntityParrot['Parrot'/97, l='MpServer', x=158.00, y=73.00, z=219.00], EntityParrot['Parrot'/98, l='MpServer', x=150.24, y=78.97, z=255.89], EntitySpider['Spider'/482, l='MpServer', x=214.50, y=37.00, z=254.50], EntityBat['Bat'/104, l='MpServer', x=158.25, y=36.64, z=155.75], EntitySquid['Squid'/105, l='MpServer', x=170.93, y=60.74, z=183.06], EntitySalmon['Salmon'/106, l='MpServer', x=167.51, y=59.74, z=185.10], EntitySalmon['Salmon'/107, l='MpServer', x=167.50, y=59.00, z=183.88], EntitySquid['Squid'/108, l='MpServer', x=173.60, y=59.88, z=184.13], EntitySquid['Squid'/109, l='MpServer', x=173.10, y=56.44, z=182.04], EntitySquid['Squid'/110, l='MpServer', x=167.24, y=58.63, z=185.92], EntitySquid['Squid'/111, l='MpServer', x=169.26, y=58.67, z=183.43], EntitySalmon['Salmon'/112, l='MpServer', x=169.64, y=59.89, z=182.51], EntitySalmon['Salmon'/113, l='MpServer', x=166.09, y=59.53, z=182.58], EntitySkeleton['Skeleton'/114, l='MpServer', x=175.50, y=21.00, z=246.50], EntitySkeleton['Skeleton'/115, l='MpServer', x=163.50, y=65.00, z=284.50], EntityZombie['Zombie'/116, l='MpServer', x=171.82, y=61.00, z=291.97], EntitySheep['Sheep'/117, l='MpServer', x=162.00, y=71.00, z=298.00], EntitySheep['Sheep'/118, l='MpServer', x=165.00, y=72.00, z=298.00], EntitySheep['Sheep'/119, l='MpServer', x=166.00, y=72.00, z=295.00], EntityCreeper['Creeper'/375, l='MpServer', x=100.50, y=24.00, z=194.50], EntitySkeleton['Skeleton'/376, l='MpServer', x=100.50, y=24.00, z=193.50], EntityParrot['Parrot'/122, l='MpServer', x=183.00, y=79.00, z=268.00], EntityParrot['Parrot'/123, l='MpServer', x=185.00, y=81.00, z=268.00], EntityParrot['Parrot'/124, l='MpServer', x=190.00, y=80.00, z=281.00], EntityPlayerSP['ElginKhaos'/204, l='MpServer', x=147.16, y=72.00, z=224.66], EntityZombie['Zombie'/125, l='MpServer', x=186.50, y=41.00, z=295.50], EntityZombie['Zombie'/126, l='MpServer', x=186.50, y=41.00, z=296.50], EntityZombie['Zombie'/127, l='MpServer', x=184.50, y=41.00, z=294.50]]
Retry entities: 0 total; []
Server brand: forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.func_72914_a(WorldClient.java:387)
at net.minecraft.client.Minecraft.func_71396_d(Minecraft.java:1647)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:370)
at net.minecraft.client.main.Main.main(SourceFile:144)
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:497)
at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:51)
at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$267/2113604623.call(Unknown Source)
at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:19)
at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:32)
at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:50)
at cpw.mods.modlauncher.Launcher.run(Launcher.java:56)
at cpw.mods.modlauncher.Launcher.main(Launcher.java:42)

-- System Details --
Details:
Minecraft Version: 1.13.2
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_51, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 1168691632 bytes (1114 MB) / 2415919104 bytes (2304 MB) up to 4294967296 bytes (4096 MB)
JVM Flags: 9 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xss1M -Xmx4G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M
FML: New FML!
Loaded coremods (and transformers): Nothing
Launched Version: 1.13.2-forge-25.0.69
LWJGL: 3.1.6 build 14
OpenGL: GeForce GTX 1070/PCIe/SSE2 GL version 4.6.0 NVIDIA 419.17, NVIDIA Corporation
GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.

 

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Posted

Does it happen in vanilla?

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
6 hours ago, Cadiboo said:

Does it happen in vanilla?

No. Just tested with vanilla 1.13.2.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

  • 2 weeks later...
Posted (edited)

I fully support this bug report. Having some mods installed will cause the crash instantly when extending a piston, certain mods will crash Forge after few extends. Forge without mods doesn't crash though.

Edited by BigBang1112
Posted (edited)

Same exact thing is happening to me. I made a nano farm with a piston yesterday, worked fine. Tried making a kelp farm today, kept crashing when trying to use a piston. Hopper clocks, buttons etc. Nothing worked. Went back to test my nano farm, crashed. I did reinstall the server today though for unrelated reasons. Maybe 25.0.85 is causing the issues.

 

Edit: Just reinstalled to a previous version I was sure I had yesterday, still crashed. RIP. Here is my log for comparison: 

crash-2019-03-16_21.21.13-client.txt

Edited by apricitypx

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

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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