mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-12-22 06:24:59 +01:00
Finish mappings - let it build
This commit is contained in:
parent
ee5c0e6853
commit
ed3008f245
7 changed files with 63 additions and 38 deletions
|
@ -71,10 +71,6 @@ dependencies {
|
|||
api(libs.events)
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
tasks.processResources {
|
||||
// This is solely for backwards compatibility for other programs that used this file before the switch to gradle.
|
||||
// It used to be generated by the maven Git-Commit-Id-Plugin
|
||||
|
|
|
@ -335,7 +335,7 @@ public class PlayerEntity extends LivingEntity implements GeyserPlayerEntity {
|
|||
parrot.updateBedrockMetadata();
|
||||
SetEntityLinkPacket linkPacket = new SetEntityLinkPacket();
|
||||
EntityLinkData.Type type = isLeft ? EntityLinkData.Type.RIDER : EntityLinkData.Type.PASSENGER;
|
||||
linkPacket.setEntityLink(new EntityLinkData(geyserId, parrot.getGeyserId(), type, false, false));
|
||||
linkPacket.setEntityLink(new EntityLinkData(geyserId, parrot.getGeyserId(), type, false, false, 0f));
|
||||
// Delay, or else spawned-in players won't get the link
|
||||
// TODO: Find a better solution.
|
||||
session.scheduleInEventLoop(() -> session.sendUpstreamPacket(linkPacket), 500, TimeUnit.MILLISECONDS);
|
||||
|
|
|
@ -64,11 +64,13 @@ public class Item {
|
|||
protected final Key javaIdentifier;
|
||||
private int javaId = -1;
|
||||
private final int attackDamage;
|
||||
private final DataComponents baseComponents; // unmodifiable
|
||||
private DataComponents baseComponents; // unmodifiable
|
||||
|
||||
public Item(String javaIdentifier, Builder builder) {
|
||||
this.javaIdentifier = MinecraftKey.key(javaIdentifier);
|
||||
this.baseComponents = builder.components == null ? Registries.DEFAULT_DATA_COMPONENTS.get(javaId) : builder.components;
|
||||
if (builder.components != null) {
|
||||
this.baseComponents = builder.components;
|
||||
}
|
||||
this.attackDamage = builder.attackDamage;
|
||||
}
|
||||
|
||||
|
@ -272,6 +274,9 @@ public class Item {
|
|||
throw new RuntimeException("Item ID has already been set!");
|
||||
}
|
||||
this.javaId = javaId;
|
||||
if (this.baseComponents == null) {
|
||||
this.baseComponents = Registries.DEFAULT_DATA_COMPONENTS.get(javaId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,19 +25,20 @@
|
|||
|
||||
package org.geysermc.geyser.registry.populator;
|
||||
|
||||
import io.jsonwebtoken.lang.Collections;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.level.block.Blocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class Conversion766_748 {
|
||||
static List<String> newBlockIds = new ArrayList<>();
|
||||
static List<String> bedrockIds = new ArrayList<>(); // TODO temp remove
|
||||
static List<String> PALE_WOODEN_BLOCKS = new ArrayList<>();
|
||||
static List<String> OTHER_NEW_BLOCKS = new ArrayList<>();
|
||||
|
||||
static {
|
||||
var blocks = Collections.of(
|
||||
Set.of(
|
||||
Blocks.PALE_OAK_WOOD,
|
||||
Blocks.PALE_OAK_PLANKS,
|
||||
Blocks.PALE_OAK_SAPLING,
|
||||
|
@ -45,27 +46,29 @@ public class Conversion766_748 {
|
|||
Blocks.STRIPPED_PALE_OAK_LOG,
|
||||
Blocks.STRIPPED_PALE_OAK_WOOD,
|
||||
Blocks.PALE_OAK_LEAVES,
|
||||
Blocks.PALE_OAK_SIGN,
|
||||
Blocks.PALE_OAK_WALL_SIGN,
|
||||
Blocks.PALE_OAK_HANGING_SIGN,
|
||||
Blocks.PALE_OAK_WALL_HANGING_SIGN,
|
||||
Blocks.PALE_OAK_PRESSURE_PLATE,
|
||||
Blocks.PALE_OAK_TRAPDOOR,
|
||||
Blocks.POTTED_PALE_OAK_SAPLING,
|
||||
Blocks.PALE_OAK_BUTTON,
|
||||
Blocks.PALE_OAK_STAIRS,
|
||||
Blocks.PALE_OAK_SLAB,
|
||||
Blocks.PALE_OAK_FENCE_GATE,
|
||||
Blocks.PALE_OAK_FENCE,
|
||||
Blocks.PALE_OAK_DOOR,
|
||||
Blocks.PALE_OAK_DOOR
|
||||
).forEach(block -> PALE_WOODEN_BLOCKS.add(block.javaIdentifier().value()));
|
||||
|
||||
// Some things are of course stupid
|
||||
PALE_WOODEN_BLOCKS.add("pale_oak_standing_sign");
|
||||
PALE_WOODEN_BLOCKS.add("pale_oak_wall_sign");
|
||||
PALE_WOODEN_BLOCKS.add("pale_oak_double_slab");
|
||||
|
||||
Set.of(
|
||||
Blocks.PALE_MOSS_BLOCK,
|
||||
Blocks.PALE_MOSS_CARPET,
|
||||
Blocks.PALE_HANGING_MOSS,
|
||||
|
||||
Blocks.OPEN_EYEBLOSSOM,
|
||||
Blocks.CLOSED_EYEBLOSSOM,
|
||||
Blocks.POTTED_OPEN_EYEBLOSSOM,
|
||||
Blocks.POTTED_CLOSED_EYEBLOSSOM,
|
||||
|
||||
Blocks.RESIN_CLUMP,
|
||||
Blocks.RESIN_BLOCK,
|
||||
|
@ -76,29 +79,50 @@ public class Conversion766_748 {
|
|||
Blocks.CHISELED_RESIN_BRICKS,
|
||||
|
||||
Blocks.CREAKING_HEART
|
||||
);
|
||||
).forEach(block -> OTHER_NEW_BLOCKS.add(block.javaIdentifier().value()));
|
||||
|
||||
blocks.forEach(block -> newBlockIds.add(block.javaIdentifier().value()));
|
||||
OTHER_NEW_BLOCKS.add("resin_brick_double_slab");
|
||||
}
|
||||
|
||||
static NbtMap remapBlock(NbtMap tag) {
|
||||
|
||||
GeyserImpl.getInstance().getLogger().info(tag.toString());
|
||||
|
||||
String name = tag.getString("name");
|
||||
if (newBlockIds.contains(name)) {
|
||||
bedrockIds.add(name);
|
||||
// TODO
|
||||
return tag.toBuilder()
|
||||
.putCompound("states", NbtMap.builder().build())
|
||||
.putString("name", "minecraft:unknown")
|
||||
.build();
|
||||
String name = tag.getString("name").replace("minecraft:", "");
|
||||
if (PALE_WOODEN_BLOCKS.contains(name)) {
|
||||
return withName(tag, name.replace("pale_oak", "birch"));
|
||||
}
|
||||
|
||||
if (name.contains("resin") || name.contains("creaking") || name.contains("pale")) {
|
||||
throw new RuntimeException("ya missed " + name);
|
||||
if (OTHER_NEW_BLOCKS.contains(name)) {
|
||||
return switch (name) {
|
||||
case "resin_brick_double_slab" -> withName(tag,"red_sandstone_double_slab");
|
||||
case "pale_moss_block" -> withName(tag, "moss_block");
|
||||
case "pale_moss_carpet" -> withoutStates("moss_carpet");
|
||||
case "pale_hanging_moss" -> withoutStates("hanging_roots");
|
||||
case "open_eyeblossom" -> withoutStates("oxeye_daisy");
|
||||
case "closed_eyeblossom" -> withoutStates("white_tulip");
|
||||
case "resin_clump" -> withoutStates("unknown");
|
||||
case "resin_block" -> withoutStates("red_sandstone");
|
||||
case "resin_bricks" -> withoutStates("cut_red_sandstone");
|
||||
case "resin_brick_stairs" -> withName(tag, "red_sandstone_stairs");
|
||||
case "resin_brick_slab" -> withName(tag, "red_sandstone_slab");
|
||||
case "resin_brick_wall" -> withName(tag, "red_sandstone_wall");
|
||||
case "chiseled_resin_bricks" -> withName(tag, "chiseled_red_sandstone");
|
||||
case "creaking_heart" -> withoutStates("chiseled_polished_blackstone");
|
||||
default -> throw new IllegalStateException("missing replacement for new block! " + name);
|
||||
};
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
static NbtMap withName(NbtMap tag, String name) {
|
||||
NbtMapBuilder builder = tag.toBuilder();
|
||||
builder.replace("name", "minecraft:" + name);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
static NbtMap withoutStates(String name) {
|
||||
NbtMapBuilder tagBuilder = NbtMap.builder();
|
||||
tagBuilder.putString("name", "minecraft:" + name);
|
||||
tagBuilder.putCompound("states", NbtMap.builder().build());
|
||||
return tagBuilder.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator {
|
|||
|
||||
SetEntityLinkPacket linkPacket = new SetEntityLinkPacket();
|
||||
EntityLinkData.Type type = EntityLinkData.Type.PASSENGER;
|
||||
linkPacket.setEntityLink(new EntityLinkData(session.getPlayerEntity().getGeyserId(), geyserId, type, true, false));
|
||||
linkPacket.setEntityLink(new EntityLinkData(session.getPlayerEntity().getGeyserId(), geyserId, type, true, false, 0f));
|
||||
session.sendUpstreamPacket(linkPacket);
|
||||
|
||||
merchantInventory.setVillager(villager);
|
||||
|
|
|
@ -91,7 +91,7 @@ public class BedrockInteractTranslator extends PacketTranslator<InteractPacket>
|
|||
// If the server doesn't agree with our dismount (sends a packet saying we dismounted),
|
||||
// then remount the player.
|
||||
SetEntityLinkPacket linkPacket = new SetEntityLinkPacket();
|
||||
linkPacket.setEntityLink(new EntityLinkData(vehicleBedrockId, session.getPlayerEntity().getGeyserId(), EntityLinkData.Type.PASSENGER, true, false));
|
||||
linkPacket.setEntityLink(new EntityLinkData(vehicleBedrockId, session.getPlayerEntity().getGeyserId(), EntityLinkData.Type.PASSENGER, true, false, 0f));
|
||||
session.sendUpstreamPacket(linkPacket);
|
||||
}
|
||||
}, 1, TimeUnit.SECONDS));
|
||||
|
|
|
@ -70,7 +70,7 @@ public class JavaSetPassengersTranslator extends PacketTranslator<ClientboundSet
|
|||
boolean rider = packet.getPassengerIds()[0] == passengerId;
|
||||
EntityLinkData.Type type = rider ? EntityLinkData.Type.RIDER : EntityLinkData.Type.PASSENGER;
|
||||
SetEntityLinkPacket linkPacket = new SetEntityLinkPacket();
|
||||
linkPacket.setEntityLink(new EntityLinkData(entity.getGeyserId(), passenger.getGeyserId(), type, false, false));
|
||||
linkPacket.setEntityLink(new EntityLinkData(entity.getGeyserId(), passenger.getGeyserId(), type, false, false, 0f));
|
||||
session.sendUpstreamPacket(linkPacket);
|
||||
newPassengers.add(passenger);
|
||||
|
||||
|
@ -88,7 +88,7 @@ public class JavaSetPassengersTranslator extends PacketTranslator<ClientboundSet
|
|||
}
|
||||
if (!newPassengers.contains(passenger)) {
|
||||
SetEntityLinkPacket linkPacket = new SetEntityLinkPacket();
|
||||
linkPacket.setEntityLink(new EntityLinkData(entity.getGeyserId(), passenger.getGeyserId(), EntityLinkData.Type.REMOVE, false, false));
|
||||
linkPacket.setEntityLink(new EntityLinkData(entity.getGeyserId(), passenger.getGeyserId(), EntityLinkData.Type.REMOVE, false, false, 0f));
|
||||
session.sendUpstreamPacket(linkPacket);
|
||||
|
||||
passenger.setVehicle(null);
|
||||
|
|
Loading…
Reference in a new issue