-
-
Notifications
You must be signed in to change notification settings - Fork 348
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Update all forge event code, attempt to become loader unaware (…
- Loading branch information
Showing
44 changed files
with
542 additions
and
688 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...lony/buildings/AbstractBuildingEvent.java → ...uildings/event/AbstractBuildingEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/main/java/com/minecolonies/api/colony/buildings/event/BuildingConstructionEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.minecolonies.api.colony.buildings.event; | ||
|
||
import com.minecolonies.api.colony.buildings.IBuilding; | ||
import com.minecolonies.api.colony.workorders.WorkOrderType; | ||
|
||
/** | ||
* Event for when a building was built/repaired/removed. | ||
*/ | ||
public final class BuildingConstructionEvent extends AbstractBuildingEvent | ||
{ | ||
/** | ||
* What happened to the building. | ||
*/ | ||
private final EventType eventType; | ||
|
||
/** | ||
* Building construction event. | ||
* | ||
* @param building the building the event was for. | ||
* @param eventType what happened to the building. | ||
*/ | ||
public BuildingConstructionEvent(final IBuilding building, final EventType eventType) | ||
{ | ||
super(building); | ||
this.eventType = eventType; | ||
} | ||
|
||
/** | ||
* Get what happened to the building. | ||
* | ||
* @return the event type. | ||
*/ | ||
public EventType getEventType() | ||
{ | ||
return eventType; | ||
} | ||
|
||
/** | ||
* What happened to the building. | ||
*/ | ||
public enum EventType | ||
{ | ||
BUILT, | ||
UPGRADED, | ||
REPAIRED, | ||
REMOVED; | ||
|
||
/** | ||
* Obtain the construction event type from the work order type. | ||
* | ||
* @param workOrderType the work order type. | ||
* @return the construction event type. | ||
*/ | ||
public static EventType fromWorkOrderType(final WorkOrderType workOrderType) | ||
{ | ||
return switch (workOrderType) | ||
{ | ||
case BUILD -> BUILT; | ||
case UPGRADE -> UPGRADED; | ||
case REPAIR -> REPAIRED; | ||
case REMOVE -> REMOVED; | ||
}; | ||
} | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...colony/citizens/AbstractCitizenEvent.java → .../citizens/event/AbstractCitizenEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
...nts/colony/citizens/CitizenDiedEvent.java → ...y/citizens/event/CitizenRemovedEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 37 additions & 36 deletions
73
...us/events/colony/AbstractColonyEvent.java → ...api/colony/event/AbstractColonyEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,37 @@ | ||
package com.minecolonies.api.eventbus.events.colony; | ||
|
||
import com.minecolonies.api.colony.IColony; | ||
import com.minecolonies.api.eventbus.events.AbstractEvent; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* Any colony related event, provides the target colony the event occurred in. | ||
*/ | ||
public abstract class AbstractColonyEvent extends AbstractEvent | ||
{ | ||
/** | ||
* The colony this event was called in. | ||
*/ | ||
@NotNull | ||
private final IColony colony; | ||
|
||
/** | ||
* Constructs a colony-based event. | ||
* | ||
* @param colony The colony related to the event. | ||
*/ | ||
protected AbstractColonyEvent(@NotNull final IColony colony) | ||
{ | ||
this.colony = colony; | ||
} | ||
|
||
/** | ||
* Gets the colony related to the event. | ||
*/ | ||
@NotNull | ||
public IColony getColony() | ||
{ | ||
return colony; | ||
} | ||
} | ||
package com.minecolonies.api.colony.event; | ||
|
||
import com.minecolonies.api.colony.IColony; | ||
import net.minecraftforge.eventbus.api.Event; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* This is a colony-related event in the Forge sense, not in the | ||
* {@link com.minecolonies.api.colony.colonyEvents.IColonyEvent} sense. | ||
*/ | ||
public abstract class AbstractColonyEvent extends Event | ||
{ | ||
/** | ||
* The colony this event was called in. | ||
*/ | ||
@NotNull | ||
private final IColony colony; | ||
|
||
/** | ||
* Constructs a colony-based event. | ||
* | ||
* @param colony The colony related to the event. | ||
*/ | ||
protected AbstractColonyEvent(@NotNull final IColony colony) | ||
{ | ||
this.colony = colony; | ||
} | ||
|
||
/** | ||
* Gets the colony related to the event. | ||
*/ | ||
@NotNull | ||
public IColony getColony() | ||
{ | ||
return colony; | ||
} | ||
} |
70 changes: 35 additions & 35 deletions
70
...vents/colony/ClientChunkUpdatedEvent.java → ...colony/event/ClientChunkUpdatedEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
package com.minecolonies.api.eventbus.events.colony; | ||
|
||
import net.minecraft.world.level.chunk.LevelChunk; | ||
import net.minecraftforge.eventbus.api.Event; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* This event is fired client-side after the colony chunk capabilities are synched to the player; | ||
* i.e. there might be an update to which colony claims a particular chunk. This is fired even if | ||
* no colony owns the chunk in question, as that may also be interesting; and even if the data did | ||
* not actually change, as it might still be new to the listener. | ||
*/ | ||
public final class ClientChunkUpdatedEvent extends Event | ||
{ | ||
private final LevelChunk chunk; | ||
|
||
/** | ||
* Constructs a chunk update event. | ||
* | ||
* @param chunk The chunk that was updated. | ||
*/ | ||
public ClientChunkUpdatedEvent(@NotNull final LevelChunk chunk) | ||
{ | ||
this.chunk = chunk; | ||
} | ||
|
||
/** | ||
* Gets the chunk related to the event. | ||
*/ | ||
@NotNull | ||
public LevelChunk getChunk() | ||
{ | ||
return this.chunk; | ||
} | ||
} | ||
package com.minecolonies.api.colony.event; | ||
|
||
import net.minecraft.world.level.chunk.LevelChunk; | ||
import net.minecraftforge.eventbus.api.Event; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* This event is fired client-side after the colony chunk capabilities are synched to the player; | ||
* i.e. there might be an update to which colony claims a particular chunk. This is fired even if | ||
* no colony owns the chunk in question, as that may also be interesting; and even if the data did | ||
* not actually change, as it might still be new to the listener. | ||
*/ | ||
public class ClientChunkUpdatedEvent extends Event | ||
{ | ||
private final LevelChunk chunk; | ||
|
||
/** | ||
* Constructs a chunk update event. | ||
* | ||
* @param chunk The chunk that was updated. | ||
*/ | ||
public ClientChunkUpdatedEvent(@NotNull final LevelChunk chunk) | ||
{ | ||
this.chunk = chunk; | ||
} | ||
|
||
/** | ||
* Gets the chunk related to the event. | ||
*/ | ||
@NotNull | ||
public LevelChunk getChunk() | ||
{ | ||
return this.chunk; | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...bus/events/colony/ColonyCreatedEvent.java → .../api/colony/event/ColonyCreatedEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...bus/events/colony/ColonyDeletedEvent.java → .../api/colony/event/ColonyDeletedEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.