Jump to content

Recommended Posts

Posted (edited)

So i'm trying my hand at updating an existing mod (Dimensional Pockets 1.7.10), due to having a similar idea myself. I'm using code from Dimensional Pockets, and I've got some of it working but when i try to teleport into the pocket, i crash with this crash report. Yes i understand that using whole chunks of code is not great from a copying standpoint, i just want the base functionality working, then I'm going to re-write and add my ideas. I'm not using the old mod in its entirety, just enough to get my idea working, as i would have no idea how to actually work much of it out myself. 

  Reveal hidden contents

 

Its talking about a ticking block entity, but im not sure whats actually wrong.

 

PocketTeleporter.class # transferPlayerToDimension()

  Reveal hidden contents

 

Pocket.class # teleportTo()

  Reveal hidden contents

 

PocketTeleportPreparation.class # doPrepareTick()

  Reveal hidden contents

 

TileEntityDimensionalPocket.class # update()

  Reveal hidden contents

 

Any help is greatly appreciated.

Edited by Zeher_Monkey
Posted (edited)

A TileEntity is found to be null somewhere, but from the code you have provided I am struggling to see the problem. When are you trying to teleport? Is there any other code you can provide? Also when does this error occur?

Edited by oMilky
Posted (edited)

Ive figured it out i think ive managed to make a scenario where it doesnt crash. Ive tested it by making a command that allows me to enter the dimension. It crashes when this code is called:

 

Pocket.class # generatePocketRoom()

  Reveal hidden contents

However, if i go to the dimension before hand and use /fill to place a block, it seems to work OK, other than spawning in the room, which I'm working on. Not sure at all why placing a block seems to make the room generate and allow me to teleport into and out of the room. If no block is placed/spawned it crashes every time, and when i restart the game, im in the dimension, with no pocket created.

 

Im teleporting onBlockActivated, so when the player right clicks the block. Without doing anything, i teleport into the dimension, and then crash instantly. The room is not generated when i crash, because i crash before the code to generate the room gets called. Thanks for replying btw :)

 

Edited by Zeher_Monkey
Posted

Now im getting a completely new error.

 

  Reveal hidden contents

 This doesnt crash the game, but freezes it sort of. I can teleport back to the overworld, but anytime i teleport into the dimension, it does this.

 

DimensionalShiftUtils # shiftPlayerToDimension()

  Reveal hidden contents

 

Pocket # teleportTo()

  Reveal hidden contents

 

TileEntityDimensionalPocket # shiftIntoPocket()

  Reveal hidden contents

Not sure where this is coming from. Also still getting the aforementioned error, with no blocks placed it crashes. However i must have changed something because now it isnt working with placing blocks either.

Posted

Ah I see, sorry for the late reply. So that second error you are getting is related to thread safety in Minecraft, are you calling some client side code on the server anywhere? For the second error are you trying to generate any TileEntities in the dimension when it's created?

Posted
  On 11/19/2017 at 9:13 PM, Zeher_Monkey said:

extendedBlockStorage.set(x, y, z, BlockHandler.block_dimensional_pocket_wall.getDefaultState());

Expand  

I see you are calling this are you trying to place a block with this? Because this is not what this method does.

 

Use

world.setBlockState(BlockPos pos, IBlockState newState, int flags)

With that method you don't need

 

  On 11/19/2017 at 9:13 PM, Zeher_Monkey said:

 world.markBlockRangeForRenderUpdate(worldX + x, worldY + y, worldZ + z, worldX + x, worldY + y, worldZ + z);

Expand  

 

This maybe why you are getting the first error of a null TileEntity

Posted

Thanks for the reply, I'm also replying late because I'm on holiday ?. So I'm not sure if I'm calling any client code on the server. I'll have a look when I get back, and double check all my client code. I'm not trying to generate any TileEntity's when I generate the pocket, only blocks, which when shift-right click teleport out of the pocket. But that is all handled in the Block class. No tile entity.

 

Also will change the way I set the blocks to world.setBlockState, when I get back. I can check the update block range too.

 

