-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
You can now reset the opened state of minecarts.
- Loading branch information
1 parent
6cbed02
commit 726d92d
Showing
5 changed files
with
68 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
37 changes: 37 additions & 0 deletions
37
src/main/java/noobanidus/mods/lootr/networking/CloseCart.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,37 @@ | ||
package noobanidus.mods.lootr.networking; | ||
|
||
|
||
import net.minecraft.network.PacketBuffer; | ||
import net.minecraftforge.api.distmarker.Dist; | ||
import net.minecraftforge.api.distmarker.OnlyIn; | ||
import net.minecraftforge.fml.network.NetworkEvent; | ||
import noobanidus.mods.lootr.networking.client.ClientHandlers; | ||
|
||
import java.util.function.Supplier; | ||
|
||
public class CloseCart { | ||
public int entityId; | ||
|
||
public CloseCart(PacketBuffer buffer) { | ||
this.entityId = buffer.readInt(); | ||
} | ||
|
||
public CloseCart(int entityId) { | ||
this.entityId = entityId; | ||
} | ||
|
||
public void encode(PacketBuffer buf) { | ||
buf.writeInt(this.entityId); | ||
} | ||
|
||
public void handle(Supplier<NetworkEvent.Context> context) { | ||
context.get().enqueueWork(() -> handle(this, context)); | ||
context.get().setPacketHandled(true); | ||
} | ||
|
||
@OnlyIn(Dist.CLIENT) | ||
private static void handle(CloseCart message, Supplier<NetworkEvent.Context> context) { | ||
ClientHandlers.handleCloseCart(message, context); | ||
} | ||
} | ||
|
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