mirror of
https://github.com/ViaVersion/ViaLegacy.git
synced 2025-01-20 21:21:48 +01:00
Merge pull request #65 from ViaVersion/update/vv-api-usage
Use VVs IdAndData
This commit is contained in:
commit
34dbb004f0
@ -1,67 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy
|
||||
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.raphimc.vialegacy.api.model;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class IdAndData {
|
||||
|
||||
public int id;
|
||||
public int data;
|
||||
|
||||
public IdAndData(final int id, final int data) {
|
||||
if (data < 0 || data > 15) throw new IllegalArgumentException("Block data out of bounds (id:" + id + " data:" + data + ")");
|
||||
this.id = id;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static IdAndData fromCompressedData(final int idAndData) {
|
||||
return new IdAndData(idAndData >> 4, idAndData & 15);
|
||||
}
|
||||
|
||||
public static int toCompressedData(final int id, final int data) {
|
||||
return id << 4 | data & 15;
|
||||
}
|
||||
|
||||
public int toCompressedData() {
|
||||
return toCompressedData(this.id, this.data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
IdAndData idAndData = (IdAndData) o;
|
||||
return id == idAndData.id &&
|
||||
data == idAndData.data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "IdAndData{" +
|
||||
"id=" + id +
|
||||
", data=" + data +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
@ -24,7 +24,7 @@ import com.viaversion.viaversion.api.minecraft.chunks.DataPalette;
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.PaletteType;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.Int2IntMap;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.Int2IntOpenHashMap;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
|
||||
public abstract class AbstractBlockRemapper {
|
||||
|
||||
@ -35,7 +35,7 @@ public abstract class AbstractBlockRemapper {
|
||||
}
|
||||
|
||||
protected void registerReplacement(final IdAndData from, final IdAndData to) {
|
||||
this.REPLACEMENTS.put(from.toCompressedData(), to.toCompressedData());
|
||||
this.REPLACEMENTS.put(from.toRawData(), to.toRawData());
|
||||
}
|
||||
|
||||
public void remapChunk(final Chunk chunk) {
|
||||
@ -60,10 +60,10 @@ public abstract class AbstractBlockRemapper {
|
||||
}
|
||||
|
||||
public void remapBlock(final IdAndData block) {
|
||||
if (this.REPLACEMENTS.containsKey(block.toCompressedData())) {
|
||||
final int replacement = this.REPLACEMENTS.get(block.toCompressedData());
|
||||
block.id = replacement >> 4;
|
||||
block.data = replacement & 15;
|
||||
if (this.REPLACEMENTS.containsKey(block.toRawData())) {
|
||||
final int replacement = this.REPLACEMENTS.get(block.toRawData());
|
||||
block.setId(replacement >> 4);
|
||||
block.setData(replacement & 15);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,8 @@ import com.viaversion.viaversion.libs.fastutil.ints.Int2IntMap;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.Int2IntOpenHashMap;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.IntOpenHashSet;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.IntSet;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import net.raphimc.vialegacy.api.model.ChunkCoord;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -107,9 +107,9 @@ public abstract class AbstractChunkTracker implements StorableObject {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
final int flatBlock = palette.idAt(x, y, z);
|
||||
if (this.trackAll || this.toTrack.contains(flatBlock >> 4)) {
|
||||
final IdAndData block = IdAndData.fromCompressedData(flatBlock);
|
||||
final IdAndData block = IdAndData.fromRawData(flatBlock);
|
||||
this.remapBlock(block, x + (chunk.getX() << 4), y + (i * 16), z + (chunk.getZ() << 4));
|
||||
final int newFlatBlock = block.toCompressedData();
|
||||
final int newFlatBlock = block.toRawData();
|
||||
if (newFlatBlock != flatBlock) {
|
||||
palette.setIdAt(x, y, z, newFlatBlock);
|
||||
}
|
||||
@ -130,34 +130,34 @@ public abstract class AbstractChunkTracker implements StorableObject {
|
||||
|
||||
if (chunk != null && y >= 0 && y >> 4 < chunk.getSections().length) {
|
||||
ChunkSection section = chunk.getSections()[y >> 4];
|
||||
if (this.trackAll || this.toTrack.contains(block.id)) {
|
||||
if (this.trackAll || this.toTrack.contains(block.getId())) {
|
||||
if (section == null) {
|
||||
section = chunk.getSections()[y >> 4] = new ChunkSectionImpl(false);
|
||||
section.palette(PaletteType.BLOCKS).addId(0);
|
||||
}
|
||||
section.palette(PaletteType.BLOCKS).setIdAt(x & 15, y & 15, z & 15, block.toCompressedData());
|
||||
section.palette(PaletteType.BLOCKS).setIdAt(x & 15, y & 15, z & 15, block.toRawData());
|
||||
} else if (section != null) {
|
||||
section.palette(PaletteType.BLOCKS).setIdAt(x & 15, y & 15, z & 15, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.replacements.containsKey(block.toCompressedData())) {
|
||||
final int newFlatBlock = this.replacements.get(block.toCompressedData());
|
||||
block.id = newFlatBlock >> 4;
|
||||
block.data = newFlatBlock & 15;
|
||||
if (this.replacements.containsKey(block.toRawData())) {
|
||||
final int newFlatBlock = this.replacements.get(block.toRawData());
|
||||
block.setId(newFlatBlock >> 4);
|
||||
block.setData(newFlatBlock & 15);
|
||||
}
|
||||
if (this.trackAll || this.toTrack.contains(block.id)) {
|
||||
if (this.trackAll || this.toTrack.contains(block.getId())) {
|
||||
this.remapBlock(block, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
public void remapBlockParticle(final IdAndData block) {
|
||||
if (this.replacements.containsKey(block.toCompressedData())) {
|
||||
final int newFlatBlock = this.replacements.get(block.toCompressedData());
|
||||
block.id = newFlatBlock >> 4;
|
||||
block.data = newFlatBlock & 15;
|
||||
if (this.replacements.containsKey(block.toRawData())) {
|
||||
final int newFlatBlock = this.replacements.get(block.toRawData());
|
||||
block.setId(newFlatBlock >> 4);
|
||||
block.setData(newFlatBlock & 15);
|
||||
}
|
||||
if (this.trackAll || this.toTrack.contains(block.id)) {
|
||||
if (this.trackAll || this.toTrack.contains(block.getId())) {
|
||||
this.remapBlock(block, 0, -16, 0);
|
||||
}
|
||||
}
|
||||
@ -190,14 +190,14 @@ public abstract class AbstractChunkTracker implements StorableObject {
|
||||
if (y < 0 || y >> 4 > chunk.getSections().length - 1) return null;
|
||||
final ChunkSection section = chunk.getSections()[y >> 4];
|
||||
if (section != null) {
|
||||
return IdAndData.fromCompressedData(section.palette(PaletteType.BLOCKS).idAt(x & 15, y & 15, z & 15));
|
||||
return IdAndData.fromRawData(section.palette(PaletteType.BLOCKS).idAt(x & 15, y & 15, z & 15));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void registerReplacement(final IdAndData from, final IdAndData to) {
|
||||
this.replacements.put(from.toCompressedData(), to.toCompressedData());
|
||||
this.replacements.put(from.toRawData(), to.toRawData());
|
||||
}
|
||||
|
||||
protected void remapBlock(final IdAndData block, final int x, final int y, final int z) {
|
||||
|
@ -27,10 +27,10 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.*;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import net.raphimc.vialegacy.ViaLegacy;
|
||||
import net.raphimc.vialegacy.api.data.BlockList1_6;
|
||||
import net.raphimc.vialegacy.api.data.ItemList1_6;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
|
||||
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
|
||||
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.data.AlphaItems;
|
||||
@ -149,7 +149,7 @@ public class Protocolb1_0_1_1_1toa1_2_3_5_1_2_6 extends StatelessProtocol<Client
|
||||
final IdAndData block = wrapper.user().get(ChunkTracker.class).getBlockNotNull(pos);
|
||||
final String blockName = tag.get("id") != null ? tag.<StringTag>get("id").getValue() : "";
|
||||
|
||||
if (block.id == BlockList1_6.signPost.blockID || block.id == BlockList1_6.signWall.blockID || blockName.equals("Sign")) {
|
||||
if (block.getId() == BlockList1_6.signPost.blockID || block.getId() == BlockList1_6.signWall.blockID || blockName.equals("Sign")) {
|
||||
final PacketWrapper updateSign = PacketWrapper.create(ClientboundPacketsb1_1.UPDATE_SIGN, wrapper.user());
|
||||
updateSign.write(Types1_7_6.POSITION_SHORT, pos); // position
|
||||
updateSign.write(Typesb1_7_0_3.STRING, tag.<StringTag>get("Text1").getValue()); // line 1
|
||||
@ -157,7 +157,7 @@ public class Protocolb1_0_1_1_1toa1_2_3_5_1_2_6 extends StatelessProtocol<Client
|
||||
updateSign.write(Typesb1_7_0_3.STRING, tag.<StringTag>get("Text3").getValue()); // line 3
|
||||
updateSign.write(Typesb1_7_0_3.STRING, tag.<StringTag>get("Text4").getValue()); // line 4
|
||||
updateSign.send(Protocolb1_0_1_1_1toa1_2_3_5_1_2_6.class);
|
||||
} else if (block.id == BlockList1_6.mobSpawner.blockID || blockName.equals("MobSpawner")) {
|
||||
} else if (block.getId() == BlockList1_6.mobSpawner.blockID || blockName.equals("MobSpawner")) {
|
||||
if (wrapper.user().getProtocolInfo().getPipeline().contains(Protocol1_2_1_3to1_1.class)) {
|
||||
final PacketWrapper spawnerData = PacketWrapper.create(ClientboundPackets1_2_1.BLOCK_ENTITY_DATA, wrapper.user());
|
||||
spawnerData.write(Types1_7_6.POSITION_SHORT, pos); // position
|
||||
@ -167,12 +167,12 @@ public class Protocolb1_0_1_1_1toa1_2_3_5_1_2_6 extends StatelessProtocol<Client
|
||||
spawnerData.write(Type.INT, 0); // unused
|
||||
spawnerData.send(Protocol1_2_1_3to1_1.class);
|
||||
}
|
||||
} else if (block.id == BlockList1_6.chest.blockID || blockName.equals("Chest")) {
|
||||
} else if (block.getId() == BlockList1_6.chest.blockID || blockName.equals("Chest")) {
|
||||
final Item[] chestItems = new Item[3 * 9];
|
||||
readItemsFromTag(tag, chestItems);
|
||||
tracker.containers.put(pos, chestItems);
|
||||
if (pos.equals(tracker.openContainerPos)) sendWindowItems(wrapper.user(), InventoryStorage.CHEST_WID, chestItems);
|
||||
} else if (block.id == BlockList1_6.furnaceIdle.blockID || block.id == BlockList1_6.furnaceBurning.blockID || blockName.equals("Furnace")) {
|
||||
} else if (block.getId() == BlockList1_6.furnaceIdle.blockID || block.getId() == BlockList1_6.furnaceBurning.blockID || blockName.equals("Furnace")) {
|
||||
final Item[] furnaceItems = new Item[3];
|
||||
readItemsFromTag(tag, furnaceItems);
|
||||
tracker.containers.put(pos, furnaceItems);
|
||||
@ -232,12 +232,12 @@ public class Protocolb1_0_1_1_1toa1_2_3_5_1_2_6 extends StatelessProtocol<Client
|
||||
if (direction == 255) return;
|
||||
|
||||
final IdAndData block = wrapper.user().get(ChunkTracker.class).getBlockNotNull(pos);
|
||||
if (block.id != BlockList1_6.furnaceIdle.blockID && block.id != BlockList1_6.furnaceBurning.blockID && block.id != BlockList1_6.chest.blockID && block.id != BlockList1_6.workbench.blockID) {
|
||||
if (block.getId() != BlockList1_6.furnaceIdle.blockID && block.getId() != BlockList1_6.furnaceBurning.blockID && block.getId() != BlockList1_6.chest.blockID && block.getId() != BlockList1_6.workbench.blockID) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Item[] containerItems = tracker.containers.get(tracker.openContainerPos = pos);
|
||||
if (containerItems == null && block.id != BlockList1_6.workbench.blockID) {
|
||||
if (containerItems == null && block.getId() != BlockList1_6.workbench.blockID) {
|
||||
tracker.openContainerPos = null;
|
||||
final PacketWrapper chatMessage = PacketWrapper.create(ClientboundPacketsb1_1.CHAT_MESSAGE, wrapper.user());
|
||||
chatMessage.write(Typesb1_7_0_3.STRING, "§cMissing Container"); // message
|
||||
@ -246,13 +246,13 @@ public class Protocolb1_0_1_1_1toa1_2_3_5_1_2_6 extends StatelessProtocol<Client
|
||||
}
|
||||
|
||||
final PacketWrapper openWindow = PacketWrapper.create(ClientboundPacketsb1_1.OPEN_WINDOW, wrapper.user());
|
||||
if (block.id == BlockList1_6.chest.blockID) {
|
||||
if (block.getId() == BlockList1_6.chest.blockID) {
|
||||
openWindow.write(Type.UNSIGNED_BYTE, (short) InventoryStorage.CHEST_WID); // window id
|
||||
openWindow.write(Type.UNSIGNED_BYTE, (short) 0); // window type
|
||||
openWindow.write(Typesb1_7_0_3.STRING, "Chest"); // title
|
||||
openWindow.write(Type.UNSIGNED_BYTE, (short) (3 * 9)); // slots
|
||||
if (inventoryTracker != null) inventoryTracker.onWindowOpen(0, 3 * 9);
|
||||
} else if (block.id == BlockList1_6.workbench.blockID) {
|
||||
} else if (block.getId() == BlockList1_6.workbench.blockID) {
|
||||
openWindow.write(Type.UNSIGNED_BYTE, (short) InventoryStorage.WORKBENCH_WID); // window id
|
||||
openWindow.write(Type.UNSIGNED_BYTE, (short) 1); // window type
|
||||
openWindow.write(Typesb1_7_0_3.STRING, "Crafting Table"); // title
|
||||
@ -267,8 +267,8 @@ public class Protocolb1_0_1_1_1toa1_2_3_5_1_2_6 extends StatelessProtocol<Client
|
||||
}
|
||||
openWindow.send(Protocolb1_0_1_1_1toa1_2_3_5_1_2_6.class);
|
||||
|
||||
if (block.id != BlockList1_6.workbench.blockID) {
|
||||
sendWindowItems(wrapper.user(), block.id == BlockList1_6.chest.blockID ? InventoryStorage.CHEST_WID : InventoryStorage.FURNACE_WID, containerItems);
|
||||
if (block.getId() != BlockList1_6.workbench.blockID) {
|
||||
sendWindowItems(wrapper.user(), block.getId() == BlockList1_6.chest.blockID ? InventoryStorage.CHEST_WID : InventoryStorage.FURNACE_WID, containerItems);
|
||||
}
|
||||
});
|
||||
this.registerServerbound(ServerboundPacketsb1_1.HELD_ITEM_CHANGE, wrapper -> {
|
||||
|
@ -19,8 +19,8 @@ package net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6
|
||||
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.*;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import net.raphimc.vialegacy.api.data.BlockList1_6;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
@ -312,7 +312,7 @@ public class AlphaItems {
|
||||
}
|
||||
});
|
||||
PLACE_ACTION.put(290, (i, d) -> {
|
||||
if (d.value().id == BlockList1_6.grass.blockID || d.value().id == BlockList1_6.dirt.blockID) {
|
||||
if (d.value().getId() == BlockList1_6.grass.blockID || d.value().getId() == BlockList1_6.dirt.blockID) {
|
||||
i.setData((short) (i.data() + 1));
|
||||
if (i.data() > 32) {
|
||||
i.setAmount(i.amount() - 1);
|
||||
@ -320,7 +320,7 @@ public class AlphaItems {
|
||||
}
|
||||
});
|
||||
PLACE_ACTION.put(291, (i, d) -> {
|
||||
if (d.value().id == BlockList1_6.grass.blockID || d.value().id == BlockList1_6.dirt.blockID) {
|
||||
if (d.value().getId() == BlockList1_6.grass.blockID || d.value().getId() == BlockList1_6.dirt.blockID) {
|
||||
i.setData((short) (i.data() + 1));
|
||||
if (i.data() > 64) {
|
||||
i.setAmount(i.amount() - 1);
|
||||
@ -328,7 +328,7 @@ public class AlphaItems {
|
||||
}
|
||||
});
|
||||
PLACE_ACTION.put(292, (i, d) -> {
|
||||
if (d.value().id == BlockList1_6.grass.blockID || d.value().id == BlockList1_6.dirt.blockID) {
|
||||
if (d.value().getId() == BlockList1_6.grass.blockID || d.value().getId() == BlockList1_6.dirt.blockID) {
|
||||
i.setData((short) (i.data() + 1));
|
||||
if (i.data() > 128) {
|
||||
i.setAmount(i.amount() - 1);
|
||||
@ -336,7 +336,7 @@ public class AlphaItems {
|
||||
}
|
||||
});
|
||||
PLACE_ACTION.put(293, (i, d) -> {
|
||||
if (d.value().id == BlockList1_6.grass.blockID || d.value().id == BlockList1_6.dirt.blockID) {
|
||||
if (d.value().getId() == BlockList1_6.grass.blockID || d.value().getId() == BlockList1_6.dirt.blockID) {
|
||||
i.setData((short) (i.data() + 1));
|
||||
if (i.data() > 256) {
|
||||
i.setAmount(i.amount() - 1);
|
||||
@ -344,7 +344,7 @@ public class AlphaItems {
|
||||
}
|
||||
});
|
||||
PLACE_ACTION.put(294, (i, d) -> {
|
||||
if (d.value().id == BlockList1_6.grass.blockID || d.value().id == BlockList1_6.dirt.blockID) {
|
||||
if (d.value().getId() == BlockList1_6.grass.blockID || d.value().getId() == BlockList1_6.dirt.blockID) {
|
||||
i.setData((short) (i.data() + 1));
|
||||
if (i.data() > 64) {
|
||||
i.setAmount(i.amount() - 1);
|
||||
@ -352,7 +352,7 @@ public class AlphaItems {
|
||||
}
|
||||
});
|
||||
PLACE_ACTION.put(295, (i, d) -> {
|
||||
if (d.keyInt() == 1 && d.value().id == BlockList1_6.tilledField.blockID) {
|
||||
if (d.keyInt() == 1 && d.value().getId() == BlockList1_6.tilledField.blockID) {
|
||||
i.setAmount(i.amount() - 1);
|
||||
}
|
||||
});
|
||||
@ -363,7 +363,7 @@ public class AlphaItems {
|
||||
if (d.keyInt() == 1) i.setAmount(i.amount() - 1);
|
||||
});
|
||||
PLACE_ACTION.put(328, (i, d) -> {
|
||||
if (d.value().id == BlockList1_6.rail.blockID) {
|
||||
if (d.value().getId() == BlockList1_6.rail.blockID) {
|
||||
i.setAmount(i.amount() - 1);
|
||||
}
|
||||
});
|
||||
@ -371,22 +371,22 @@ public class AlphaItems {
|
||||
if (d.keyInt() == 1) i.setAmount(i.amount() - 1);
|
||||
});
|
||||
PLACE_ACTION.put(342, (i, d) -> {
|
||||
if (d.value().id == BlockList1_6.rail.blockID) {
|
||||
if (d.value().getId() == BlockList1_6.rail.blockID) {
|
||||
i.setAmount(i.amount() - 1);
|
||||
}
|
||||
});
|
||||
PLACE_ACTION.put(343, (i, d) -> {
|
||||
if (d.value().id == BlockList1_6.rail.blockID) {
|
||||
if (d.value().getId() == BlockList1_6.rail.blockID) {
|
||||
i.setAmount(i.amount() - 1);
|
||||
}
|
||||
});
|
||||
PLACE_ACTION.put(2256, (i, d) -> {
|
||||
if (d.value().id == BlockList1_6.jukebox.blockID && d.value().data == 0) {
|
||||
if (d.value().getId() == BlockList1_6.jukebox.blockID && d.value().getData() == 0) {
|
||||
i.setAmount(i.amount() - 1);
|
||||
}
|
||||
});
|
||||
PLACE_ACTION.put(2257, (i, d) -> {
|
||||
if (d.value().id == BlockList1_6.jukebox.blockID && d.value().data == 0) {
|
||||
if (d.value().getId() == BlockList1_6.jukebox.blockID && d.value().getData() == 0) {
|
||||
i.setAmount(i.amount() - 1);
|
||||
}
|
||||
});
|
||||
|
@ -24,10 +24,10 @@ import com.viaversion.viaversion.api.minecraft.item.DataItem;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import net.raphimc.vialegacy.api.data.BlockList1_6;
|
||||
import net.raphimc.vialegacy.api.data.ItemList1_6;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
import net.raphimc.vialegacy.api.util.BlockFaceUtil;
|
||||
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.Protocolb1_0_1_1_1toa1_2_3_5_1_2_6;
|
||||
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.data.AlphaItems;
|
||||
@ -261,13 +261,13 @@ public class AlphaInventoryTracker extends StoredObject {
|
||||
AlphaItems.doPlace(handItem, direction, placedAgainst);
|
||||
|
||||
if (handItem.identifier() < 256 || handItem.identifier() == ItemList1_6.reed.itemID) { // block item
|
||||
if (targetBlock.id == 0 || targetBlock.id == BlockList1_6.waterStill.blockID || targetBlock.id == BlockList1_6.waterMoving.blockID || targetBlock.id == BlockList1_6.lavaStill.blockID || targetBlock.id == BlockList1_6.lavaMoving.blockID || targetBlock.id == BlockList1_6.fire.blockID || targetBlock.id == BlockList1_6.snow.blockID) {
|
||||
if (targetBlock.getId() == 0 || targetBlock.getId() == BlockList1_6.waterStill.blockID || targetBlock.getId() == BlockList1_6.waterMoving.blockID || targetBlock.getId() == BlockList1_6.lavaStill.blockID || targetBlock.getId() == BlockList1_6.lavaMoving.blockID || targetBlock.getId() == BlockList1_6.fire.blockID || targetBlock.getId() == BlockList1_6.snow.blockID) {
|
||||
handItem.setAmount(handItem.amount() - 1);
|
||||
}
|
||||
} else if (handItem.identifier() == ItemList1_6.sign.itemID) {
|
||||
if (direction != 0 && targetBlock.id == 0) handItem.setAmount(handItem.amount() - 1);
|
||||
if (direction != 0 && targetBlock.getId() == 0) handItem.setAmount(handItem.amount() - 1);
|
||||
} else if (handItem.identifier() == ItemList1_6.redstone.itemID) {
|
||||
if (targetBlock.id == 0) handItem.setAmount(handItem.amount() - 1);
|
||||
if (targetBlock.getId() == 0) handItem.setAmount(handItem.amount() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,9 +23,9 @@ import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import net.raphimc.vialegacy.ViaLegacy;
|
||||
import net.raphimc.vialegacy.api.data.BlockList1_6;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.Protocol1_0_0_1tob1_8_0_1;
|
||||
import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.storage.PlayerAirTimeStorage;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_1to1_0_0_1.ClientboundPackets1_0;
|
||||
@ -50,7 +50,7 @@ public class PlayerAirTimeUpdateTask implements Runnable {
|
||||
|
||||
try {
|
||||
final IdAndData headBlock = info.get(ChunkTracker.class).getBlockNotNull(floor(playerInfoStorage.posX), floor(playerInfoStorage.posY + 1.62F), floor(playerInfoStorage.posZ));
|
||||
if (headBlock.id == BlockList1_6.waterMoving.blockID || headBlock.id == BlockList1_6.waterStill.blockID) {
|
||||
if (headBlock.getId() == BlockList1_6.waterMoving.blockID || headBlock.getId() == BlockList1_6.waterStill.blockID) {
|
||||
playerAirTimeStorage.sentPacket = false;
|
||||
playerAirTimeStorage.air--;
|
||||
if (playerAirTimeStorage.air < 0) playerAirTimeStorage.air = 0;
|
||||
|
@ -24,7 +24,7 @@ import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
|
||||
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
|
||||
import net.raphimc.vialegacy.protocols.beta.protocolb1_2_0_2tob1_1_2.rewriter.BlockDataRewriter;
|
||||
@ -155,8 +155,8 @@ public class Protocolb1_2_0_2tob1_1_2 extends StatelessProtocol<ClientboundPacke
|
||||
handler(wrapper -> {
|
||||
final IdAndData block = new IdAndData(wrapper.get(Type.UNSIGNED_BYTE, 0), wrapper.get(Type.UNSIGNED_BYTE, 1));
|
||||
BLOCK_DATA_REWRITER.remapBlock(block);
|
||||
wrapper.set(Type.UNSIGNED_BYTE, 0, (short) block.id);
|
||||
wrapper.set(Type.UNSIGNED_BYTE, 1, (short) block.data);
|
||||
wrapper.set(Type.UNSIGNED_BYTE, 0, (short) block.getId());
|
||||
wrapper.set(Type.UNSIGNED_BYTE, 1, (short) block.getData());
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -17,8 +17,8 @@
|
||||
*/
|
||||
package net.raphimc.vialegacy.protocols.beta.protocolb1_2_0_2tob1_1_2.rewriter;
|
||||
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import net.raphimc.vialegacy.api.data.BlockList1_6;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
import net.raphimc.vialegacy.api.remapper.AbstractBlockRemapper;
|
||||
|
||||
public class BlockDataRewriter extends AbstractBlockRemapper {
|
||||
|
@ -25,7 +25,7 @@ import com.viaversion.viaversion.api.platform.providers.ViaProviders;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
|
||||
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
|
||||
import net.raphimc.vialegacy.protocols.beta.protocolb1_3_0_1tob1_2_0_2.data.BlockHardnessList;
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
package net.raphimc.vialegacy.protocols.beta.protocolb1_3_0_1tob1_2_0_2.data;
|
||||
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -116,7 +116,7 @@ public class BlockHardnessList {
|
||||
}
|
||||
|
||||
public static boolean canBeBrokenInstantly(final IdAndData block) {
|
||||
return canBeBrokenInstantly(block.id);
|
||||
return canBeBrokenInstantly(block.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,9 +25,9 @@ import com.viaversion.viaversion.api.platform.providers.ViaProviders;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import net.raphimc.vialegacy.api.data.BlockList1_6;
|
||||
import net.raphimc.vialegacy.api.data.ItemList1_6;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
|
||||
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
|
||||
import net.raphimc.vialegacy.protocols.beta.protocolb1_6_0_6tob1_5_0_2.storage.WorldTimeStorage;
|
||||
@ -90,17 +90,17 @@ public class Protocolb1_6_0_6tob1_5_0_2 extends StatelessProtocol<ClientboundPac
|
||||
Position pos = wrapper.get(Types1_7_6.POSITION_UBYTE, 0);
|
||||
IdAndData block = wrapper.user().get(ChunkTracker.class).getBlockNotNull(pos);
|
||||
final Item item = wrapper.get(Types1_4_2.NBTLESS_ITEM, 0);
|
||||
if (block.id == BlockList1_6.bed.blockID) {
|
||||
if (block.getId() == BlockList1_6.bed.blockID) {
|
||||
final byte[][] headBlockToFootBlock = {{0, 1}, {-1, 0}, {0, -1}, {1, 0}};
|
||||
final boolean isFoot = (block.data & 8) != 0;
|
||||
final boolean isFoot = (block.getData() & 8) != 0;
|
||||
if (!isFoot) {
|
||||
final int bedDirection = block.data & 3;
|
||||
final int bedDirection = block.getData() & 3;
|
||||
pos = new Position(pos.x() + headBlockToFootBlock[bedDirection][0], pos.y(), pos.z() + headBlockToFootBlock[bedDirection][1]);
|
||||
block = wrapper.user().get(ChunkTracker.class).getBlockNotNull(pos);
|
||||
if (block.id != BlockList1_6.bed.blockID) return;
|
||||
if (block.getId() != BlockList1_6.bed.blockID) return;
|
||||
}
|
||||
|
||||
final boolean isOccupied = (block.data & 4) != 0;
|
||||
final boolean isOccupied = (block.getData() & 4) != 0;
|
||||
if (isOccupied) {
|
||||
final PacketWrapper chat = PacketWrapper.create(ClientboundPacketsb1_7.CHAT_MESSAGE, wrapper.user());
|
||||
chat.write(Types1_6_4.STRING, "This bed is occupied");
|
||||
@ -138,8 +138,8 @@ public class Protocolb1_6_0_6tob1_5_0_2 extends StatelessProtocol<ClientboundPac
|
||||
useBed.write(Type.BYTE, (byte) 0); // magic value (always 0)
|
||||
useBed.write(Types1_7_6.POSITION_BYTE, pos); // position
|
||||
useBed.send(Protocolb1_6_0_6tob1_5_0_2.class);
|
||||
} else if (block.id == BlockList1_6.jukebox.blockID) {
|
||||
if (block.data > 0) {
|
||||
} else if (block.getId() == BlockList1_6.jukebox.blockID) {
|
||||
if (block.getData() > 0) {
|
||||
final PacketWrapper effect = PacketWrapper.create(ClientboundPacketsb1_7.EFFECT, wrapper.user());
|
||||
effect.write(Type.INT, 1005); // effect id
|
||||
effect.write(Types1_7_6.POSITION_UBYTE, pos); // position
|
||||
|
@ -297,7 +297,7 @@ public class Protocolb1_8_0_1tob1_7_0_3 extends StatelessProtocol<ClientboundPac
|
||||
}
|
||||
} else {
|
||||
final Position pos = wrapper.get(Types1_7_6.POSITION_UBYTE, 0);
|
||||
if (wrapper.user().get(ChunkTracker.class).getBlockNotNull(pos).id == BlockList1_6.cake.blockID) {
|
||||
if (wrapper.user().get(ChunkTracker.class).getBlockNotNull(pos).getId() == BlockList1_6.cake.blockID) {
|
||||
final PacketWrapper updateHealth = PacketWrapper.create(ClientboundPacketsb1_7.UPDATE_HEALTH, wrapper.user());
|
||||
updateHealth.write(Type.SHORT, wrapper.user().get(PlayerHealthTracker.class).getHealth()); // health
|
||||
updateHealth.send(Protocolb1_8_0_1tob1_7_0_3.class, false);
|
||||
|
@ -26,10 +26,10 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_8.ClientboundPackets1_8;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import net.raphimc.vialegacy.ViaLegacy;
|
||||
import net.raphimc.vialegacy.api.data.BlockList1_6;
|
||||
import net.raphimc.vialegacy.api.model.ChunkCoord;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
|
||||
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
|
||||
import net.raphimc.vialegacy.api.util.BlockFaceUtil;
|
||||
@ -199,8 +199,8 @@ public class Protocola1_0_15toc0_30 extends StatelessProtocol<ClientboundPackets
|
||||
return;
|
||||
}
|
||||
final IdAndData mappedBlock = remapper.getMapper().get(blockId);
|
||||
wrapper.write(Type.UNSIGNED_BYTE, (short) mappedBlock.id); // block id
|
||||
wrapper.write(Type.UNSIGNED_BYTE, (short) mappedBlock.data); // block data
|
||||
wrapper.write(Type.UNSIGNED_BYTE, (short) mappedBlock.getId()); // block id
|
||||
wrapper.write(Type.UNSIGNED_BYTE, (short) mappedBlock.getData()); // block data
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -479,8 +479,8 @@ public class Protocola1_0_15toc0_30 extends StatelessProtocol<ClientboundPackets
|
||||
private void sendBlockChange(final UserConnection user, final Position pos, final IdAndData block) throws Exception {
|
||||
final PacketWrapper blockChange = PacketWrapper.create(ClientboundPacketsa1_0_15.BLOCK_CHANGE, user);
|
||||
blockChange.write(Types1_7_6.POSITION_UBYTE, pos); // position
|
||||
blockChange.write(Type.UNSIGNED_BYTE, (short) block.id); // block id
|
||||
blockChange.write(Type.UNSIGNED_BYTE, (short) block.data); // block data
|
||||
blockChange.write(Type.UNSIGNED_BYTE, (short) block.getId()); // block id
|
||||
blockChange.write(Type.UNSIGNED_BYTE, (short) block.getData()); // block data
|
||||
blockChange.send(Protocola1_0_15toc0_30.class);
|
||||
}
|
||||
|
||||
|
@ -21,9 +21,9 @@ import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectMap;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import com.viaversion.viaversion.libs.fastutil.objects.Object2IntMap;
|
||||
import com.viaversion.viaversion.libs.fastutil.objects.Object2IntOpenHashMap;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import net.raphimc.vialegacy.api.data.BlockList1_6;
|
||||
import net.raphimc.vialegacy.api.data.ItemList1_6;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
|
||||
public class ClassicBlocks {
|
||||
|
||||
|
@ -20,7 +20,7 @@ package net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.storag
|
||||
import com.viaversion.viaversion.api.connection.StorableObject;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectFunction;
|
||||
import com.viaversion.viaversion.libs.fastutil.objects.Object2IntFunction;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
|
||||
public class ClassicBlockRemapper implements StorableObject {
|
||||
|
||||
|
@ -167,7 +167,7 @@ public class ClassicLevelStorage extends StoredObject {
|
||||
final int totalX = x + (coord.chunkX * 16);
|
||||
for (int z = 0; z < this.subChunkZLength; z++) {
|
||||
final int totalZ = z + (coord.chunkZ * 16);
|
||||
section.palette(PaletteType.BLOCKS).setIdAt(x, y, z, remapper.getMapper().get(this.classicLevel.getBlock(totalX, totalY, totalZ)).toCompressedData());
|
||||
section.palette(PaletteType.BLOCKS).setIdAt(x, y, z, remapper.getMapper().get(this.classicLevel.getBlock(totalX, totalY, totalZ)).toRawData());
|
||||
skyLight.set(x, y, z, this.classicLevel.isLit(totalX, totalY, totalZ) ? 15 : 9);
|
||||
}
|
||||
}
|
||||
|
@ -27,10 +27,10 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.FixedByteArrayType;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import net.raphimc.vialegacy.ViaLegacy;
|
||||
import net.raphimc.vialegacy.api.data.BlockList1_6;
|
||||
import net.raphimc.vialegacy.api.model.ChunkCoord;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
|
||||
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
|
||||
import net.raphimc.vialegacy.protocols.alpha.protocola1_0_16_2toa1_0_15.ClientboundPacketsa1_0_15;
|
||||
@ -199,7 +199,7 @@ public class Protocolc0_30toc0_30cpe extends StatelessProtocol<ClientboundPacket
|
||||
level.setBlock(pos, blockId);
|
||||
if (!levelStorage.isChunkLoaded(pos)) continue;
|
||||
final IdAndData mappedBlock = remapper.getMapper().get(blockId);
|
||||
records.computeIfAbsent(new ChunkCoord(pos.x() >> 4, pos.z() >> 4), k -> new ArrayList<>()).add(new BlockChangeRecord1_8(pos.x() & 15, pos.y(), pos.z() & 15, mappedBlock.toCompressedData()));
|
||||
records.computeIfAbsent(new ChunkCoord(pos.x() >> 4, pos.z() >> 4), k -> new ArrayList<>()).add(new BlockChangeRecord1_8(pos.x() & 15, pos.y(), pos.z() & 15, mappedBlock.toRawData()));
|
||||
}
|
||||
|
||||
for (Map.Entry<ChunkCoord, List<BlockChangeRecord>> entry : records.entrySet()) {
|
||||
|
@ -21,8 +21,8 @@ import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectMap;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import com.viaversion.viaversion.libs.fastutil.objects.Object2IntMap;
|
||||
import com.viaversion.viaversion.libs.fastutil.objects.Object2IntOpenHashMap;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import net.raphimc.vialegacy.api.data.BlockList1_6;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.data.ClassicBlocks;
|
||||
|
||||
public class ExtendedClassicBlocks {
|
||||
|
@ -28,9 +28,9 @@ import com.viaversion.viaversion.api.platform.providers.ViaProviders;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import net.raphimc.vialegacy.ViaLegacy;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
|
||||
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
|
||||
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
|
||||
@ -253,7 +253,7 @@ public class Protocol1_2_1_3to1_1 extends StatelessProtocol<ClientboundPackets1_
|
||||
for (int i = 0; i < recordCount; i++) {
|
||||
final Position pos = new Position(x + wrapper.passthrough(Type.BYTE), y + wrapper.passthrough(Type.BYTE), z + wrapper.passthrough(Type.BYTE));
|
||||
final IdAndData block = chunkTracker.getBlockNotNull(pos);
|
||||
if (block.id != 0) {
|
||||
if (block.getId() != 0) {
|
||||
pendingBlocksTracker.addPending(pos, block);
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
package net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.model;
|
||||
|
||||
import com.viaversion.viaversion.api.minecraft.Position;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
|
||||
public class PendingBlockEntry {
|
||||
|
||||
|
@ -22,8 +22,8 @@ import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.Position;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import net.raphimc.vialegacy.ViaLegacy;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.Protocol1_2_1_3to1_1;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.model.PendingBlockEntry;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_2_4_5to1_2_1_3.ClientboundPackets1_2_1;
|
||||
@ -73,8 +73,8 @@ public class PendingBlocksTracker extends StoredObject {
|
||||
try {
|
||||
final PacketWrapper blockChange = PacketWrapper.create(ClientboundPackets1_2_1.BLOCK_CHANGE, this.getUser());
|
||||
blockChange.write(Types1_7_6.POSITION_UBYTE, pendingBlockEntry.getPosition()); // position
|
||||
blockChange.write(Type.UNSIGNED_BYTE, (short) pendingBlockEntry.getBlock().id); // block id
|
||||
blockChange.write(Type.UNSIGNED_BYTE, (short) pendingBlockEntry.getBlock().data); // block data
|
||||
blockChange.write(Type.UNSIGNED_BYTE, (short) pendingBlockEntry.getBlock().getId()); // block id
|
||||
blockChange.write(Type.UNSIGNED_BYTE, (short) pendingBlockEntry.getBlock().getData()); // block data
|
||||
blockChange.send(Protocol1_2_1_3to1_1.class);
|
||||
} catch (Throwable e) {
|
||||
ViaLegacy.getPlatform().getLogger().log(Level.WARNING, "Could not send block update for expired pending block", e);
|
||||
|
@ -20,8 +20,8 @@ package net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.types;
|
||||
import com.viaversion.viaversion.api.minecraft.BlockChangeRecord;
|
||||
import com.viaversion.viaversion.api.minecraft.BlockChangeRecord1_8;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
|
||||
public class BlockChangeRecordArrayType extends Type<BlockChangeRecord[]> {
|
||||
|
||||
@ -47,7 +47,7 @@ public class BlockChangeRecordArrayType extends Type<BlockChangeRecord[]> {
|
||||
|
||||
final BlockChangeRecord[] blockChangeRecords = new BlockChangeRecord[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
blockChangeRecords[i] = new BlockChangeRecord1_8(positions[i] >> 12 & 15, positions[i] & 255, positions[i] >> 8 & 15, IdAndData.toCompressedData(blocks[i], metas[i]));
|
||||
blockChangeRecords[i] = new BlockChangeRecord1_8(positions[i] >> 12 & 15, positions[i] & 255, positions[i] >> 8 & 15, IdAndData.toRawData(blocks[i], metas[i]));
|
||||
}
|
||||
return blockChangeRecords;
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ package net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.types;
|
||||
import com.viaversion.viaversion.api.minecraft.Position;
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.*;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.chunks.NibbleArray1_1;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.model.NonFullChunk1_1;
|
||||
|
||||
@ -149,7 +149,7 @@ public class ChunkType1_1 extends Type<Chunk> {
|
||||
|
||||
for (int x = startX; x < endX; x++) {
|
||||
for (int z = startZ; z < endZ; z++) {
|
||||
section.palette(PaletteType.BLOCKS).setIdAt(x, y & 15, z, IdAndData.toCompressedData(blockArray[x << 11 | z << 7 | y] & 255, blockDataArray.get(x, y, z)));
|
||||
section.palette(PaletteType.BLOCKS).setIdAt(x, y & 15, z, IdAndData.toRawData(blockArray[x << 11 | z << 7 | y] & 255, blockDataArray.get(x, y, z)));
|
||||
sectionSkyLight.set(x, y & 15, z, skyLightArray.get(x, y, z));
|
||||
sectionBlockLight.set(x, y & 15, z, blockLightArray.get(x, y, z));
|
||||
}
|
||||
|
@ -39,9 +39,9 @@ import com.viaversion.viaversion.libs.opennbt.tag.builtin.IntTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.ShortTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag;
|
||||
import com.viaversion.viaversion.util.ChunkUtil;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import net.raphimc.vialegacy.ViaLegacy;
|
||||
import net.raphimc.vialegacy.api.data.BlockList1_6;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
import net.raphimc.vialegacy.api.model.Location;
|
||||
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
|
||||
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
|
||||
@ -487,7 +487,7 @@ public class Protocol1_3_1_2to1_2_4_5 extends StatelessProtocol<ClientboundPacke
|
||||
map(Type.BYTE); // data
|
||||
handler(wrapper -> {
|
||||
final IdAndData block = wrapper.user().get(ChunkTracker.class).getBlockNotNull(wrapper.get(Types1_7_6.POSITION_SHORT, 0));
|
||||
wrapper.write(Type.SHORT, (short) block.id); // block id
|
||||
wrapper.write(Type.SHORT, (short) block.getId()); // block id
|
||||
|
||||
final EntityTracker entityTracker = wrapper.user().get(EntityTracker.class);
|
||||
final Position pos = wrapper.get(Types1_7_6.POSITION_SHORT, 0);
|
||||
@ -500,7 +500,7 @@ public class Protocol1_3_1_2to1_2_4_5 extends StatelessProtocol<ClientboundPacke
|
||||
float pitch = 1F;
|
||||
Sound sound = null;
|
||||
|
||||
if (blockId == BlockList1_6.music.blockID) {
|
||||
if (block.getId() == BlockList1_6.music.blockID) {
|
||||
switch (type) {
|
||||
default:
|
||||
case 0:
|
||||
@ -521,7 +521,7 @@ public class Protocol1_3_1_2to1_2_4_5 extends StatelessProtocol<ClientboundPacke
|
||||
}
|
||||
volume = 3F;
|
||||
pitch = (float) Math.pow(2D, (double) (data - 12) / 12D);
|
||||
} else if (blockId == BlockList1_6.chest.blockID) {
|
||||
} else if (block.getId() == BlockList1_6.chest.blockID) {
|
||||
if (type == 1) {
|
||||
final ChestStateTracker chestStateTracker = wrapper.user().get(ChestStateTracker.class);
|
||||
if (chestStateTracker.isChestOpen(pos) && data <= 0) {
|
||||
@ -534,7 +534,7 @@ public class Protocol1_3_1_2to1_2_4_5 extends StatelessProtocol<ClientboundPacke
|
||||
volume = 0.5F;
|
||||
pitch = entityTracker.RND.nextFloat() * 0.1F + 0.9F;
|
||||
}
|
||||
} else if (blockId == BlockList1_6.pistonBase.blockID || blockId == BlockList1_6.pistonStickyBase.blockID) {
|
||||
} else if (block.getId() == BlockList1_6.pistonBase.blockID || block.getId() == BlockList1_6.pistonStickyBase.blockID) {
|
||||
if (type == 0) {
|
||||
sound = Sound.PISTON_OUT;
|
||||
volume = 0.5F;
|
||||
|
@ -44,11 +44,11 @@ import com.viaversion.viaversion.protocols.base.ClientboundStatusPackets;
|
||||
import com.viaversion.viaversion.protocols.base.ServerboundLoginPackets;
|
||||
import com.viaversion.viaversion.protocols.base.ServerboundStatusPackets;
|
||||
import com.viaversion.viaversion.protocols.protocol1_8.ClientboundPackets1_8;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelOutboundHandlerAdapter;
|
||||
import io.netty.channel.ChannelPromise;
|
||||
import net.raphimc.vialegacy.ViaLegacy;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
import net.raphimc.vialegacy.api.protocol.StatelessTransitionProtocol;
|
||||
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
|
||||
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
|
||||
@ -321,7 +321,7 @@ public class Protocol1_7_2_5to1_6_4 extends StatelessTransitionProtocol<Clientbo
|
||||
final int metadata = data >> 16;
|
||||
final IdAndData block = new IdAndData(id, metadata);
|
||||
wrapper.user().get(ChunkTracker.class).remapBlockParticle(block);
|
||||
data = (block.id & 0xFFFF) | block.data << 16;
|
||||
data = (block.getId() & 0xFFFF) | block.getData() << 16;
|
||||
}
|
||||
wrapper.set(Type.INT, 3, data);
|
||||
});
|
||||
@ -409,10 +409,10 @@ public class Protocol1_7_2_5to1_6_4 extends StatelessTransitionProtocol<Clientbo
|
||||
final int targetX = record.getSectionX() + (chunkX << 4);
|
||||
final int targetY = record.getY(-1);
|
||||
final int targetZ = record.getSectionZ() + (chunkZ << 4);
|
||||
final IdAndData block = IdAndData.fromCompressedData(record.getBlockId());
|
||||
final IdAndData block = IdAndData.fromRawData(record.getBlockId());
|
||||
final Position pos = new Position(targetX, targetY, targetZ);
|
||||
wrapper.user().get(ChunkTracker.class).trackAndRemap(pos, block);
|
||||
record.setBlockId(block.toCompressedData());
|
||||
record.setBlockId(block.toRawData());
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -429,8 +429,8 @@ public class Protocol1_7_2_5to1_6_4 extends StatelessTransitionProtocol<Clientbo
|
||||
final int data = wrapper.get(Type.UNSIGNED_BYTE, 0); // block data
|
||||
final IdAndData block = new IdAndData(blockId, data);
|
||||
wrapper.user().get(ChunkTracker.class).trackAndRemap(pos, block);
|
||||
wrapper.set(Type.VAR_INT, 0, block.id); // block id
|
||||
wrapper.set(Type.UNSIGNED_BYTE, 0, (short) block.data); // block data
|
||||
wrapper.set(Type.VAR_INT, 0, block.getId()); // block id
|
||||
wrapper.set(Type.UNSIGNED_BYTE, 0, (short) block.getData()); // block data
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -523,7 +523,7 @@ public class Protocol1_7_2_5to1_6_4 extends StatelessTransitionProtocol<Clientbo
|
||||
final int blockData = data >> 12 & 255;
|
||||
final IdAndData block = new IdAndData(blockID, blockData);
|
||||
chunkTracker.remapBlockParticle(block);
|
||||
data = (block.id & 4095) | block.data << 12;
|
||||
data = (block.getId() & 4095) | block.getData() << 12;
|
||||
|
||||
wrapper.set(Type.INT, 1, data);
|
||||
}
|
||||
@ -552,8 +552,8 @@ public class Protocol1_7_2_5to1_6_4 extends StatelessTransitionProtocol<Clientbo
|
||||
final int metadata = Integer.parseInt(parts[2]);
|
||||
final IdAndData block = new IdAndData(id, metadata);
|
||||
wrapper.user().get(ChunkTracker.class).remapBlockParticle(block);
|
||||
parts[1] = String.valueOf(block.id);
|
||||
parts[2] = String.valueOf(block.data);
|
||||
parts[1] = String.valueOf(block.getId());
|
||||
parts[2] = String.valueOf(block.getData());
|
||||
}
|
||||
|
||||
wrapper.set(Type.STRING, 0, String.join("_", parts));
|
||||
|
@ -19,9 +19,9 @@ package net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.storage;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.DataPalette;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import net.raphimc.vialegacy.api.data.BlockList1_6;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
import net.raphimc.vialegacy.api.remapper.AbstractChunkTracker;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -241,25 +241,25 @@ public class ChunkTracker extends AbstractChunkTracker {
|
||||
|
||||
@Override
|
||||
protected void remapBlock(final IdAndData block, final int x, final int y, final int z) {
|
||||
if (this.b173 && block.id == BlockList1_6.chest.blockID) {
|
||||
if (this.b173 && block.getId() == BlockList1_6.chest.blockID) {
|
||||
byte blockData = 3;
|
||||
int rot1 = this.getBlockNotNull(x, y, z - 1).id;
|
||||
int rot2 = this.getBlockNotNull(x, y, z + 1).id;
|
||||
int rot3 = this.getBlockNotNull(x - 1, y, z).id;
|
||||
int rot4 = this.getBlockNotNull(x + 1, y, z).id;
|
||||
int rot1 = this.getBlockNotNull(x, y, z - 1).getId();
|
||||
int rot2 = this.getBlockNotNull(x, y, z + 1).getId();
|
||||
int rot3 = this.getBlockNotNull(x - 1, y, z).getId();
|
||||
int rot4 = this.getBlockNotNull(x + 1, y, z).getId();
|
||||
|
||||
int rot5;
|
||||
if (rot3 == BlockList1_6.chest.blockID) {
|
||||
rot5 = this.getBlockNotNull(x - 1, y, z - 1).id;
|
||||
rot5 = this.getBlockNotNull(x - 1, y, z - 1).getId();
|
||||
} else {
|
||||
rot5 = this.getBlockNotNull(x + 1, y, z - 1).id;
|
||||
rot5 = this.getBlockNotNull(x + 1, y, z - 1).getId();
|
||||
}
|
||||
|
||||
int rot6;
|
||||
if (rot3 == BlockList1_6.chest.blockID) {
|
||||
rot6 = this.getBlockNotNull(x - 1, y, z + 1).id;
|
||||
rot6 = this.getBlockNotNull(x - 1, y, z + 1).getId();
|
||||
} else {
|
||||
rot6 = this.getBlockNotNull(x + 1, y, z + 1).id;
|
||||
rot6 = this.getBlockNotNull(x + 1, y, z + 1).getId();
|
||||
}
|
||||
|
||||
if (rot1 != BlockList1_6.chest.blockID && rot2 != BlockList1_6.chest.blockID) {
|
||||
@ -286,15 +286,15 @@ public class ChunkTracker extends AbstractChunkTracker {
|
||||
blockData = 5;
|
||||
|
||||
if (rot1 == BlockList1_6.chest.blockID) {
|
||||
rot5 = this.getBlockNotNull(x - 1, y, z - 1).id;
|
||||
rot5 = this.getBlockNotNull(x - 1, y, z - 1).getId();
|
||||
} else {
|
||||
rot5 = this.getBlockNotNull(x - 1, y, z + 1).id;
|
||||
rot5 = this.getBlockNotNull(x - 1, y, z + 1).getId();
|
||||
}
|
||||
|
||||
if (rot1 == BlockList1_6.chest.blockID) {
|
||||
rot6 = this.getBlockNotNull(x + 1, y, z - 1).id;
|
||||
rot6 = this.getBlockNotNull(x + 1, y, z - 1).getId();
|
||||
} else {
|
||||
rot6 = this.getBlockNotNull(x + 1, y, z + 1).id;
|
||||
rot6 = this.getBlockNotNull(x + 1, y, z + 1).getId();
|
||||
}
|
||||
|
||||
if (SOLID_BLOCKS.get(rot4) || SOLID_BLOCKS.get(rot6)) {
|
||||
@ -303,7 +303,7 @@ public class ChunkTracker extends AbstractChunkTracker {
|
||||
}
|
||||
}
|
||||
}
|
||||
block.data = blockData;
|
||||
block.setData(blockData);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,9 +46,9 @@ import com.viaversion.viaversion.protocols.base.ClientboundLoginPackets;
|
||||
import com.viaversion.viaversion.protocols.base.ServerboundLoginPackets;
|
||||
import com.viaversion.viaversion.protocols.protocol1_8.ClientboundPackets1_8;
|
||||
import com.viaversion.viaversion.protocols.protocol1_8.ServerboundPackets1_8;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import net.raphimc.vialegacy.ViaLegacy;
|
||||
import net.raphimc.vialegacy.api.data.ItemList1_6;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
|
||||
import net.raphimc.vialegacy.api.util.PacketUtil;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_7_6_10to1_7_2_5.ClientboundPackets1_7_2;
|
||||
@ -311,7 +311,7 @@ public class Protocol1_8to1_7_6_10 extends AbstractProtocol<ClientboundPackets1_
|
||||
final int metadata = data >> 16;
|
||||
final IdAndData block = new IdAndData(id, metadata);
|
||||
wrapper.user().get(ChunkTracker.class).remapBlockParticle(block);
|
||||
data = block.id | block.data << 12;
|
||||
data = block.getId() | block.getData() << 12;
|
||||
}
|
||||
|
||||
y = realignEntityY(type, y);
|
||||
@ -632,10 +632,10 @@ public class Protocol1_8to1_7_6_10 extends AbstractProtocol<ClientboundPackets1_
|
||||
final int targetX = record.getSectionX() + (chunkX << 4);
|
||||
final int targetY = record.getY(-1);
|
||||
final int targetZ = record.getSectionZ() + (chunkZ << 4);
|
||||
final IdAndData block = IdAndData.fromCompressedData(record.getBlockId());
|
||||
final IdAndData block = IdAndData.fromRawData(record.getBlockId());
|
||||
final Position pos = new Position(targetX, targetY, targetZ);
|
||||
wrapper.user().get(ChunkTracker.class).trackAndRemap(pos, block);
|
||||
record.setBlockId(block.toCompressedData());
|
||||
record.setBlockId(block.toRawData());
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -650,7 +650,7 @@ public class Protocol1_8to1_7_6_10 extends AbstractProtocol<ClientboundPackets1_
|
||||
final Position pos = wrapper.get(Type.POSITION1_8, 0); // position
|
||||
final IdAndData block = new IdAndData(blockId, data);
|
||||
wrapper.user().get(ChunkTracker.class).trackAndRemap(pos, block);
|
||||
wrapper.write(Type.VAR_INT, block.toCompressedData());
|
||||
wrapper.write(Type.VAR_INT, block.toRawData());
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -713,7 +713,7 @@ public class Protocol1_8to1_7_6_10 extends AbstractProtocol<ClientboundPackets1_
|
||||
final Random rnd = new Random();
|
||||
final ChunkTracker chunkTracker = wrapper.user().get(ChunkTracker.class);
|
||||
final IdAndData block = chunkTracker.getBlockNotNull(pos);
|
||||
if (block.id != 0) {
|
||||
if (block.getId() != 0) {
|
||||
double var21 = Math.min(0.2F + (float) data / 15.0F, 10.0F);
|
||||
if (var21 > 2.5D) var21 = 2.5D;
|
||||
final float var25 = randomFloatClamp(rnd, 0.0F, ((float) Math.PI * 2F));
|
||||
@ -734,7 +734,7 @@ public class Protocol1_8to1_7_6_10 extends AbstractProtocol<ClientboundPackets1_
|
||||
wrapper.write(Type.FLOAT, offsetZ);
|
||||
wrapper.write(Type.FLOAT, 0.15000000596046448F); // particleSpeed
|
||||
wrapper.write(Type.INT, amount);
|
||||
wrapper.write(Type.VAR_INT, block.id | (block.data << 12));
|
||||
wrapper.write(Type.VAR_INT, block.getId() | (block.getData() << 12));
|
||||
} else {
|
||||
wrapper.cancel();
|
||||
}
|
||||
@ -749,7 +749,7 @@ public class Protocol1_8to1_7_6_10 extends AbstractProtocol<ClientboundPackets1_
|
||||
final int blockData = data >> 12 & 255;
|
||||
final IdAndData block = new IdAndData(blockID, blockData);
|
||||
chunkTracker.remapBlockParticle(block);
|
||||
data = block.id | (block.data << 12);
|
||||
data = block.getId() | (block.getData() << 12);
|
||||
}
|
||||
|
||||
wrapper.write(Type.INT, effectId);
|
||||
@ -790,7 +790,7 @@ public class Protocol1_8to1_7_6_10 extends AbstractProtocol<ClientboundPackets1_
|
||||
final int metadata = Integer.parseInt(parts[2]);
|
||||
final IdAndData block = new IdAndData(id, metadata);
|
||||
wrapper.user().get(ChunkTracker.class).remapBlockParticle(block);
|
||||
wrapper.write(Type.VAR_INT, block.id | block.data << 12); // particle data
|
||||
wrapper.write(Type.VAR_INT, block.getId() | block.getData() << 12); // particle data
|
||||
} else if (particle.extra > 0)
|
||||
throw new IllegalStateException("Tried to write particle which requires extra data, but no handler was found");
|
||||
});
|
||||
|
@ -21,8 +21,8 @@ import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_10;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import net.raphimc.vialegacy.ViaLegacy;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.Protocol1_8to1_7_6_10;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.storage.ChunkTracker;
|
||||
|
||||
@ -72,7 +72,7 @@ public class MetadataRewriter {
|
||||
final byte data = blockDataMeta != null ? (Byte) blockDataMeta.getValue() : 0;
|
||||
final IdAndData block = new IdAndData(id, data);
|
||||
user.get(ChunkTracker.class).remapBlockParticle(block);
|
||||
entry.setValue((short) (block.id | (block.data << 12)));
|
||||
entry.setValue((short) (block.getId() | (block.getData() << 12)));
|
||||
continue;
|
||||
} else if (metaIndex == MetaIndex1_8to1_7_6.HUMAN_SKIN_FLAGS) {
|
||||
byte flags = (byte) value;
|
||||
|
@ -18,8 +18,8 @@
|
||||
package net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.storage;
|
||||
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.DataPalette;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import net.raphimc.vialegacy.api.data.BlockList1_6;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
import net.raphimc.vialegacy.api.remapper.AbstractChunkTracker;
|
||||
|
||||
public class ChunkTracker extends AbstractChunkTracker {
|
||||
@ -43,11 +43,11 @@ public class ChunkTracker extends AbstractChunkTracker {
|
||||
|
||||
@Override
|
||||
protected void remapBlock(IdAndData block, int x, int y, int z) {
|
||||
if (block.id == BlockList1_6.portal.blockID && block.data == 0) {
|
||||
if (this.getBlockNotNull(x - 1, y, z).id == BlockList1_6.obsidian.blockID || this.getBlockNotNull(x + 1, y, z).id == BlockList1_6.obsidian.blockID) {
|
||||
block.data = 1;
|
||||
if (block.getId() == BlockList1_6.portal.blockID && block.getData() == 0) {
|
||||
if (this.getBlockNotNull(x - 1, y, z).getId() == BlockList1_6.obsidian.blockID || this.getBlockNotNull(x + 1, y, z).getId() == BlockList1_6.obsidian.blockID) {
|
||||
block.setData(1);
|
||||
} else {
|
||||
block.data = 2;
|
||||
block.setData(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,9 +19,9 @@ package net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types;
|
||||
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.*;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import com.viaversion.viaversion.util.Pair;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.raphimc.vialegacy.api.model.IdAndData;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.chunks.ExtendedBlockStorage;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@ -188,7 +188,7 @@ public class ChunkType1_7_6 extends Type<Chunk> {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
for (int y = 0; y < 16; y++) {
|
||||
section.palette(PaletteType.BLOCKS).setIdAt(x, y, z, IdAndData.toCompressedData(storage.getBlockId(x, y, z), storage.getBlockMetadata(x, y, z)));
|
||||
section.palette(PaletteType.BLOCKS).setIdAt(x, y, z, IdAndData.toRawData(storage.getBlockId(x, y, z), storage.getBlockMetadata(x, y, z)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user