-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix remaining issues with tridents, elytras, and another @shadow
- Loading branch information
Showing
8 changed files
with
57 additions
and
21 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
common/src/main/java/com/oroarmor/netherite_plus/client/NetheritePlusClientMod.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 |
---|---|---|
@@ -1,16 +1,26 @@ | ||
package com.oroarmor.netherite_plus.client; | ||
|
||
import java.util.LinkedList; | ||
import java.util.Queue; | ||
|
||
import com.oroarmor.netherite_plus.NetheritePlusMod; | ||
import com.oroarmor.netherite_plus.config.NetheritePlusConfig; | ||
import com.oroarmor.netherite_plus.network.LavaVisionUpdatePacket; | ||
import me.shedaniel.architectury.networking.NetworkManager; | ||
|
||
public class NetheritePlusClientMod { | ||
public static double LAVA_VISION_DISTANCE = NetheritePlusConfig.GRAPHICS.LAVA_VISION_DISTANCE.getValue(); | ||
public static final Queue<Integer> TRIDENT_QUEUE = new LinkedList<>(); | ||
|
||
public static void init() { | ||
NetworkManager.registerReceiver(NetworkManager.Side.S2C, LavaVisionUpdatePacket.ID, (friendlyByteBuf, packetContext) -> { | ||
NetheritePlusClientMod.LAVA_VISION_DISTANCE = friendlyByteBuf.readDouble(); | ||
}); | ||
|
||
NetworkManager.registerReceiver(NetworkManager.Side.S2C, NetheritePlusMod.id("netherite_trident"), (friendlyByteBuf, packetContext) -> { | ||
System.out.println("received"); | ||
TRIDENT_QUEUE.add(friendlyByteBuf.readInt()); | ||
}); | ||
} | ||
|
||
} |
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
28 changes: 28 additions & 0 deletions
28
common/src/main/java/com/oroarmor/netherite_plus/mixin/TridentEntityMixin.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,28 @@ | ||
package com.oroarmor.netherite_plus.mixin; | ||
|
||
import com.oroarmor.netherite_plus.NetheritePlusMod; | ||
import io.netty.buffer.Unpooled; | ||
import me.shedaniel.architectury.networking.NetworkManager; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
import net.minecraft.core.Registry; | ||
import net.minecraft.network.FriendlyByteBuf; | ||
import net.minecraft.network.protocol.Packet; | ||
import net.minecraft.world.entity.Entity; | ||
import net.minecraft.world.entity.projectile.AbstractArrow; | ||
import net.minecraft.world.entity.projectile.ThrownTrident; | ||
|
||
@Mixin(AbstractArrow.class) | ||
public class TridentEntityMixin { | ||
@Inject(method = "getAddEntityPacket()Lnet/minecraft/network/protocol/Packet;", at = @At("HEAD")) | ||
public void sendTridentStackOnSpawn(CallbackInfoReturnable<Packet<?>> info){ | ||
if((Object) this instanceof ThrownTrident) { | ||
FriendlyByteBuf passedData = new FriendlyByteBuf(Unpooled.buffer()); | ||
passedData.writeInt(Registry.ITEM.getId(((ThrownTrident)(Object)this).tridentItem.getItem())); | ||
NetworkManager.sendToPlayers(((Entity) (Object) this).level.getServer().getPlayerList().getPlayers(), NetheritePlusMod.id("netherite_trident"), passedData); | ||
} | ||
} | ||
} |
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