April 4, 20205 yr Author And how can i make it activate, if i run into it (if i use onEntityCollision, nothing happens): And how do i activate it on leftclick it with a sword or other tool?
April 4, 20205 yr It's not deactivating because you never do anything in your overridden tick method. Deactivate it there. Override onBlockClicked for activating when it's clicked. Edited April 4, 20205 yr by imacatlolol I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.
April 4, 20205 yr Author I have this all. tick is alright from the vanilla redstone ore. It activates , if i walk on it or right click it. But not if i run against it´s vertical side or leftvlick it with a weapon or tool. And i notice, it activates, if an arrow hit´s it´s vertical side, but not if it hit´s it´s top. and stays activated forever. It activates correctly at: -walking on it -rightclick it It scould activate, too at -leftclicking it with a sword(in creative for not braking it) or something else in survival (while the braking-process) -walking against a vertical wall out of theese blocks. -jump under such a block in a two block high gap -shooting projectiles at it (no matter if side or top) Edited April 4, 20205 yr by Drachenbauer
April 4, 20205 yr I'll say it again, this time with a little more clarity, override onBlockClicked to activate it when it's left clicked. There's no built-in feature for detecting side collisions in the way you want. Maybe you could have it detect nearby entities and activate that way. Use something like World#getEntitiesWithinAABBExcludingEntity for that. I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.
April 4, 20205 yr Author And i sayd, i already use onBlockClicked Quote There's no built-in feature for detecting side collisions in the way you want. Maybe you could have it detect nearby entities and activate that way. Use something like I saw, the cactus uses onEntityCollision to deal damage. So i thaught, this one can use it to activate. Edited April 4, 20205 yr by Drachenbauer
April 4, 20205 yr 3 minutes ago, Drachenbauer said: And i sayd, i already use onBlockClicked Show your code. 4 minutes ago, Drachenbauer said: I saw, the cactus uses onEntityCollision to deal damage. So i thaught, this one can use it to activate. That's a good idea, but I'm pretty sure onEntityCollision only triggers when an entity is inside of a block's space. Since your block is a full block, I don't believe that code will ever run. I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.
April 4, 20205 yr 22 minutes ago, imacatlolol said: It's not deactivating because you never do anything in your overridden tick method. Deactivate it there. If you look at his most recent code. He doesn't override the tick method at all and it goes back into the super classes tick method which is RedstoneOreBlock::tick 5 minutes ago, Drachenbauer said: I saw, the cactus uses onEntityCollision to deal damage. So i thaught, this one can use it to activate. The Cactus blocks Collision is slightly bigger than what is visual and thus allows the player to move ever so slightly inside of it and that is what is considered a collision. Take a look at CactusBlock for how it does that. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
April 4, 20205 yr 1 minute ago, Animefan8888 said: If you look at his most recent code. He doesn't override the tick method at all and it goes back into the super classes tick method which is RedstoneOreBlock::tick The Cactus blocks Collision is slightly bigger than what is visual and thus allows the player to move ever so slightly inside of it and that is what is considered a collision. Take a look at CactusBlock for how it does that. Oh, I didn't know. Thank you for the clarity! I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.
April 4, 20205 yr Author About the cactus, do you mean, that the getShape and the getCollisionShape are slightly different cuboidshape values? Edited April 4, 20205 yr by Drachenbauer
April 4, 20205 yr 8 minutes ago, Drachenbauer said: About the cactus, do you mean, that the getShape and the getCollisionShape are slightly different cuboidshape values? That is what I originally meant. Or something along those lines, However it seems that may have been changed, or it was never like that and I'm crazy. It seems an entity calls Block::onEntityCollision if the Entity's bounding box exists within the BlockPos(block space) of a block. IE if I stand next to a flower pot I'm considered colliding with that block. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
April 4, 20205 yr Author Now i created a collision-shape (applyed in getCollisionShape), that i slightly inside the block at the sides and botom. Now the thing with the collision works. Arrows at vertical side and from below work correctly, too. but the arrows, sticking in the side or bottom of the block, turn black, if the block switches off. And i cannot more place objects like torches and redstone wire at the block. It seems like it has not more all required properties of a solid block now. How can i keep it as a solid block and have onEntityCollision work? And i still wonder why leftclick with a sword and arrows, wich hit the top of the block, do not activate it. Edited April 4, 20205 yr by Drachenbauer
April 5, 20205 yr Author Entities stop, if their collision-box touch the one of a block. As a player you notice it at walking against a wall. I wonder, where this is coded. Maybe i can hook my code there for switching the RedstoneOre on at walking against it or jumping or flying under it until automatic stopping. And still: Why the RedstoneOre does not switch on, if i leftclick it with a weapon (sword, trident) or hit its top with an arrow or thrown trident? Edited April 7, 20205 yr by Drachenbauer
April 7, 20205 yr Author bump Still didn´t find a way to solve the things in the previous post... can anyone please help me?
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.