Skip to content

Commit

Permalink
Remove metadata between 1.16.100 and 1.16.40 that made boats invisible
Browse files Browse the repository at this point in the history
  • Loading branch information
bundabrg committed Feb 6, 2021
1 parent 14f1a26 commit 4095f91
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
import au.com.grieve.reversion.editions.bedrock.mappers.EntityMapper;
import au.com.grieve.reversion.editions.bedrock.mappers.ItemMapper;
import au.com.grieve.reversion.protocol.bedrock.v408.Bedrock_v408;
import au.com.grieve.reversion.translators.v408be_to_v419be.handlers.AddEntityHandler_v408be_to_v419be;
import au.com.grieve.reversion.translators.v408be_to_v419be.handlers.BlockEntityData_v408be_to_v419be;
import au.com.grieve.reversion.translators.v408be_to_v419be.handlers.SetEntityDataHandler_v408be_to_v419be;
import au.com.grieve.reversion.translators.v408be_to_v419be.handlers.StartGameHandler_v408be_to_v419be;
import com.nukkitx.protocol.bedrock.packet.*;

Expand Down Expand Up @@ -66,7 +68,7 @@ public class Register_v408be_to_v419be {
.build()
)
.entityMapper(EntityMapper.DEFAULT)
.registerPacketHandler(AddEntityPacket.class, AddEntityHandler_Bedrock.class)
.registerPacketHandler(AddEntityPacket.class, AddEntityHandler_v408be_to_v419be.class)
.registerPacketHandler(AddItemEntityPacket.class, AddItemEntityHandler_Bedrock.class)
.registerPacketHandler(AddPlayerPacket.class, AddPlayerHandler_Bedrock.class)
.registerPacketHandler(BlockEntityDataPacket.class, BlockEntityData_v408be_to_v419be.class)
Expand All @@ -79,7 +81,7 @@ public class Register_v408be_to_v419be {
.registerPacketHandler(LoginPacket.class, LoginHandler_Bedrock.class)
.registerPacketHandler(MobArmorEquipmentPacket.class, MobArmorEquipmentHandler_Bedrock.class)
.registerPacketHandler(MobEquipmentPacket.class, MobEquipmentHandler_Bedrock.class)
.registerPacketHandler(SetEntityDataPacket.class, SetEntityDataHandler_Bedrock.class)
.registerPacketHandler(SetEntityDataPacket.class, SetEntityDataHandler_v408be_to_v419be.class)
.registerPacketHandler(StartGamePacket.class, StartGameHandler_v408be_to_v419be.class)
.registerPacketHandler(UpdateBlockPacket.class, UpdateBlockHandler_Bedrock.class)
.build();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* MIT License
*
* Copyright (c) 2021 Reversion Developers
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package au.com.grieve.reversion.translators.v408be_to_v419be.handlers;

import au.com.grieve.reversion.editions.bedrock.BedrockTranslator;
import au.com.grieve.reversion.editions.bedrock.handlers.AddEntityHandler_Bedrock;
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.packet.AddEntityPacket;

public class AddEntityHandler_v408be_to_v419be extends AddEntityHandler_Bedrock {

public AddEntityHandler_v408be_to_v419be(BedrockTranslator translator) {
super(translator);
}

@Override
public boolean fromDownstream(AddEntityPacket packet) {
super.fromDownstream(packet);

// Remove Some Metadata that makes boats invisible
packet.getMetadata().remove(EntityData.IS_BUOYANT);
packet.getMetadata().remove(EntityData.BUOYANCY_DATA);

return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* MIT License
*
* Copyright (c) 2021 Reversion Developers
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package au.com.grieve.reversion.translators.v408be_to_v419be.handlers;

import au.com.grieve.reversion.editions.bedrock.BedrockTranslator;
import au.com.grieve.reversion.editions.bedrock.handlers.SetEntityDataHandler_Bedrock;
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket;

public class SetEntityDataHandler_v408be_to_v419be extends SetEntityDataHandler_Bedrock {

public SetEntityDataHandler_v408be_to_v419be(BedrockTranslator translator) {
super(translator);
}

@Override
public boolean fromDownstream(SetEntityDataPacket packet) {
super.fromDownstream(packet);

// Remove Some Metadata that makes boats invisible
packet.getMetadata().remove(EntityData.IS_BUOYANT);
packet.getMetadata().remove(EntityData.BUOYANCY_DATA);

return false;
}
}

0 comments on commit 4095f91

Please sign in to comment.