Jump to content

Thorius

Members
  • Posts

    54
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Thorius

  1. 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).
  2. Maybe you could try using particles?
  3. That is supposed to be the player's inventory.
  4. 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.
  5. Aren't you checking the player's inventory?
  6. 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?
  7. 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
  8. Thank you for the explanation. I wanted to avoid implementing ITickableTileEntity for only this because of unnecessary lag, but because there doesn't seem to be another way, I will implement this feature using right-click interactions with the block without using a container.
  9. Looking at the problem again, it seems that the problem is not that the server and the client are not synchronised. For some reason the tileEntity and container data differ on client side. Is there a way to refresh or send data to the container?
  10. 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.
  11. 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.
  12. 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
  13. 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.
  14. 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.
  15. Hi, I started porting my mod to 1.16.5 (getting zero downloads of the newest version was a strong indicator it's time to move on) and I noticed that many of the RenderSystem methods are deprecated. For example: RenderSystem.color4f(float, float, float, float); RenderSystem.pushMatrix(); RenderSystem.popMatrix(); After some research, I found that the new way of doing things is batch rendering. However, I can't find any good examples or tutorials on what methods I should use. So my question would be: is there any documentation or summary on the topic and does this change also affect other things like, for example, entity rendering?
  16. Today I started Eclipse and I got this error message: Project 'MyProject' is missing required library: 'C:\Users\MyUsername\.gradle\caches\modules-2\files-2.1\cpw.mods\grossjava9hacks\1.3.0\1a922de964d0c19d864fbcba2678c1a1c4602c35\grossjava9hacks-1.3.0.jar' The only thing I did yesterday was writing some code and running 'gradlew build'. I didn't change any settings or touch anything java related. Why did this error appear? The only thing I can think of being responsible is some weird shortcut.
  17. That shouldn't happen because of the sinus and cosinus, at least it didn't happen in my tests.
  18. The easiest solution is to change the position of the bullet before it is spawned. It will however slightly mess with your aim, so take that into consideration. An example code written in 1.15.2 (in 1.16.5 it is propably something similar): float rot = playerEntity.rotationYaw/180.f*3.14159f; //Converts the player rotation to radians float z = MathHelper.sin(rot) * 0.3f; //the multiplier (0.3f) defines how much is the bullet moved to the right float x = MathHelper.cos(rot) * 0.3f; //this and the former equation localizes the bullet to the rotation of the player //the subtrahend 0.5f controlls the height of the bullet //changing the minus sign before x and z to plus moves the bullet to the left anEntity.setPosition(playerEntity.getPosX() - x, playerEntity.getPosYEye() - (double)0.5f, playerEntity.getPosZ() - z); //add the bullet to the world after this
  19. I mostly saw this issue with modpacks that were missing dependencies. The problem is, the crash is not Botania's fault. It might still crash with other mods. A modlist might be usefull.
  20. The crash might be related to ctm or ctm dependent mods.
  21. What do you mean by opening? Are using it in the Minecraft launcher or are you trying to run the installer?
  22. Does it work without Botania? Some configurations might randomly change the data sent to botania which then causes an exception.
  23. I managed to find a solution. Instead of the above method i do this: private static final ResourceLocation MOLTEN_METAL_TEXTURE = new ResourceLocation("textures/block/lava_still.png"); private static final RenderType RENDER_TYPE = RenderType.getEntitySolid(MOLTEN_METAL_TEXTURE);
×
×
  • Create New...

Important Information

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