-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit 93a3de5 Author: bundabrg <bundabrg@grieve.com.au> Date: Thu Feb 11 10:31:30 2021 +0800 Fix buckets for Education When interacticing holding an item we will check if the client interacts with both a block and air. If only 1, we send through the block and block_interact packet, otherwise we suppress the block_interact packet and send the other packets. Solves buckets and opening chests whilst holding a bucket.
- Loading branch information
Showing
5 changed files
with
133 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...on/translators/v390ee_to_v408be/handlers/PlayerActionHandlerHandler_v390ee_to_v408be.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2021 Reversion Developers | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package au.com.grieve.reversion.translators.v390ee_to_v408be.handlers; | ||
|
||
import au.com.grieve.reversion.api.PacketHandler; | ||
import au.com.grieve.reversion.editions.bedrock.BedrockTranslator; | ||
import com.nukkitx.protocol.bedrock.packet.InventoryTransactionPacket; | ||
import com.nukkitx.protocol.bedrock.packet.PlayerActionPacket; | ||
|
||
public class PlayerActionHandlerHandler_v390ee_to_v408be extends PacketHandler<BedrockTranslator, PlayerActionPacket> { | ||
public PlayerActionHandlerHandler_v390ee_to_v408be(BedrockTranslator translator) { | ||
super(translator); | ||
} | ||
|
||
@Override | ||
public boolean fromUpstream(PlayerActionPacket packet) { | ||
super.fromUpstream(packet); | ||
|
||
InventoryTransactionHandler_v390ee_to_v408be ith = (InventoryTransactionHandler_v390ee_to_v408be) getTranslator().getHandlers().get(InventoryTransactionPacket.class); | ||
|
||
// If ith has a penderItemUse with the same location as this we will handle it ourself | ||
InventoryTransactionHandler_v390ee_to_v408be.PendingUseItem pending = ith.getPendingUseItems().stream() | ||
.filter(i -> i.getFirstPacket().getBlockPosition().equals(packet.getBlockPosition())) | ||
.findFirst() | ||
.orElse(null); | ||
|
||
if (pending != null) { | ||
pending.setActionPacket(packet); | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters