-
Posts
54 -
Joined
-
Last visited
-
Days Won
1
Thorius last won the day on April 9 2021
Thorius had the most liked content!
Converted
-
Gender
Male
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Thorius's Achievements

Stone Miner (3/8)
4
Reputation
-
You should know that this formula will also accelerate the carts to the specified speed. If you want to avoid that, use Math.min(brakeforce, 1).
-
Maybe you could try using particles?
-
That is supposed to be the player's inventory.
-
Could you post your crash report?
-
[1.16.5] How to sync player custom persistent data?
Thorius replied to RInventor7's topic in Modder Support
I think you need PlayerLoggedInEvent and send a packet to the client to synchronise data. Probably you also need to do this in PlayerChangedDimensionEvent and PlayerEvent.PlayerRespawnEvent. -
Aren't you checking the player's inventory?
-
I might have understood it wrong, but if you are simply multiplying the x and z component of the velocity vector, then don't you just need the ratio between the target and entry velocity? So shouldn't your brake"force" be targetVelocity/entryVelocity?
-
Thank you. I had already thought about using slotsChanged in the beginning, but I had problems with it and I searched for a simpler solution and then I forgot about it. However, looking at the crafting table helped me understand it better and it works now. Those who are interested in the solution: I used slotsChanged(IInventory inventory) in my container class. I used a "virtual" inventory inside my container for specific slots that was initialised with the real contents (which are also updated in slotsChanged) and called slotsChanged in setItem of the "virtual" inventory. Things you need to pay attention to: -slotsChanged is called on both sides, sometimes multiple times -avoid loops in slotsChanged using a method of your inventory that again calls slotsChanged -slotsChanged sometimes has a weird behaviour that I avoid by checking if the world is null
-
This is quite a complicated process that involes a lot of steps. Instead, I commit a change to Github that bypass all these steps. Edit: How do I update ForgeGradle? Is there a command or do I have to edit some file? Edit 2: Sorry, had some issues updating my repo, I'm still learning to use Github. It should be working now.
-
System.out.println(this.level.isClientSide); returns always false. I set up Github, hopefully it will work: https://github.com/Thoriuslight/Professionsmod-1.16.5.git Many things are experimental and the mod was ported from 1.15.2, so expect some nasty stuff. (The fact that I'm not a professional programmer doesn't help either, but I do try to clean things up ever so slowly) The TileEntity in question is the ExtractorTileEntity.
-
Thanks for the tips and yes, the code is only called on the server side. I could send a packet to synchronise data, but as I said I don't have a specific player in this context. I could send the data to all players because the TileEntity has a rendered fluid too that also fails to change after I change an item in a slot (but for some reason other serverside only actions can change it and inside the container the change in fluid is registered, only outside does it remain unchanged) and is seen by players who are not using the container too. Here's a video demonstrating my problem: Youtube
-
My TileEntity implements IInventory (I know it's outdated, but I don't think IItemHandler would solve my problem) and I want to change things in the inventory if setItem is called. However, the container only shows the change after one action delay or if I reopen the container. Code (not finished): @Override public void setItem(int index, ItemStack stack) { this.items.set(index, stack); if (stack.getCount() > this.getMaxStackSize()) { stack.setCount(this.getMaxStackSize()); } //This is were the changes are not recognised instantaneously //Important is that I change the list that stores the items if(index == 9 || index == 10) { ItemStack input = this.items.get(9); int in = input.getCount(); if(in > 0) { ItemStack output = this.items.get(10); int out = output.getCount(); Item item; if(input.getItem().equals(Items.BUCKET)) item = ItemInit.CREOSOTE_BUCKET.get(); else item = ItemInit.CREOSOTE_GLASS.get(); if(output.getItem().equals(item) || output.isEmpty()) { ItemStack filledItem = new ItemStack(item); int amount = Math.min(filledItem.getMaxStackSize() - out, in); input.shrink(amount); filledItem.setCount(out + amount); items.set(10, filledItem); } } } this.setChanged(); } I also did this: //-----------------------------------------------------Synchronization----------------------------------------------------- @Override public SUpdateTileEntityPacket getUpdatePacket() { return new SUpdateTileEntityPacket(this.getBlockPos(), 1, getUpdateTag()); } @Override public void onDataPacket(NetworkManager net, SUpdateTileEntityPacket pkt) { this.load(this.level.getBlockState(this.getBlockPos()), pkt.getTag()); } @Override public CompoundNBT getUpdateTag() { return this.save(new CompoundNBT()); } @Override public void handleUpdateTag(BlockState state, CompoundNBT tag) { this.load(state, tag); } What can I do to solve this problem? I wanted to use packets to sync server and client, but I don't have a player in this context.
-
I want to make an Item with a texture that depends on the NBT. I have some ideas what I could use, but I would like to hear your recommendations, so that I have the best solution. I just want to be pointed in the right direction. In essence, I want to do something similar like Tinker's Construct. This is how I imagine the process: 1. Have a basic toolhead texture and recolour it or if possible, replace specific colours with another specific colour. 2. Add tool rod and everything else to the texture.