Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Raycoms committed Aug 19, 2024
1 parent f85b462 commit 8d6e6ff
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public WindowReactivateBuilding(@NotNull final BlockPos pos)

if (Minecraft.getInstance().level.getBlockEntity(pos) instanceof TileEntityColonyBuilding tileEntityColonyBuilding)
{
final BuildingEntry buildingEntry = IBuildingRegistry.getInstance().get(tileEntityColonyBuilding.registryName);
final BuildingEntry buildingEntry = IBuildingRegistry.getInstance().get(tileEntityColonyBuilding.getBuildingName());
if (buildingEntry == ModBuildings.home.get() || buildingEntry == ModBuildings.tavern.get())
{
findPaneOfTypeByID("text", Text.class).setText(Component.translatable("com.minecolonies.core.gui.reactivate.message.living", Component.translatable(buildingEntry.getTranslationKey())));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ protected void onExecute(final IPayloadContext ctxIn, final ServerPlayer player)

if ((colony == null && state.getBlock() == ModBlocks.blockHutTownHall) || (colony != null && colony.getPermissions().hasPermission(player, Action.MANAGE_HUTS)))
{
final ModDataComponents.ColonyId colonyId = ColonyId.readFromItemStack(stack);
if (colony != null && colonyId != null && colony.getID() != colonyId.id())
final ModDataComponents.ColonyId colonyComponent = stack.get(ModDataComponents.COLONY_ID_COMPONENT);
if (colony != null && colonyComponent != null && colony.getID() != colonyComponent.id())
{
MessageUtils.format(WRONG_COLONY, colonyId.id()).sendTo(player);
MessageUtils.format(WRONG_COLONY, colonyComponent.id()).sendTo(player);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public void handle(

final ItemStack inventoryStack = slot == -1 ? stack : player.getInventory().getItem(slot);

final ModDataComponents.ColonyId colonyComponent = ColonyId.readFromItemStack(stack);
final ModDataComponents.ColonyId colonyComponent = stack.get(ModDataComponents.COLONY_ID_COMPONENT);
if (colonyComponent != null && tempColony != null && tempColony.getID() != colonyComponent.id())
{
MessageUtils.format(WRONG_COLONY, colonyComponent.id()).sendTo(player);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ public ResourceLocation getBuildingName()
{
if (registryName != null && !registryName.getPath().isEmpty())
{
return registryName;
return new ResourceLocation(registryName.getNamespace(), registryName.getPath().replace("home", "residence"));
}
return getBlockState().getBlock() instanceof AbstractBlockHut<?> ? ((AbstractBlockHut<?>) getBlockState().getBlock()).getBuildingEntry().getRegistryName() : null;
}
Expand Down

0 comments on commit 8d6e6ff

Please sign in to comment.