Skip to content

Commit

Permalink
Fix compile issue and diseases parsing as air (#10551)
Browse files Browse the repository at this point in the history
Fix compile error
Fix disease cure items being parsed as air
  • Loading branch information
Thodor12 authored Dec 23, 2024
1 parent 02f2464 commit 5756219
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.minecolonies.core.entity.citizen;

import com.minecolonies.api.IMinecoloniesAPI;
import com.minecolonies.api.blocks.AbstractBlockHut;
import com.minecolonies.api.colony.*;
import com.minecolonies.api.colony.buildings.IGuardBuilding;
import com.minecolonies.api.colony.buildings.registry.BuildingEntry;
import com.minecolonies.api.colony.citizens.event.CitizenRemovedEvent;
import com.minecolonies.api.colony.jobs.IJob;
import com.minecolonies.api.colony.permissions.Action;
import com.minecolonies.api.colony.permissions.IPermissions;
Expand All @@ -26,6 +26,8 @@
import com.minecolonies.api.entity.citizen.citizenhandlers.*;
import com.minecolonies.api.entity.citizen.happiness.ExpirationBasedHappinessModifier;
import com.minecolonies.api.entity.citizen.happiness.StaticHappinessSupplier;
import com.minecolonies.api.eventbus.events.colony.citizens.CitizenDiedModEvent;
import com.minecolonies.api.eventbus.events.colony.citizens.CitizenRemovedModEvent;
import com.minecolonies.api.inventory.InventoryCitizen;
import com.minecolonies.api.inventory.container.ContainerCitizenInventory;
import com.minecolonies.api.items.ModItems;
Expand Down Expand Up @@ -1587,14 +1589,7 @@ public void die(@NotNull final DamageSource damageSource)
Component.literal(damageSource.getLocalizedDeathMessage(this).getString()).getString().replaceFirst(this.getDisplayName().getString(), "Citizen");
citizenColonyHandler.getColonyOrRegister().getEventDescriptionManager().addEventDescription(new CitizenDiedEvent(blockPosition(), citizenData.getName(), deathCause));

try
{
NeoForge.EVENT_BUS.post(new CitizenRemovedEvent(citizenData, damageSource));
}
catch (final Exception e)
{
Log.getLogger().error("Error during CitizenRemovedEvent", e);
}
IMinecoloniesAPI.getInstance().getEventBus().post(new CitizenDiedModEvent(citizenData, damageSource));
}
super.die(damageSource);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@
import com.ldtteam.common.network.PlayMessageType;
import com.minecolonies.api.colony.IColony;
import com.minecolonies.api.colony.IColonyManager;
import com.minecolonies.api.colony.event.ColonyDeletedEvent;
import com.minecolonies.api.util.Log;
import com.minecolonies.api.util.MessageUtils;
import com.minecolonies.api.util.constant.Constants;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.server.level.ServerPlayer;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.network.handling.IPayloadContext;

import static com.minecolonies.api.util.constant.TranslationConstants.MESSAGE_INFO_COLONY_DESTROY_SUCCESS;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package com.minecolonies.core.network.messages.server.colony;

import com.ldtteam.common.network.PlayMessageType;
import com.minecolonies.api.IMinecoloniesAPI;
import com.minecolonies.api.colony.IColony;
import com.minecolonies.api.colony.buildings.views.IBuildingView;
import com.minecolonies.api.colony.event.ColonyInformationChangedEvent;
import com.minecolonies.api.util.Log;
import com.minecolonies.api.eventbus.events.colony.ColonyTeamColorChangedModEvent;
import com.minecolonies.api.util.constant.Constants;
import com.minecolonies.core.network.messages.server.AbstractColonyServerMessage;
import net.minecraft.ChatFormatting;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.server.level.ServerPlayer;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.network.handling.IPayloadContext;
import org.jetbrains.annotations.NotNull;

Expand Down Expand Up @@ -66,13 +65,6 @@ protected void toBytes(@NotNull final RegistryFriendlyByteBuf buf)
protected void onExecute(final IPayloadContext ctxIn, final ServerPlayer player, final IColony colony)
{
colony.setColonyColor(ChatFormatting.values()[colorOrdinal]);
try
{
NeoForge.EVENT_BUS.post(new ColonyInformationChangedEvent(colony, ColonyInformationChangedEvent.Type.TEAM_COLOR));
}
catch (final Exception e)
{
Log.getLogger().error("Error during ColonyInformationChangedEvent", e);
}
IMinecoloniesAPI.getInstance().getEventBus().post(new ColonyTeamColorChangedModEvent(colony));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"rarity": 100,
"items": [
{
"item": "minecraft:carrot",
"id": "minecraft:carrot",
"count": 1
},
{
"item": "minecraft:potato",
"id": "minecraft:potato",
"count": 1
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
"rarity": 10,
"items": [
{
"item": "minecraft:poppy",
"id": "minecraft:poppy",
"count": 1
},
{
"item": "minecraft:dandelion",
"id": "minecraft:dandelion",
"count": 1
},
{
"item": "minecraft:kelp",
"id": "minecraft:kelp",
"count": 1
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"rarity": 1,
"items": [
{
"item": "minecraft:honey_bottle",
"id": "minecraft:honey_bottle",
"count": 1
},
{
"item": "minecraft:golden_apple",
"id": "minecraft:golden_apple",
"count": 1
}
]
}
}

0 comments on commit 5756219

Please sign in to comment.