net.minecraft.entity.data.TrackedDataHandlerRegistry Java Examples
The following examples show how to use
net.minecraft.entity.data.TrackedDataHandlerRegistry.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractProtocol.java From multiconnect with MIT License | 5 votes |
protected static void removeTrackedDataHandler(TrackedDataHandler<?> handler) { Int2ObjectBiMap<TrackedDataHandler<?>> biMap = TrackedDataHandlerRegistryAccessor.getHandlers(); //noinspection unchecked IInt2ObjectBiMap<TrackedDataHandler<?>> iBiMap = (IInt2ObjectBiMap<TrackedDataHandler<?>>) biMap; int id = TrackedDataHandlerRegistry.getId(handler); iBiMap.multiconnect_remove(handler); for (; TrackedDataHandlerRegistry.get(id + 1) != null; id++) { TrackedDataHandler<?> h = TrackedDataHandlerRegistry.get(id + 1); iBiMap.multiconnect_remove(h); biMap.put(h, id); } }
Example #2
Source File: Protocol_1_12_2.java From multiconnect with MIT License | 5 votes |
@SuppressWarnings("unchecked") @Override public <T> T readTrackedData(TrackedDataHandler<T> handler, PacketByteBuf buf) { if (handler == TrackedDataHandlerRegistry.OPTIONAL_BLOCK_STATE) { int stateId = buf.readVarInt(); if (stateId == 0) return (T) Optional.empty(); return (T) Optional.ofNullable(Block.STATE_IDS.get(Blocks_1_12_2.convertToStateRegistryId(stateId))); } return super.readTrackedData(handler, buf); }
Example #3
Source File: Protocol_1_12_2.java From multiconnect with MIT License | 4 votes |
@Override protected void removeTrackedDataHandlers() { super.removeTrackedDataHandlers(); removeTrackedDataHandler(TrackedDataHandlerRegistry.OPTIONAL_TEXT_COMPONENT); }