• Recently Browsing

    No registered users viewing this page.

  • Posts

    • @DeBugger did you find any solutions?      
    • Gotcha, I was able to utilize this and use tick() to check for surrounding blocks.   This method is definitely a way to go for some actions, but unfortunately it didn't work for me,   By putting this in onBlockPlace() and also putting it in tick(), I was able to make someone of a consistent tick loop that ran for every interval that the tick scheduler was set at. However, it was inconsistent as random ticks would overlap it and start new tick loops. Removing  the tickRandomly() also wouldn't work for natural block appearances.   Basically any solution using this was going to lag out my game or just be straight up inconsistent. I really appreciate you showing me how to schedule a tick though, it is what I asked to do in the first place after all.   End Result: I ended up using tickRandomly() and tick() like so:   public MyBlock() { super(Properties.create(Material.ROCK) .harvestTool(ToolType.PICKAXE) .harvestLevel(2) .hardnessAndResistance(2.5f, 7f) .sound(SoundType.field_235583_E_) .func_235861_h_() .tickRandomly() ); } @Override public void tick(BlockState state, ServerWorld worldIn, BlockPos pos, Random rand) { super.tick(state, worldIn, pos, rand); if(JavaStuff.randomPercentChance(100)) {   Thanks guys for the help!! 😄
    • This is already broken, you are on the server here (potentially). The server has no idea about key bindings or even the Minecraft class.   You have to use the "use item" mechanic that is already provided by Minecraft (see bow and similar items).
    • Items are singletons, there is only one instance of them therefor you cannot just put variables in them. You should write these values to the NBT of the ItemStack your item is in.   Edit: On a separate note, if you call that method from a clientside event (like a keybind press) it won't do anything without packets, just use the methods provided to you from Item.
    • Hi, I had these variables in my Gun's class but I believe these wont work properly and can bug every Gun item ingame, since these 4 variables can change in the code. I think I can recode the last 3 variables inside methods so they work the same, but I dont know how to recode the "ticks_trigger_pressed" variable to make it work exactly the same so it doesn't bug the rest of guns in the game. I really need it to make the gun fire in semi auto mode. That variable counts the ticks that the ItemUseBindingKey is pressed.   Here are the Gun methods where I use this variable: PD: the second method doesnt have @Override because I use it calling it from an event.     Is there any other way that I can achieve this without using Object attribute variables in the Guns Class?
  • Topics

  • Who's Online (See full list)