Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
legobmw99 committed Jan 7, 2025
1 parent 0abf2e4 commit 24a3502
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

class LootModifiers extends GlobalLootModifierProvider {

LootModifiers(PackOutput output, CompletableFuture<HolderLookup.Provider> regisrties) {
super(output, regisrties, Allomancy.MODID);
LootModifiers(PackOutput output, CompletableFuture<HolderLookup.Provider> registries) {
super(output, registries, Allomancy.MODID);
}

private static final ResourceLocation DUNGEON = ResourceLocation.withDefaultNamespace("chests/simple_dungeon");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import net.minecraft.core.component.DataComponents;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
Expand Down Expand Up @@ -39,21 +38,18 @@ public final class CombatSetup {

private static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(Allomancy.MODID);

public static final TagKey<DamageType> IS_COIN_HIT = TagKey.create(Registries.DAMAGE_TYPE,
ResourceLocation.fromNamespaceAndPath(
Allomancy.MODID, "is_coin_hit"));
public static final ResourceKey<DamageType> COIN_DAMAGE = ResourceKey.create(Registries.DAMAGE_TYPE,
ResourceLocation.fromNamespaceAndPath(
Allomancy.MODID, "coin"));
public static final TagKey<DamageType> IS_COIN_HIT =
TagKey.create(Registries.DAMAGE_TYPE, Allomancy.rl("is_coin_hit"));
public static final ResourceKey<DamageType> COIN_DAMAGE =
ResourceKey.create(Registries.DAMAGE_TYPE, Allomancy.rl("coin"));
public static final DeferredItem<CoinBagItem> COIN_BAG = ITEMS.registerItem("coin_bag", CoinBagItem::new);
public static final DeferredItem<ObsidianDaggerItem> OBSIDIAN_DAGGER =
ITEMS.registerItem("obsidian_dagger", ObsidianDaggerItem::new);
public static final DeferredItem<KolossBladeItem> KOLOSS_BLADE =
ITEMS.registerItem("koloss_blade", KolossBladeItem::new);

public static final ResourceKey<EquipmentAsset> WOOL = ResourceKey.create(EquipmentAssets.ROOT_ID,
ResourceLocation.fromNamespaceAndPath(
Allomancy.MODID, "wool"));
public static final ResourceKey<EquipmentAsset> WOOL =
ResourceKey.create(EquipmentAssets.ROOT_ID, Allomancy.rl("wool"));


public static final TagKey<Item> REPAIRS_MISTCLOAK = ItemTags.create(Allomancy.rl("repairs_wool_armor"));
Expand Down Expand Up @@ -81,10 +77,8 @@ public final class CombatSetup {


// TODO: would be nice if this used the iron_darker override
public static final ResourceKey<EquipmentAsset> ALUMINUM = ResourceKey.create(EquipmentAssets.ROOT_ID,
ResourceLocation.fromNamespaceAndPath(
Allomancy.MODID,
"aluminum"));
public static final ResourceKey<EquipmentAsset> ALUMINUM =
ResourceKey.create(EquipmentAssets.ROOT_ID, Allomancy.rl("aluminum"));


public static final TagKey<Item> REPAIRS_ALUMINUM = ItemTags.create(Allomancy.rl("repairs_aluminum_armor"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ public static void duraluminPewterDamageOutput(AllomancyTestHelper helper) {
}



@GameTest
@EmptyTemplate(value = "5x3x5", floor = true)
@TestHolder(description = "Tests that duralumin and electrum moves you to your spawn")
Expand Down Expand Up @@ -293,6 +292,73 @@ public static void duraluminCopperMakesYouInvis(AllomancyTestHelper helper) {
});
}

@GameTest
@EmptyTemplate("1x3x1")
@TestHolder(description = "Tests that cadmium grants slow falling")
public static void cadmiumGrantsSlowFall(AllomancyTestHelper helper) {
var player = helper.makeMistbornPlayer();
var data = player.getData(AllomancerAttachment.ALLOMANCY_DATA);

data.setBurning(Metal.CADMIUM, true);

helper.succeedOnTickWhen(1, () -> {
helper.assertMobEffectPresent(player, MobEffects.SLOW_FALLING, "Cadmium didn't grant slow fall");
helper.assertMobEffectPresent(player, MobEffects.MOVEMENT_SLOWDOWN, "Cadmium also slowed player");
});
}


@GameTest
@EmptyTemplate(value = "5x3x5", floor = true)
@TestHolder(description = "Tests that cadmium slows nearby entities falling")
public static void cadmiumSlowsNearby(AllomancyTestHelper helper) {
var player = helper.makeMistbornPlayer();
var data = player.getData(AllomancerAttachment.ALLOMANCY_DATA);

data.setBurning(Metal.CADMIUM, true);

var zombie = helper.spawnWithNoFreeWill(EntityType.ZOMBIE, new BlockPos(1, 1, 1));

helper.succeedOnTickWhen(1, () -> {
helper.assertMobEffectPresent(zombie, MobEffects.SLOW_FALLING, "Cadmium didn't grant slow fall");
helper.assertMobEffectPresent(zombie, MobEffects.MOVEMENT_SLOWDOWN, "Cadmium didn't grant slow fall");
});
}

@GameTest
@EmptyTemplate("1x3x1")
@TestHolder(description = "Tests that bendalloy grants haste")
public static void bendalloyGrantsHaste(AllomancyTestHelper helper) {
var player = helper.makeMistbornPlayer();
var data = player.getData(AllomancerAttachment.ALLOMANCY_DATA);

data.setBurning(Metal.BENDALLOY, true);

helper.succeedOnTickWhen(1, () -> {
helper.assertMobEffectPresent(player, MobEffects.DIG_SPEED, "Bendalloy didn't grant haste");
});
}

@GameTest
@EmptyTemplate(value = "5x3x5", floor = true)
@TestHolder(description = "Tests that bendalloy grants haste")
public static void bendalloyAndCadmiumCancel(AllomancyTestHelper helper) {
var player = helper.makeMistbornPlayer();
var data = player.getData(AllomancerAttachment.ALLOMANCY_DATA);

var zombie = helper.spawnWithNoFreeWill(EntityType.ZOMBIE, new BlockPos(1, 1, 1));

data.setBurning(Metal.BENDALLOY, true);
data.setBurning(Metal.CADMIUM, true);
helper.startSequence().thenIdle(10).thenExecute(() -> {
helper.assertMobEffectAbsent(player, MobEffects.DIG_SPEED, "Bendalloy still grant haste");
helper.assertMobEffectAbsent(player, MobEffects.SLOW_FALLING, "Cadmium still grant slow fall");
helper.assertMobEffectAbsent(zombie, MobEffects.SLOW_FALLING, "Cadmium still grant slow fall");
helper.assertMobEffectAbsent(zombie, MobEffects.MOVEMENT_SLOWDOWN, "Cadmium still grant slow fall");
}).thenSucceed();
}


@RegisterStructureTemplate(AllomancyTest.MODID + ":wheat")
public static final StructureTemplate WHEAT = StructureTemplateBuilder
.withSize(3, 5, 3)
Expand Down

0 comments on commit 24a3502

Please sign in to comment.