Skip to content

Commit

Permalink
feat: Port to 1.21.1
Browse files Browse the repository at this point in the history
  • Loading branch information
shap-po committed Oct 16, 2024
1 parent 798285a commit 7946a02
Show file tree
Hide file tree
Showing 53 changed files with 137 additions and 137 deletions.
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21
yarn_mappings=1.21+build.7
loader_version=0.16.0
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
loader_version=0.16.5

# Mod Properties
mod_version=1.5.1
maven_group=com.github.shap_po.shappoli
archives_base_name=shappoli

# Dependencies
fabric_version=0.100.5+1.21
apoli_version=2.12.0-alpha.11+mc.1.21.x
fabric_version=0.105.0+1.21.1
apoli_version=2.12.0-alpha.12+mc.1.21.x

# Optional Dependencies
origins_version=1.13.0-alpha.8+mc.1.21.x
origins_version=1.13.0-alpha.9+mc.1.21.x
trinkets_version=3.10.0
wildfire_gender_version=3.2.1+1.21
woodwalkers_version=1.21-fabric-5.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public interface SuppressiblePower {

boolean shappoli$hasConditions();

void shappoli$setHasConditions(boolean hasConditions);
void shappoli$setHasConditions(boolean hasConditionTypes);

@SuppressWarnings({"unused"})
@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import net.minecraft.registry.Registry;
import net.minecraft.util.Pair;

public class BiEntityActions {
public class BiEntityActionTypes {
public static void register() {
register(SuppressPowerActionType.getFactory());
register(TeleportActionType.getFactory());
Expand All @@ -19,7 +19,7 @@ public static void register() {
SendActionActionType.getFactory(
Pair::getLeft,
ReceiveActionPowerType::receiveBientityAction,
io.github.apace100.apoli.action.factory.BiEntityActions.ALIASES
io.github.apace100.apoli.action.type.BiEntityActionTypes.ALIASES
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import net.minecraft.world.World;
import org.apache.commons.lang3.tuple.Triple;

public class BlockActions {
public class BlockActionTypes {
public static void register() {
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package com.github.shap_po.shappoli.action.factory;

import com.github.shap_po.shappoli.power.type.ReceiveActionPowerType;
import com.github.shap_po.shappoli.action.type.entity.SelfBientityActionActionType;
import com.github.shap_po.shappoli.action.type.meta.SendActionActionType;
import com.github.shap_po.shappoli.power.type.ReceiveActionPowerType;
import io.github.apace100.apoli.action.factory.ActionTypeFactory;
import io.github.apace100.apoli.registry.ApoliRegistries;
import net.minecraft.entity.Entity;
import net.minecraft.registry.Registry;

public class EntityActions {
public class EntityActionTypes {
public static void register() {
register(SelfBientityActionActionType.getFactory());

register(
SendActionActionType.getFactory(
entity -> entity,
ReceiveActionPowerType::receiveEntityAction,
io.github.apace100.apoli.action.factory.EntityActions.ALIASES
io.github.apace100.apoli.action.type.EntityActionTypes.ALIASES
)
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.shap_po.shappoli.action.factory;

import com.github.shap_po.shappoli.power.type.ReceiveActionPowerType;
import com.github.shap_po.shappoli.action.type.meta.SendActionActionType;
import com.github.shap_po.shappoli.power.type.ReceiveActionPowerType;
import com.github.shap_po.shappoli.util.InventoryUtil;
import io.github.apace100.apoli.action.factory.ActionTypeFactory;
import io.github.apace100.apoli.registry.ApoliRegistries;
Expand All @@ -10,13 +10,13 @@
import net.minecraft.util.Pair;
import net.minecraft.world.World;

public class ItemActions {
public class ItemActionTypes {
public static void register() {
register(
SendActionActionType.getFactory(
worldAndStack -> InventoryUtil.getHolder(worldAndStack.getRight().get()),
ReceiveActionPowerType::receiveItemAction,
io.github.apace100.apoli.action.factory.ItemActions.ALIASES
io.github.apace100.apoli.action.type.ItemActionTypes.ALIASES
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private static <P extends PowerType> boolean suppressPower(

if (!suppressiblePower.shappoli$hasConditions() && !ignoreNoConditionWarning) {
Shappoli.LOGGER.warn(
"Suppressed power \"{}\" of type \"{}\" that does not support conditions. This probably would not work. If you want to ignore this message, set the \"ignore_no_condition_warning\" parameter to \"true\"",
"Suppressed power \"{}\" of type \"{}\" that does not support ConditionTypes. This probably would not work. If you want to ignore this message, set the \"ignore_no_condition_warning\" parameter to \"true\"",
powerType.getPowerId(),
powerType.getPower().getFactoryInstance().getSerializerId()
);
Expand All @@ -130,24 +130,24 @@ public static ActionTypeFactory<Pair<Entity, Entity>> getFactory() {
Shappoli.identifier("suppress_power"),
new SerializableData()
.add("power", ApoliDataTypes.POWER_REFERENCE, null) // power reference, example: my_namespace:my_power
.add("powers", ApoliDataTypes.POWER_REFERENCE.listOf(), null)
.add("powers", ApoliDataTypes.POWER_REFERENCE.list(), null)

.add("power_type", ApoliDataTypes.POWER_TYPE_FACTORY, null) // power type, example: apoli:action_on_hit
.add("power_types", ApoliDataTypes.POWER_TYPE_FACTORY.listOf(), null)
.add("power_types", ApoliDataTypes.POWER_TYPE_FACTORY.list(), null)

.add("power_source", SerializableDataTypes.IDENTIFIER, null) // power source identifier, example: apoli:command
.add("power_sources", SerializableDataTypes.IDENTIFIERS, null)

.add("ignored_power", ApoliDataTypes.POWER_REFERENCE, null) // power reference to ignore
.add("ignored_powers", ApoliDataTypes.POWER_REFERENCE.listOf(), null)
.add("ignored_powers", ApoliDataTypes.POWER_REFERENCE.list(), null)

.add("duration", SerializableDataTypes.POSITIVE_INT)
.add("bientity_action", ApoliDataTypes.BIENTITY_ACTION, null)

.add("ignore_no_condition_warning", SerializableDataTypes.BOOLEAN, false)
.add("ignore_multiple_power_warning", SerializableDataTypes.BOOLEAN, false)

.postProcessor(data -> MiscUtil.checkHasAtLeastOneField(data, "power", "powers", "power_type", "power_types", "power_source", "power_sources"))
.validate(data -> MiscUtil.checkAtLeastOneFieldExists(data, "power", "powers", "power_type", "power_types", "power_source", "power_sources"))
,
(data, actorAndTarget) -> action(
actorAndTarget.getLeft(), actorAndTarget.getRight(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.shap_po.shappoli.action.type.bientity;

import com.github.shap_po.shappoli.Shappoli;
import com.github.shap_po.shappoli.util.MiscUtil;
import io.github.apace100.apoli.action.factory.ActionTypeFactory;
import io.github.apace100.calio.data.SerializableData;
import io.github.apace100.calio.data.SerializableDataTypes;
Expand Down Expand Up @@ -65,11 +66,7 @@ public static ActionTypeFactory<Pair<Entity, Entity>> getFactory() {
.add("teleport_actor", SerializableDataTypes.BOOLEAN, false)
.add("teleport_target", SerializableDataTypes.BOOLEAN, true)
.add("rotate", SerializableDataTypes.BOOLEAN, false)
.postProcessor(data -> {
if (!data.getBoolean("teleport_actor") && !data.getBoolean("teleport_target")) {
throw new IllegalStateException("Any of 'teleport_actor' or 'teleport_target' fields must to true!");
}
})
.validate(MiscUtil::checkAtLeastOneFieldIsTrue)
,
(data, actorAndTarget) -> action(
actorAndTarget.getLeft(), actorAndTarget.getRight(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.github.shap_po.shappoli.Shappoli;
import io.github.apace100.apoli.action.factory.ActionTypeFactory;
import io.github.apace100.apoli.action.factory.EntityActions;
import io.github.apace100.apoli.action.type.EntityActionTypes;
import io.github.apace100.apoli.data.ApoliDataTypes;
import io.github.apace100.calio.data.SerializableData;
import net.minecraft.entity.Entity;
Expand All @@ -25,8 +25,8 @@ public static ActionTypeFactory<Entity> getFactory() {
(data, entity) -> action(entity, data.get("action"))
);

EntityActions.ALIASES.addPathAlias("self_bientity", factory.getSerializerId().getPath());
EntityActions.ALIASES.addPathAlias("bientity_action", factory.getSerializerId().getPath());
EntityActionTypes.ALIASES.addPathAlias("self_bientity", factory.getSerializerId().getPath());
EntityActionTypes.ALIASES.addPathAlias("bientity_action", factory.getSerializerId().getPath());
return factory;
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package com.github.shap_po.shappoli.condition.factory;

import com.github.shap_po.shappoli.power.type.ReceiveConditionPowerType;
import com.github.shap_po.shappoli.condition.type.meta.SendConditionConditionType;
import com.github.shap_po.shappoli.power.type.ReceiveConditionPowerType;
import io.github.apace100.apoli.condition.factory.ConditionTypeFactory;
import io.github.apace100.apoli.registry.ApoliRegistries;
import net.minecraft.entity.Entity;
import net.minecraft.registry.Registry;
import net.minecraft.util.Pair;

public class BiEntityConditions {
public class BiEntityConditionTypes {
public static void register() {
register(SendConditionConditionType.getFactory(
Pair::getLeft,
ReceiveConditionPowerType::receiveBientity,
io.github.apace100.apoli.condition.factory.BiEntityConditions.ALIASES
io.github.apace100.apoli.condition.type.BiEntityConditionTypes.ALIASES
));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package com.github.shap_po.shappoli.condition.factory;

import com.github.shap_po.shappoli.power.type.ReceiveConditionPowerType;
import com.github.shap_po.shappoli.condition.type.meta.SendConditionConditionType;
import com.github.shap_po.shappoli.power.type.ReceiveConditionPowerType;
import io.github.apace100.apoli.condition.factory.ConditionTypeFactory;
import io.github.apace100.apoli.registry.ApoliRegistries;
import net.minecraft.entity.Entity;
import net.minecraft.registry.Registry;

public class EntityConditions {
public class EntityConditionTypes {
public static void register() {
register(SendConditionConditionType.getFactory(
entity -> entity,
ReceiveConditionPowerType::receiveEntity,
io.github.apace100.apoli.condition.factory.EntityConditions.ALIASES
io.github.apace100.apoli.condition.type.EntityConditionTypes.ALIASES
));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.github.shap_po.shappoli.condition.factory;

import com.github.shap_po.shappoli.power.type.ReceiveConditionPowerType;
import com.github.shap_po.shappoli.condition.type.item.BlockConditionType;
import com.github.shap_po.shappoli.condition.type.item.HolderConditionType;
import com.github.shap_po.shappoli.condition.type.meta.SendConditionConditionType;
import com.github.shap_po.shappoli.power.type.ReceiveConditionPowerType;
import com.github.shap_po.shappoli.util.InventoryUtil;
import io.github.apace100.apoli.condition.factory.ConditionTypeFactory;
import io.github.apace100.apoli.registry.ApoliRegistries;
Expand All @@ -12,7 +12,7 @@
import net.minecraft.util.Pair;
import net.minecraft.world.World;

public class ItemConditions {
public class ItemConditionTypes {
public static void register() {
register(BlockConditionType.getFactory());
register(HolderConditionType.getFactory());
Expand All @@ -21,7 +21,7 @@ public static void register() {
SendConditionConditionType.getFactory(
worldAndStack -> InventoryUtil.getHolder(worldAndStack.getRight()),
ReceiveConditionPowerType::receiveItem,
io.github.apace100.apoli.condition.factory.ItemConditions.ALIASES
io.github.apace100.apoli.condition.type.ItemConditionTypes.ALIASES
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.github.shap_po.shappoli.Shappoli;
import io.github.apace100.apoli.condition.factory.ConditionTypeFactory;
import io.github.apace100.apoli.condition.factory.ItemConditions;
import io.github.apace100.apoli.condition.type.ItemConditionTypes;
import io.github.apace100.calio.data.SerializableData;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
Expand All @@ -21,7 +21,7 @@ public static ConditionTypeFactory<Pair<World, ItemStack>> getFactory() {
(data, worldAndStack) -> condition(worldAndStack.getRight())
);

ItemConditions.ALIASES.addPathAlias("block", factory.getSerializerId().getPath());
ItemConditionTypes.ALIASES.addPathAlias("block", factory.getSerializerId().getPath());
return factory;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.github.shap_po.shappoli.Shappoli;
import com.github.shap_po.shappoli.util.InventoryUtil;
import io.github.apace100.apoli.condition.factory.ConditionTypeFactory;
import io.github.apace100.apoli.condition.factory.ItemConditions;
import io.github.apace100.apoli.condition.type.ItemConditionTypes;
import io.github.apace100.apoli.data.ApoliDataTypes;
import io.github.apace100.calio.data.SerializableData;
import net.minecraft.entity.Entity;
Expand All @@ -29,7 +29,7 @@ public static ConditionTypeFactory<Pair<World, ItemStack>> getFactory() {
(data, worldAndStack) -> condition(worldAndStack.getRight(), data.get("condition"))
);

ItemConditions.ALIASES.addPathAlias("holder", factory.getSerializerId().getPath());
ItemConditionTypes.ALIASES.addPathAlias("holder", factory.getSerializerId().getPath());
return factory;
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.github.shap_po.shappoli.integration.origins;

import com.github.shap_po.shappoli.integration.origins.action.factory.BiEntityActions;
import com.github.shap_po.shappoli.integration.origins.action.factory.EntityActions;
import com.github.shap_po.shappoli.integration.origins.action.factory.BiEntityActionTypes;
import com.github.shap_po.shappoli.integration.origins.action.factory.EntityActionTypes;

public class OriginsIntegration {
public static void register() {
BiEntityActions.register();
EntityActions.register();
BiEntityActionTypes.register();
EntityActionTypes.register();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import net.minecraft.registry.Registry;
import net.minecraft.util.Pair;

public class BiEntityActions {
public class BiEntityActionTypes {
public static void register() {
register(CopyOriginActionType.getFactory());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import net.minecraft.entity.Entity;
import net.minecraft.registry.Registry;

public class EntityActions {
public class EntityActionTypes {
public static void register() {
register(SetOriginActionType.getFactory());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

import com.github.shap_po.shappoli.Shappoli;
import com.github.shap_po.shappoli.integration.origins.util.OriginsUtil;
import com.github.shap_po.shappoli.util.MiscUtil;
import io.github.apace100.apoli.action.factory.ActionTypeFactory;
import io.github.apace100.apoli.action.factory.BiEntityActions;
import io.github.apace100.apoli.action.type.BiEntityActionTypes;
import io.github.apace100.calio.data.SerializableData;
import io.github.apace100.calio.data.SerializableDataTypes;
import io.github.apace100.origins.origin.Origin;
Expand Down Expand Up @@ -39,11 +40,7 @@ public static ActionTypeFactory<Pair<Entity, Entity>> getFactory() {
.add("layer", SerializableDataTypes.IDENTIFIER, OriginsUtil.ORIGIN_LAYER_ID)
.add("modify_actor", SerializableDataTypes.BOOLEAN, false)
.add("modify_target", SerializableDataTypes.BOOLEAN, true)
.postProcessor(data -> {
if (!data.getBoolean("modify_actor") && !data.getBoolean("modify_target")) {
throw new IllegalStateException("Any of 'modify_actor' and 'modify_target' fields must be true.");
}
})
.validate(MiscUtil::checkAtLeastOneFieldIsTrue)
,
(data, actorAndTarget) -> action(
actorAndTarget.getLeft(), actorAndTarget.getRight(),
Expand All @@ -52,7 +49,7 @@ public static ActionTypeFactory<Pair<Entity, Entity>> getFactory() {
)
);

BiEntityActions.ALIASES.addPathAlias("transfer_origin", factory.getSerializerId().getPath());
BiEntityActionTypes.ALIASES.addPathAlias("transfer_origin", factory.getSerializerId().getPath());
return factory;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import io.github.apace100.origins.origin.Origin;
import io.github.apace100.origins.origin.OriginLayer;
import io.github.apace100.origins.origin.OriginLayerManager;
import io.github.apace100.origins.origin.OriginRegistry;
import io.github.apace100.origins.origin.OriginManager;
import io.github.apace100.origins.registry.ModComponents;
import net.minecraft.entity.Entity;
import net.minecraft.util.Identifier;
Expand Down Expand Up @@ -41,7 +41,7 @@ public static boolean setOrigin(Entity entity, @Nullable OriginLayer layer, @Nul

public static @Nullable Origin getOrigin(Identifier id) {
try {
return OriginRegistry.get(id);
return OriginManager.get(id);
} catch (IllegalArgumentException e) {
return null;
}
Expand Down
Loading

0 comments on commit 7946a02

Please sign in to comment.