Thanks for the help, I'll make some changes when I'm back at my PC ?

Posted (edited)

So maybe check the player isn't null, but none of your errors point to the player returning null, but as Kokkie said it's always good to check for that when you are using the player.

 

Also I don't think the player is being set anywhere it's provided through the default method parameters.

 

But yeah git repo would be great here as it would allow us to test for you and read the code more easily.

Edited by oMilky
Posted
  On 11/21/2017 at 10:06 PM, Kokkie said:

It's, from what I looked at, the only thing that could be null between those methods...

Expand  

Yeah sorry, I was referring to the first error that's finding a null TileEntity, I stand corrected the second error could be due to a null player, but looks to be that some code is being ran on the wrong thread, hard to tell without the full code base and some testing.

Posted

Ive made a repo here. I only have my phone so what I can do is limited, and obviously, i can't upload any of my code until I get back. Thanks for the help though ?. I'll check all of what you have said and get back to you, same time as I publish all my code to the repo.

Posted (edited)

So I'm back, and more errors are ensuing as usual! So now, im getting the same error, with the null point exception. However, the game doesnt crash, it just sort of freezes. Even the workaround doesnt work anymore, when i place blocks beforehand, it 'freezes' but doesnt crash, i can teleport out and back to the overworld.

 

Here is the crash log for that:

  Reveal hidden contents

 

And the crash from not placing blocks:

  Reveal hidden contents

 

I havent tried to swap

  On 11/21/2017 at 5:11 PM, oMilky said:

extendedBlockStorage.set(x, y, z, BlockHandler.block_dimensional_pocket_wall.getDefaultState());

Expand  

For 

world.setBlock();

 

Yet, because it worked before with that code.

 

Github repos are here:

DimensionalPockets-II

TRZCore -- Which is my required library.

Edited by Zeher_Monkey
Posted (edited)

So if i remove these lines of code:

 

        int l = worldY >> 4;
		ExtendedBlockStorage extendedBlockStorage = chunk.getBlockStorageArray()[l];

		if (extendedBlockStorage == null) {
			extendedBlockStorage = new ExtendedBlockStorage(worldY, !world.provider.hasNoSky());
			chunk.getBlockStorageArray()[l] = extendedBlockStorage;
		}

 

It works with

world.setBlockState(new BlockPos(x, y, z), BlockHandler.block_dimensional_pocket_wall.getDefaultState());

 

But the pocket is completely dark, and the pocket shows up as null, so the wall blocks wont allow a teleport out.

 

However if i use:

extendedBlockStorage

 

It crashes due to a null value on this:

public int getExtSkylightValue(int x, int y, int z)
    {
        return this.skylightArray.get(x, y, z);
    }

 

Im not sure what this needs to be to override it?

Edited by Zeher_Monkey
Posted

Another update... 

Using

world.setBlockState();

I'm getting repeatable pocket generation, and teleportation into the pocket. I have given the

BlockDimensionalPocketWall

a light value to eliminate the 

extendedBlockStorage

part of the code. 

 

Only trouble is now, is i cant teleport out of the pocket. The wall blocks check for a pocket when doing so, and they are saying it is null, and im not sure how to move forwards.

 

Posted (edited)

More updates! I have now smooth and fluid teleporting into and out of the pocket. I figured it out, it was a 

BlockPos

Issue. So the blocks now teleport on shift right click.

But there are more things to work out. Whenever i place a second pocket block, and effectively generate a new pocket, the game freezes. I can still place and destroy items, but i cannot give myself items from JEI, and when i save and exit, the game completely freezes on the shutting down server screen. No error log, no crash, nothing. Just game freezes up.

 

Also when i try top place blocks in the pocket, i cannot. If i try to shift place blocks, it replaces the pocket wall, and i can then destroy the wall block. It almost replaces the wall block. Its really strange.

 

--EDIT--

Found the error with the BlockDimensionalPocketWall blocks, i was using

Materials.STRUCTURE_VOID

