-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
647 additions
and
198 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
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
52 changes: 52 additions & 0 deletions
52
src/main/java/net/frozenblock/lib/item/impl/network/CooldownChangePacket.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,52 @@ | ||
/* | ||
* Copyright 2023 FrozenBlock | ||
* This file is part of FrozenLib. | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package net.frozenblock.lib.item.impl.network; | ||
|
||
import net.fabricmc.fabric.api.networking.v1.FabricPacket; | ||
import net.fabricmc.fabric.api.networking.v1.PacketType; | ||
import net.frozenblock.lib.FrozenSharedConstants; | ||
import net.minecraft.core.registries.BuiltInRegistries; | ||
import net.minecraft.network.FriendlyByteBuf; | ||
import net.minecraft.world.item.Item; | ||
|
||
public record CooldownChangePacket( | ||
Item item, | ||
int additional | ||
) implements FabricPacket { | ||
|
||
public static final PacketType<CooldownChangePacket> PACKET_TYPE = PacketType.create( | ||
FrozenSharedConstants.id("cooldown_change_packet"), | ||
CooldownChangePacket::new | ||
); | ||
|
||
public CooldownChangePacket(FriendlyByteBuf buf) { | ||
this(buf.readById(BuiltInRegistries.ITEM), buf.readVarInt()); | ||
} | ||
|
||
@Override | ||
public void write(FriendlyByteBuf buf) { | ||
buf.writeId(BuiltInRegistries.ITEM, this.item()); | ||
buf.writeVarInt(this.additional()); | ||
} | ||
|
||
@Override | ||
public PacketType<?> getType() { | ||
return PACKET_TYPE; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/net/frozenblock/lib/item/impl/network/CooldownTickCountPacket.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,46 @@ | ||
/* | ||
* Copyright 2023 FrozenBlock | ||
* This file is part of FrozenLib. | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package net.frozenblock.lib.item.impl.network; | ||
|
||
import net.fabricmc.fabric.api.networking.v1.FabricPacket; | ||
import net.fabricmc.fabric.api.networking.v1.PacketType; | ||
import net.frozenblock.lib.FrozenSharedConstants; | ||
import net.minecraft.network.FriendlyByteBuf; | ||
|
||
public record CooldownTickCountPacket(int count) implements FabricPacket { | ||
|
||
public static final PacketType<CooldownTickCountPacket> PACKET_TYPE = PacketType.create( | ||
FrozenSharedConstants.id("cooldown_tick_count_packet"), | ||
CooldownTickCountPacket::new | ||
); | ||
|
||
public CooldownTickCountPacket(FriendlyByteBuf buf) { | ||
this(buf.readInt()); | ||
} | ||
|
||
@Override | ||
public void write(FriendlyByteBuf buf) { | ||
buf.writeInt(this.count()); | ||
} | ||
|
||
@Override | ||
public PacketType<?> getType() { | ||
return PACKET_TYPE; | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
src/main/java/net/frozenblock/lib/item/impl/network/ForcedCooldownPacket.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,55 @@ | ||
/* | ||
* Copyright 2023 FrozenBlock | ||
* This file is part of FrozenLib. | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package net.frozenblock.lib.item.impl.network; | ||
|
||
import net.fabricmc.fabric.api.networking.v1.FabricPacket; | ||
import net.fabricmc.fabric.api.networking.v1.PacketType; | ||
import net.frozenblock.lib.FrozenSharedConstants; | ||
import net.minecraft.core.registries.BuiltInRegistries; | ||
import net.minecraft.network.FriendlyByteBuf; | ||
import net.minecraft.world.item.Item; | ||
|
||
public record ForcedCooldownPacket( | ||
Item item, | ||
int startTime, | ||
int endTime | ||
) implements FabricPacket { | ||
|
||
public static final PacketType<ForcedCooldownPacket> PACKET_TYPE = PacketType.create( | ||
FrozenSharedConstants.id("forced_cooldown_packet"), | ||
ForcedCooldownPacket::new | ||
); | ||
|
||
public ForcedCooldownPacket(FriendlyByteBuf buf) { | ||
this(buf.readById(BuiltInRegistries.ITEM), buf.readVarInt(), buf.readVarInt()); | ||
} | ||
|
||
|
||
@Override | ||
public void write(FriendlyByteBuf buf) { | ||
buf.writeId(BuiltInRegistries.ITEM, this.item()); | ||
buf.writeVarInt(this.startTime()); | ||
buf.writeVarInt(this.endTime()); | ||
} | ||
|
||
@Override | ||
public PacketType<?> getType() { | ||
return PACKET_TYPE; | ||
} | ||
} |
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
Oops, something went wrong.