-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix resource pack building, don't bundle server translations api
- Loading branch information
Showing
11 changed files
with
186 additions
and
28 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
36 changes: 36 additions & 0 deletions
36
src/main/java/eu/pb4/polymer/mixin/item/EntityEquipmentUpdateS2CPacketMixin.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,36 @@ | ||
package eu.pb4.polymer.mixin.item; | ||
|
||
import com.mojang.datafixers.util.Pair; | ||
import eu.pb4.polymer.item.ItemHelper; | ||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.entity.EquipmentSlot; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.network.packet.s2c.play.EntityEquipmentUpdateS2CPacket; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
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 xyz.nucleoid.packettweaker.PacketContext; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Mixin(EntityEquipmentUpdateS2CPacket.class) | ||
public class EntityEquipmentUpdateS2CPacketMixin { | ||
@Environment(EnvType.CLIENT) | ||
@Inject(method = "getEquipmentList", at = @At("RETURN"), cancellable = true) | ||
private void replaceItemsWithVirtualOnes(CallbackInfoReturnable<List<Pair<EquipmentSlot, ItemStack>>> cir) { | ||
List<Pair<EquipmentSlot, ItemStack>> list = new ArrayList<>(); | ||
ServerPlayerEntity player = MinecraftClient.getInstance().getServer().getPlayerManager().getPlayer(MinecraftClient.getInstance().player.getUuid()); | ||
|
||
for (Pair<EquipmentSlot, ItemStack> pair : cir.getReturnValue()) { | ||
list.add(new Pair<>(pair.getFirst(), ItemHelper.getVirtualItemStack(pair.getSecond(), player))); | ||
} | ||
|
||
cir.setReturnValue(list); | ||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/eu/pb4/polymer/mixin/item/InventoryS2CPacketMixin.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,33 @@ | ||
package eu.pb4.polymer.mixin.item; | ||
|
||
import eu.pb4.polymer.item.ItemHelper; | ||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.network.packet.s2c.play.InventoryS2CPacket; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
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 java.util.ArrayList; | ||
import java.util.List; | ||
|
||
|
||
@Mixin(InventoryS2CPacket.class) | ||
public class InventoryS2CPacketMixin { | ||
@Environment(EnvType.CLIENT) | ||
@Inject(method = "getContents", at = @At("RETURN"), cancellable = true) | ||
private void replaceItemsWithVirtualOnes(CallbackInfoReturnable<List<ItemStack>> cir) { | ||
List<ItemStack> list = new ArrayList<>(); | ||
ServerPlayerEntity player = MinecraftClient.getInstance().getServer().getPlayerManager().getPlayer(MinecraftClient.getInstance().player.getUuid()); | ||
|
||
for (ItemStack stack : cir.getReturnValue()) { | ||
list.add(ItemHelper.getVirtualItemStack(stack, player)); | ||
} | ||
|
||
cir.setReturnValue(list); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/eu/pb4/polymer/mixin/item/ScreenHandlerSlotUpdateS2CPacketMixin.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,25 @@ | ||
package eu.pb4.polymer.mixin.item; | ||
|
||
import eu.pb4.polymer.item.ItemHelper; | ||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.network.packet.s2c.play.ScreenHandlerSlotUpdateS2CPacket; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
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 xyz.nucleoid.packettweaker.PacketContext; | ||
|
||
|
||
@Mixin(ScreenHandlerSlotUpdateS2CPacket.class) | ||
public class ScreenHandlerSlotUpdateS2CPacketMixin { | ||
@Environment(EnvType.CLIENT) | ||
@Inject(method = "getItemStack", at = @At("RETURN"), cancellable = true) | ||
private void replaceItemsWithVirtualOnes(CallbackInfoReturnable<ItemStack> cir) { | ||
ServerPlayerEntity player = MinecraftClient.getInstance().getServer().getPlayerManager().getPlayer(MinecraftClient.getInstance().player.getUuid()); | ||
cir.setReturnValue(ItemHelper.getVirtualItemStack(cir.getReturnValue(), player)); | ||
} | ||
} |
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