As the material value.

Edited by Zeher_Monkey
Posted

1. Can you check the fml-log file in your workspace to see if the error was saved to there?

2. I don't think JEI is made for giving items to the player but that's something you'll have to check.

3. The log for the second freeze may also be in the fml-log file, if so could you post that so we can see it and we can go from there(same goes for no. 1)

 

Posted

So here is the FML log. I recreated the error and generated a fresh log.

 

Be warned its fairly long! :) 

 

fml-client-latest.log

  Reveal hidden contents

 

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

    • You are using Create 6 - some addons are not compatible with it Remove all addons and add these one by one littlecontraptions is mentioned - keep this one removed
    • Different problem now. https://paste.ee/p/iDo8lS35
    • I would like to have a BoP sapling drop from my block if it is also installed. I think I have done everything and I cannot pinpoint the problem, which is the error in the logs that appears when joining a world:   [Worker-Main-11/ERROR] [ne.mi.co.ForgeHooks/]: Couldn't parse element loot_tables:grasses:blocks/leaves_block com.google.gson.JsonSyntaxException: Expected name to be an item, was unknown string 'biomesoplenty:magic_sapling' My code:   LootItemConditions.CONDITIONS.register(modEventBus); public class LootItemConditions { public static final DeferredRegister<LootItemConditionType> CONDITIONS = DeferredRegister.create(Registries.LOOT_CONDITION_TYPE, Grasses.MOD_ID); public static final RegistryObject<LootItemConditionType> IS_MOD_LOADED = CONDITIONS.register("is_mod_loaded", () -> new LootItemConditionType(new IsModLoaded.ConditionSerializer())); } public class IsModLoaded implements LootItemCondition { private final boolean exists; private final String modID; public IsModLoaded(String modID) { this.exists = ModList.get().isLoaded(modID); this.modID = modID; } @Override public LootItemConditionType getType() { return LootItemConditions.IS_MOD_LOADED.get(); } @Override public boolean test(LootContext context) { return this.exists; } public static LootItemCondition.Builder builder(String modid) { return () -> new IsModLoaded(modid); } public static class ConditionSerializer implements Serializer<IsModLoaded> { @Override public void serialize(JsonObject json, IsModLoaded instance, JsonSerializationContext ctx) { json.addProperty("modid", instance.modID); } @Override public IsModLoaded deserialize(JsonObject json, JsonDeserializationContext ctx) { return new IsModLoaded(GsonHelper.getAsString(json, "modid")); } } } protected LootTable.Builder createLeavesDropsWithModIDCheck(Block selfBlock, Item sapling, Property<?>[] properties, String modIDToCheck, float... chances) { CopyBlockState.Builder blockStateCopyBuilder = CopyBlockState.copyState(selfBlock); for(Property<?> property : properties) { blockStateCopyBuilder.copy(property); } return LootTable.lootTable() .withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(selfBlock) .when(HAS_SHEARS_OR_SILK_TOUCH) .apply(blockStateCopyBuilder))) .withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)) .add(this.applyExplosionCondition(selfBlock, LootItem.lootTableItem(sapling)) .when(IsModLoaded.builder(modIDToCheck))) .when(BonusLevelTableCondition.bonusLevelFlatChance(Enchantments.BLOCK_FORTUNE, chances)) .when(HAS_NO_SHEARS_OR_SILK_TOUCH)) .withPool(LootPool.lootPool().name("sticks").setRolls(ConstantValue.exactly(1.0F)) .add(this.applyExplosionDecay(selfBlock, LootItem.lootTableItem(Items.STICK). apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0F, 2.0F)))) .when(BonusLevelTableCondition.bonusLevelFlatChance(Enchantments.BLOCK_FORTUNE, NORMAL_LEAVES_STICK_CHANCES)) .when(HAS_NO_SHEARS_OR_SILK_TOUCH))); } I don't know. Am I making a mistake somewhere? Am I forgetting something? Should there be something else?
  • Topics

×
×
  • Create New...

Important Information

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