Jump to content

[Solved] [1.12.2] Dimension change event for The End?


Recommended Posts

Okay, the dimension change event emits for the nether, in and out. Now, I try the end and.. wait what? It emits when the user enters the end, but does not emit when the user leaves the end via an end gateway. Okay, if this is the case, what's the event I should use for checking when a user leaves the end?

Here's my test code right now.
 

	@SubscribeEvent
	@SideOnly(Side.CLIENT)
	public void onLogin(PlayerLoggedInEvent event) {
		UltimateDiscordPack.logger.info("Player Logged In");
	}

	@SubscribeEvent
	@SideOnly(Side.CLIENT)
	public void onChangeDimension(PlayerChangedDimensionEvent event) {
		UltimateDiscordPack.logger.info("Player Changed Dimension");
		UltimateDiscordPack.logger.info("New Dimension ID: " + event.player.dimension);
	}

	@SubscribeEvent
	@SideOnly(Side.CLIENT)
	public void onPlayerRespawn(PlayerRespawnEvent event) {
		UltimateDiscordPack.logger.info("Player Respawned");
	}

 

Edited by FireController1847

I am on my journey of making a remake of matmos, as explained here.

Link to comment
Share on other sites

I've been using SideOnly because everything else I've tried doesn't give me the desired effect~

I use PlayerLoggedInEvent to detect when the player joins a singleplayer world and NOT a multiplayer world.
I use PlayerChangedDimensionEvent  to detect when the player changes dimensions... should I be using ServerSide for this?

This is a client-only section of the mod, it cannot run on servers.

I am on my journey of making a remake of matmos, as explained here.

Link to comment
Share on other sites

1 minute ago, FireController1847 said:

I've been using SideOnly because everything else I've tried doesn't give me the desired effect

This is not how to use SideOnly

 

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Oh? Have I been doing it wrong this whole time?

I have the events only being added via the ClientProxy. Do I just not need SideOnly in that case?

And yes, I have read your forge tutorial on sides. Was very confusing to me for some reason, but I understood most of it.

I am on my journey of making a remake of matmos, as explained here.

Link to comment
Share on other sites

4 minutes ago, FireController1847 said:

Oh? Have I been doing it wrong this whole time?

http://mcforge.readthedocs.io/en/latest/concepts/sides/

specifically the @SidedProxy section as well as the getSide and SideOnly portion:

Quote

Annotating a method or field with the @SideOnly annotation indicates to the loader that the respective member should be completely stripped out of the definition not on the specified physical side. Usually, these are only seen when browsing through the decompiled Minecraft code, indicating methods that the Mojang obfuscator stripped out. There is little to no reason for using this annotation directly. Only use it if you are overriding a vanilla method that already has @SideOnly defined. In most other cases where you need to dispatch behavior based on physical sides, use @SidedProxy or a check on getSide() instead.

 

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Okay, interesting. That makes sense, compared to last time I read it.

I guess the most confusing part to me is, are these events logical-server only, or do they fire for both the logical-server and logical-client?

And how are you supposed to know if the events run on the logical-server or the logical-client? And when would be the use cases to run something on either side? 

I am on my journey of making a remake of matmos, as explained here.

Link to comment
Share on other sites

6 hours ago, diesieben07 said:

so the client does a bit more

For example, the client controls all player motion directly and as far as the server is concerned, the player basically teleports around in small increments.

The server can still say "nope, you are not allowed to go there" and the client is forced to listen, but in general, the client is in control.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

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

    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
    • It is an issue with quark - update it to this build: https://www.curseforge.com/minecraft/mc-mods/quark/files/3642325
    • Remove Instant Massive Structures Mod from your server     Add new crash-reports with sites like https://paste.ee/  
    • Update your drivers: https://www.amd.com/en/support/graphics/amd-radeon-r9-series/amd-radeon-r9-200-series/amd-radeon-r9-280x
  • Topics

×
×
  • Create New...

Important Information

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