mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-19 00:25:39 +01:00
Merge pull request #861 from creeper123123321/dev
Fix banners - not tested
This commit is contained in:
commit
152ef7fe38
@ -281,13 +281,21 @@ public class InventoryPackets {
|
|||||||
// NBT Changes
|
// NBT Changes
|
||||||
if (tag != null) {
|
if (tag != null) {
|
||||||
// Invert shield color id
|
// Invert shield color id
|
||||||
if (item.getId() == 442) {
|
if (item.getId() == 442 || item.getId() == 425) {
|
||||||
if (tag.get("BlockEntityTag") instanceof CompoundTag) {
|
if (tag.get("BlockEntityTag") instanceof CompoundTag) {
|
||||||
CompoundTag blockEntityTag = tag.get("BlockEntityTag");
|
CompoundTag blockEntityTag = tag.get("BlockEntityTag");
|
||||||
if (blockEntityTag.get("Base") instanceof IntTag) {
|
if (blockEntityTag.get("Base") instanceof IntTag) {
|
||||||
IntTag base = blockEntityTag.get("Base");
|
IntTag base = blockEntityTag.get("Base");
|
||||||
base.setValue(15 - base.getValue());
|
base.setValue(15 - base.getValue());
|
||||||
}
|
}
|
||||||
|
if (blockEntityTag.get("Patterns") instanceof ListTag) {
|
||||||
|
for (Tag pattern : (ListTag) blockEntityTag.get("Patterns")) {
|
||||||
|
if (pattern instanceof CompoundTag) {
|
||||||
|
IntTag c = ((CompoundTag) pattern).get("Color");
|
||||||
|
c.setValue(15 - c.getValue()); // Invert color id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Display Name now uses JSON
|
// Display Name now uses JSON
|
||||||
@ -426,14 +434,23 @@ public class InventoryPackets {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.getId() == 442) { // shield
|
if (item.getId() == 442 || item.getId() == 425) { // shield / banner
|
||||||
if (tag.get("BlockEntityTag") instanceof CompoundTag) {
|
if (tag.get("BlockEntityTag") instanceof CompoundTag) {
|
||||||
CompoundTag blockEntityTag = tag.get("BlockEntityTag");
|
CompoundTag blockEntityTag = tag.get("BlockEntityTag");
|
||||||
if (blockEntityTag.get("Base") instanceof IntTag) {
|
if (blockEntityTag.get("Base") instanceof IntTag) {
|
||||||
IntTag base = blockEntityTag.get("Base");
|
IntTag base = blockEntityTag.get("Base");
|
||||||
base.setValue(15 - base.getValue()); // invert color id
|
base.setValue(15 - base.getValue()); // invert color id
|
||||||
}
|
}
|
||||||
|
if (blockEntityTag.get("Patterns") instanceof ListTag) {
|
||||||
|
for (Tag pattern : (ListTag) blockEntityTag.get("Patterns")) {
|
||||||
|
if (pattern instanceof CompoundTag) {
|
||||||
|
IntTag c = ((CompoundTag) pattern).get("Color");
|
||||||
|
c.setValue(15 - c.getValue()); // Invert color id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display Name now uses JSON
|
// Display Name now uses JSON
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers.blockentities;
|
package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers.blockentities;
|
||||||
|
|
||||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||||
|
import com.github.steveice10.opennbt.tag.builtin.IntTag;
|
||||||
|
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
||||||
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
import us.myles.ViaVersion.api.minecraft.Position;
|
import us.myles.ViaVersion.api.minecraft.Position;
|
||||||
@ -36,6 +38,15 @@ public class BannerHandler implements BlockEntityProvider.BlockEntityHandler {
|
|||||||
else
|
else
|
||||||
System.out.println("Why does this block have the banner block entity? :(" + tag);
|
System.out.println("Why does this block have the banner block entity? :(" + tag);
|
||||||
|
|
||||||
|
if (tag.get("Patterns") instanceof ListTag) {
|
||||||
|
for (Tag pattern : (ListTag) tag.get("Patterns")) {
|
||||||
|
if (pattern instanceof CompoundTag) {
|
||||||
|
IntTag c = ((CompoundTag) pattern).get("Color");
|
||||||
|
c.setValue(15 - c.getValue()); // Invert color id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return blockId;
|
return blockId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user