53 lines
2.3 KiB
Java
53 lines
2.3 KiB
Java
/*
|
|
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
|
* Copyright (C) 2016-2024 ViaVersion 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 com.viaversion.viaversion.protocols.protocol1_13_1to1_13.metadata;
|
|
|
|
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
|
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_13;
|
|
import com.viaversion.viaversion.api.type.types.version.Types1_13;
|
|
import com.viaversion.viaversion.protocols.protocol1_13_1to1_13.Protocol1_13_1To1_13;
|
|
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
|
import com.viaversion.viaversion.rewriter.EntityRewriter;
|
|
|
|
public class MetadataRewriter1_13_1To1_13 extends EntityRewriter<ClientboundPackets1_13, Protocol1_13_1To1_13> {
|
|
|
|
public MetadataRewriter1_13_1To1_13(Protocol1_13_1To1_13 protocol) {
|
|
super(protocol);
|
|
}
|
|
|
|
@Override
|
|
protected void registerRewrites() {
|
|
registerMetaTypeHandler(Types1_13.META_TYPES.itemType, Types1_13.META_TYPES.blockStateType, null, Types1_13.META_TYPES.particleType);
|
|
filter().type(EntityTypes1_13.EntityType.MINECART_ABSTRACT).index(9).handler((event, meta) -> {
|
|
int data = meta.value();
|
|
meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
|
|
});
|
|
filter().type(EntityTypes1_13.EntityType.ABSTRACT_ARROW).addIndex(7); // Shooter UUID
|
|
}
|
|
|
|
@Override
|
|
public EntityType typeFromId(int type) {
|
|
return EntityTypes1_13.getTypeFromId(type, false);
|
|
}
|
|
|
|
@Override
|
|
public EntityType objectTypeFromId(int type) {
|
|
return EntityTypes1_13.getTypeFromId(type, true);
|
|
}
|
|
}
|