Merge branch 'gmr-main' into cosmo-main

This commit is contained in:
Gæmer
2025-05-06 13:13:06 +02:00
48 changed files with 558 additions and 109 deletions

View File

@@ -23,4 +23,12 @@
## 1.20.1-1.0.9 ## 1.20.1-1.0.9
- cotton and cotton armour are now obtainable - cotton and cotton armour are now obtainable
- cotton seeds can be obtained from breaking grass - cotton seeds can be obtained from breaking grass
## 1.20.1-1.0.10 (maybe 1.20.1-1.1.0)
- fixed two kitsune powers being on the same key
- (internal) corrected class capitalisation
- (internal)added terraoriginum:wings power
- increased protection effectiveness from 1.1 to 1.2 on latian origins for sun protection
- added light protection for spirit based origins
- added a description for sun protection enchant

View File

@@ -1,5 +1,5 @@
plugins { plugins {
id 'fabric-loom' version '1.9-SNAPSHOT' id 'fabric-loom' version '1.10.1'
id 'maven-publish' id 'maven-publish'
} }
@@ -46,12 +46,36 @@ repositories {
includeGroupByRegex("software\\.bernie.*") includeGroupByRegex("software\\.bernie.*")
includeGroup("com.eliotlash.mclib") includeGroup("com.eliotlash.mclib")
} }
} }
maven {
name = "Up-Mods"
url = "https://maven.uuid.gg/releases"
}
maven {
name = "JourneyMap"
url = "https://jm.gserv.me/repository/maven-public"
}
maven {
name = "TeamResourceful"
url = "https://maven.teamresourceful.com/repository/maven-releases"
}
maven {
name = "ParchmentMC"
url = "https://maven.parchmentmc.org"
content {
includeGroupAndSubgroups "org.parchmentmc"
}
}
} }
dependencies { dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}" minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" mappings loom.layered {
// officialMojangMappings()
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
parchment("org.parchmentmc.data:parchment-${parchment_minecraft}:${parchment_mappings}@zip")
}
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
@@ -60,11 +84,17 @@ dependencies {
modImplementation "com.github.apace100:origins-fabric:${project.origins_version}" modImplementation "com.github.apace100:origins-fabric:${project.origins_version}"
modImplementation "com.github.apace100:apoli:${project.apoli_version}" modImplementation "com.github.apace100:apoli:${project.apoli_version}"
modImplementation "com.github.apace100:calio:${project.calio_version}"
modApi("com.github.Virtuoel:Pehkui:${pehkui_version}", { modApi("com.github.Virtuoel:Pehkui:${pehkui_version}", {
exclude group: "net.fabricmc.fabric-api" exclude group: "net.fabricmc.fabric-api"
}) })
modImplementation("software.bernie.geckolib:geckolib-fabric-${minecraft_version}:${geckolib_version}") modImplementation("software.bernie.geckolib:geckolib-fabric-${minecraft_version}:${geckolib_version}")
implementation("com.eliotlash.mclib:mclib:20") implementation("com.eliotlash.mclib:mclib:20")
modCompileOnly "dev.emi:emi-fabric:${emi_version}:api"
modLocalRuntime "dev.emi:emi-fabric:${emi_version}"
modImplementation "dev.cammiescorner.icarus:Icarus-Fabric:${project.icarus_version}"
} }
processResources { processResources {

View File

@@ -6,6 +6,10 @@ minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10 yarn_mappings=1.20.1+build.10
loader_version=0.16.10 loader_version=0.16.10
#more mappings
parchment_minecraft=1.20.1
parchment_mappings=2023.09.03
# Mod Properties # Mod Properties
mod_version=1.20.1-1.0.9 mod_version=1.20.1-1.0.9
maven_group=com.smithy maven_group=com.smithy
@@ -18,3 +22,7 @@ pehkui_version=3.7.8
origins_version=v1.10.0 origins_version=v1.10.0
apoli_version=2.9.0 apoli_version=2.9.0
geckolib_version=4.7 geckolib_version=4.7
icarus_version=2.11.0
emi_version=1.1.22+1.20.1
calio_version=v1.11.0

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@@ -1,14 +1,15 @@
package com.smithy.terraoriginum; package com.smithy.terraoriginum;
import com.smithy.terraoriginum.blocks.cottonCropBlock; import com.smithy.terraoriginum.blocks.CottonCropBlock;
import com.smithy.terraoriginum.blocks.crucifix; import com.smithy.terraoriginum.blocks.Crucifix;
import com.smithy.terraoriginum.items.*; import com.smithy.terraoriginum.items.*;
import com.smithy.terraoriginum.registry.modEnchantments; import com.smithy.terraoriginum.registry.ModEnchantments;
import com.smithy.terraoriginum.registry.modPowers; import com.smithy.terraoriginum.registry.ModPowers;
import com.smithy.terraoriginum.util.LootTableModifiers; import com.smithy.terraoriginum.util.LootTableModifiers;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
// import net.minecraft.item.ItemGroups;
import net.minecraft.item.ItemGroups; import net.minecraft.item.ItemGroups;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
@@ -21,24 +22,24 @@ public class TerraOriginum implements ModInitializer {
@Override @Override
public void onInitialize() { public void onInitialize() {
umbrella.registerItems(); Umbrella.registerItems();
iconItems.register(); IconItems.register();
modEnchantments.register(); ModEnchantments.register();
crucifix.register(); Crucifix.register();
cottonCropBlock.register(); CottonCropBlock.register();
cottonItems.register(); CottonItems.register();
sunTotem.register(); SunTotem.register();
ghostlyItems.register(); GhostlyItems.register();
ghostlyArmourItems.register(); GhostlyArmourItems.register();
modPowers.register(); ModPowers.register();
LootTableModifiers.modifyLootTables(); LootTableModifiers.modifyLootTables();
ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register((content) -> content.add(umbrella.UMBRELLA)); ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register((content) -> content.add(Umbrella.UMBRELLA));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register((content) -> content.add(sunTotem.SUN_TOTEM)); ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register((content) -> content.add(SunTotem.SUN_TOTEM));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.FUNCTIONAL).register((content) -> content.add(crucifix.CRUCIFIX)); ItemGroupEvents.modifyEntriesEvent(ItemGroups.FUNCTIONAL).register((content) -> content.add(Crucifix.CRUCIFIX));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.NATURAL).register((content) -> content.add(cottonItems.COTTON_SEEDS)); ItemGroupEvents.modifyEntriesEvent(ItemGroups.NATURAL).register((content) -> content.add(CottonItems.COTTON_SEEDS));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register((content) -> content.add(cottonItems.COTTON_BALL)); ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register((content) -> content.add(CottonItems.COTTON_BALL));
LOGGER.info("man this Origins is " + MOD_ID); LOGGER.info("man this Origins is " + MOD_ID);
} }
} }

View File

@@ -1,6 +1,6 @@
package com.smithy.terraoriginum.blocks; package com.smithy.terraoriginum.blocks;
import com.smithy.terraoriginum.items.cottonItems; import com.smithy.terraoriginum.items.CottonItems;
import net.minecraft.block.AbstractBlock; import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@@ -15,7 +15,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
public class cottonCropBlock extends CropBlock{ public class CottonCropBlock extends CropBlock{
private static final VoxelShape[] AGE_TO_SHAPE = new VoxelShape[]{Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D), private static final VoxelShape[] AGE_TO_SHAPE = new VoxelShape[]{Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D),
Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 3.0D, 16.0D), Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 3.0D, 16.0D),
@@ -27,12 +27,12 @@ public class cottonCropBlock extends CropBlock{
Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 9.0D, 16.0D) Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 9.0D, 16.0D)
}; };
public cottonCropBlock(AbstractBlock.Settings settings) { public CottonCropBlock(AbstractBlock.Settings settings) {
super(settings); super(settings);
} }
public ItemConvertible getSeedsItem() { public ItemConvertible getSeedsItem() {
return cottonItems.COTTON_SEEDS; return CottonItems.COTTON_SEEDS;
} }
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {

View File

@@ -9,9 +9,9 @@ import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry; import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
public class crucifix { public class Crucifix {
public static final Block CRUCIFIX = new crucifixClass(FabricBlockSettings.create().strength(5.5f, 4.8f).requiresTool()); public static final Block CRUCIFIX = new CrucifixClass(FabricBlockSettings.create().strength(5.5f, 4.8f).requiresTool());
public static void register() { public static void register() {
// Registry.register(Registries.BLOCK, new Identifier(TerraOriginum.MOD_ID, "crucifix"), new BlockItem(CRUCIFIX, new FabricItemSettings())); // Registry.register(Registries.BLOCK, new Identifier(TerraOriginum.MOD_ID, "crucifix"), new BlockItem(CRUCIFIX, new FabricItemSettings()));

View File

@@ -8,9 +8,9 @@ import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes; import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
public class crucifixClass extends Block { public class CrucifixClass extends Block {
public crucifixClass(Settings properties) { public CrucifixClass(Settings properties) {
super(properties); super(properties);
} }

View File

@@ -1,17 +1,17 @@
package com.smithy.terraoriginum.client; package com.smithy.terraoriginum.client;
import com.smithy.terraoriginum.blocks.cottonCropBlock; import com.smithy.terraoriginum.blocks.CottonCropBlock;
import com.smithy.terraoriginum.items.umbrella; import com.smithy.terraoriginum.items.Umbrella;
import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.RenderLayer;
public class layerRenderer implements ClientModInitializer { public class LayerRenderer implements ClientModInitializer {
@Override @Override
public void onInitializeClient() { public void onInitializeClient() {
umbrella.registerRenderLayers(); Umbrella.registerRenderLayers();
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(), cottonCropBlock.COTTON_CROP_BLOCK); BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(), CottonCropBlock.COTTON_CROP_BLOCK);
} }
} }

View File

@@ -1,23 +1,23 @@
package com.smithy.terraoriginum.client.armour; package com.smithy.terraoriginum.client.armour;
import com.smithy.terraoriginum.items.ghostlyArmour; import com.smithy.terraoriginum.items.GhostlyArmour;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import software.bernie.geckolib.model.GeoModel; import software.bernie.geckolib.model.GeoModel;
public class ghostlyArmourModel extends GeoModel<ghostlyArmour> { public class GhostlyArmourModel extends GeoModel<GhostlyArmour> {
@Override @Override
public Identifier getModelResource(ghostlyArmour animatable) { public Identifier getModelResource(GhostlyArmour animatable) {
return new Identifier("terraoriginum", "geo/ghostly_armour.geo.json"); return new Identifier("terraoriginum", "geo/ghostly_armour.geo.json");
} }
@Override @Override
public Identifier getTextureResource(ghostlyArmour animatable) { public Identifier getTextureResource(GhostlyArmour animatable) {
return new Identifier("terraoriginum", "textures/models/armor/ghost_armour_model_texture"); return new Identifier("terraoriginum", "textures/models/armor/ghost_armour_model_texture");
} }
@Override @Override
public Identifier getAnimationResource(ghostlyArmour animatable) { public Identifier getAnimationResource(GhostlyArmour animatable) {
return null; return null;
} }
} }

View File

@@ -1,15 +1,15 @@
package com.smithy.terraoriginum.client.armour; package com.smithy.terraoriginum.client.armour;
import com.smithy.terraoriginum.TerraOriginum; import com.smithy.terraoriginum.TerraOriginum;
import com.smithy.terraoriginum.items.ghostlyArmour; import com.smithy.terraoriginum.items.GhostlyArmour;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import software.bernie.geckolib.GeckoLib; import software.bernie.geckolib.GeckoLib;
import software.bernie.geckolib.model.DefaultedItemGeoModel; import software.bernie.geckolib.model.DefaultedItemGeoModel;
import software.bernie.geckolib.renderer.GeoArmorRenderer; import software.bernie.geckolib.renderer.GeoArmorRenderer;
public class ghostlyArmourRenderer extends GeoArmorRenderer<ghostlyArmour> { public class GhostlyArmourRenderer extends GeoArmorRenderer<GhostlyArmour> {
public ghostlyArmourRenderer() { public GhostlyArmourRenderer() {
super(new DefaultedItemGeoModel<>(new Identifier(TerraOriginum.MOD_ID, "armor/ghost_armour"))); super(new DefaultedItemGeoModel<>(new Identifier(TerraOriginum.MOD_ID, "armor/ghost_armour")));
} }

View File

@@ -9,11 +9,11 @@ import net.minecraft.sound.SoundEvents;
import java.util.function.Supplier; import java.util.function.Supplier;
import com.smithy.terraoriginum.TerraOriginum; import com.smithy.terraoriginum.TerraOriginum;
import com.smithy.terraoriginum.items.cottonItems; import com.smithy.terraoriginum.items.CottonItems;
public enum robesMaterial implements ArmorMaterial { public enum RobesMaterial implements ArmorMaterial {
ROBES("robes", 42, new int[] { 4, 9, 7, 4 }, 19, ROBES("robes", 42, new int[] { 4, 9, 7, 4 }, 19,
SoundEvents.ITEM_ARMOR_EQUIP_NETHERITE, 5, 0.1f, () -> Ingredient.ofItems(cottonItems.COTTON_BALL)); SoundEvents.ITEM_ARMOR_EQUIP_NETHERITE, 5, 0.1f, () -> Ingredient.ofItems(CottonItems.COTTON_BALL));
private final String name; private final String name;
private final int durabilityMultiplier; private final int durabilityMultiplier;
@@ -26,7 +26,7 @@ public enum robesMaterial implements ArmorMaterial {
private static final int[] BASE_DURABILITY = { 11, 16, 15, 13 }; private static final int[] BASE_DURABILITY = { 11, 16, 15, 13 };
robesMaterial( RobesMaterial(
String name, String name,
int durabilityMultiplier, int durabilityMultiplier,
int[] protectionAmounts, int[] protectionAmounts,

View File

@@ -0,0 +1,39 @@
package com.smithy.terraoriginum.enchantment;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentTarget;
import net.minecraft.enchantment.ProtectionEnchantment;
import net.minecraft.entity.EquipmentSlot;
public class LightProtectionEnchantment extends Enchantment{
public LightProtectionEnchantment(Rarity weight, EnchantmentTarget type, EquipmentSlot[] slotTypes) {
super(weight, type, slotTypes);
}
public int getMinPower(int level) {
return 8 + level * 5;
}
public int getMaxPower(int level) {
return this.getMinPower(level) + 8;
}
public boolean isTreasure() {
return true;
}
public int getMaxLevel() {
return 1;
}
@Override
protected boolean canAccept(Enchantment other) {
if(other == this || ((other instanceof ProtectionEnchantment && !(((ProtectionEnchantment)other).protectionType == ProtectionEnchantment.Type.ALL)))) {
return false;
}
return super.canAccept(other);
}
}

View File

@@ -1,15 +1,15 @@
package com.smithy.terraoriginum.items; package com.smithy.terraoriginum.items;
import com.smithy.terraoriginum.blocks.cottonCropBlock; import com.smithy.terraoriginum.blocks.CottonCropBlock;
import net.minecraft.item.AliasedBlockItem; import net.minecraft.item.AliasedBlockItem;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry; import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
public class cottonItems { public class CottonItems {
public static final Item COTTON_SEEDS = new AliasedBlockItem(cottonCropBlock.COTTON_CROP_BLOCK, new Item.Settings()); public static final Item COTTON_SEEDS = new AliasedBlockItem(CottonCropBlock.COTTON_CROP_BLOCK, new Item.Settings());
public static final Item COTTON_BALL = new Item(new Item.Settings()); public static final Item COTTON_BALL = new Item(new Item.Settings());
public static void register() { public static void register() {

View File

@@ -1,6 +1,6 @@
package com.smithy.terraoriginum.items; package com.smithy.terraoriginum.items;
import com.smithy.terraoriginum.client.armour.ghostlyArmourRenderer; import com.smithy.terraoriginum.client.armour.GhostlyArmourRenderer;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
import net.minecraft.client.render.entity.model.BipedEntityModel; import net.minecraft.client.render.entity.model.BipedEntityModel;
@@ -28,12 +28,12 @@ import java.util.Set;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Supplier; import java.util.function.Supplier;
public class ghostlyArmour extends ArmorItem implements GeoItem { public class GhostlyArmour extends ArmorItem implements GeoItem {
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
private final Supplier<Object> renderProvider = GeoItem.makeRenderer(this); private final Supplier<Object> renderProvider = GeoItem.makeRenderer(this);
public ghostlyArmour(ArmorMaterial armorMaterial, ArmorItem.Type type, Settings properties) { public GhostlyArmour(ArmorMaterial armorMaterial, ArmorItem.Type type, Settings properties) {
super(armorMaterial, type, properties); super(armorMaterial, type, properties);
} }
@@ -46,7 +46,7 @@ public class ghostlyArmour extends ArmorItem implements GeoItem {
@Override @Override
public BipedEntityModel<LivingEntity> getHumanoidArmorModel(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, BipedEntityModel<LivingEntity> original) { public BipedEntityModel<LivingEntity> getHumanoidArmorModel(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, BipedEntityModel<LivingEntity> original) {
if (this.renderer == null) if (this.renderer == null)
this.renderer = new ghostlyArmourRenderer(); this.renderer = new GhostlyArmourRenderer();
// This prepares our GeoArmorRenderer for the current render frame. // This prepares our GeoArmorRenderer for the current render frame.
// These parameters may be null however, so we don't do anything further with them // These parameters may be null however, so we don't do anything further with them
@@ -91,10 +91,10 @@ public class ghostlyArmour extends ArmorItem implements GeoItem {
// Check each of the pieces match our set // Check each of the pieces match our set
boolean isFullSet = wornArmor.containsAll(ObjectArrayList.of( boolean isFullSet = wornArmor.containsAll(ObjectArrayList.of(
ghostlyArmourItems.GHOSTLY_BOOTS, GhostlyArmourItems.GHOSTLY_BOOTS,
ghostlyArmourItems.GHOSTLY_LEGGING, GhostlyArmourItems.GHOSTLY_LEGGING,
ghostlyArmourItems.GHOSTLY_CHESTPLATE, GhostlyArmourItems.GHOSTLY_CHESTPLATE,
ghostlyArmourItems.GHOSTLY_HELMET)); GhostlyArmourItems.GHOSTLY_HELMET));
// Play the animation if the full set is being worn, otherwise stop // Play the animation if the full set is being worn, otherwise stop
return isFullSet ? PlayState.CONTINUE : PlayState.STOP; return isFullSet ? PlayState.CONTINUE : PlayState.STOP;

View File

@@ -1,7 +1,7 @@
package com.smithy.terraoriginum.items; package com.smithy.terraoriginum.items;
import com.smithy.terraoriginum.TerraOriginum; import com.smithy.terraoriginum.TerraOriginum;
import com.smithy.terraoriginum.customMaterials.robesMaterial; import com.smithy.terraoriginum.customMaterials.RobesMaterial;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings; import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
@@ -13,12 +13,12 @@ import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.Rarity; import net.minecraft.util.Rarity;
public class ghostlyArmourItems { public class GhostlyArmourItems {
public static final Item GHOSTLY_HELMET = new ghostlyArmour(robesMaterial.ROBES, ArmorItem.Type.HELMET, new FabricItemSettings().rarity(Rarity.EPIC)); public static final Item GHOSTLY_HELMET = new GhostlyArmour(RobesMaterial.ROBES, ArmorItem.Type.HELMET, new FabricItemSettings().rarity(Rarity.EPIC));
public static final Item GHOSTLY_CHESTPLATE = new ghostlyArmour(robesMaterial.ROBES, ArmorItem.Type.CHESTPLATE, new FabricItemSettings().rarity(Rarity.EPIC)); public static final Item GHOSTLY_CHESTPLATE = new GhostlyArmour(RobesMaterial.ROBES, ArmorItem.Type.CHESTPLATE, new FabricItemSettings().rarity(Rarity.EPIC));
public static final Item GHOSTLY_LEGGING = new ghostlyArmour(robesMaterial.ROBES, ArmorItem.Type.LEGGINGS, new FabricItemSettings().rarity(Rarity.EPIC)); public static final Item GHOSTLY_LEGGING = new GhostlyArmour(RobesMaterial.ROBES, ArmorItem.Type.LEGGINGS, new FabricItemSettings().rarity(Rarity.EPIC));
public static final Item GHOSTLY_BOOTS = new ghostlyArmour(robesMaterial.ROBES, ArmorItem.Type.BOOTS, new FabricItemSettings().rarity(Rarity.EPIC)); public static final Item GHOSTLY_BOOTS = new GhostlyArmour(RobesMaterial.ROBES, ArmorItem.Type.BOOTS, new FabricItemSettings().rarity(Rarity.EPIC));
public static void register() { public static void register() {
Registry.register(Registries.ITEM, new Identifier(TerraOriginum.MOD_ID, "ghostly_helmet"), GHOSTLY_HELMET); Registry.register(Registries.ITEM, new Identifier(TerraOriginum.MOD_ID, "ghostly_helmet"), GHOSTLY_HELMET);

View File

@@ -8,7 +8,7 @@ import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry; import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
public class ghostlyItems { public class GhostlyItems {
public static final Item GHOSTLY_CLOTH = new Item(new FabricItemSettings()); public static final Item GHOSTLY_CLOTH = new Item(new FabricItemSettings());

View File

@@ -7,7 +7,7 @@ import net.minecraft.util.Rarity;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry; import net.minecraft.registry.Registry;
public class iconItems { public class IconItems {
public static final Item MYNC_EYE = new Item(new Item.Settings().maxCount(1).rarity(Rarity.EPIC)); public static final Item MYNC_EYE = new Item(new Item.Settings().maxCount(1).rarity(Rarity.EPIC));
public static final Item SPIRIT = new Item(new Item.Settings().maxCount(1).rarity(Rarity.EPIC)); public static final Item SPIRIT = new Item(new Item.Settings().maxCount(1).rarity(Rarity.EPIC));

View File

@@ -7,7 +7,7 @@ import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.Rarity; import net.minecraft.util.Rarity;
public class sunTotem { public class SunTotem {
public static final Item SUN_TOTEM = new Item(new Item.Settings().maxCount(1).rarity(Rarity.EPIC)); public static final Item SUN_TOTEM = new Item(new Item.Settings().maxCount(1).rarity(Rarity.EPIC));

View File

@@ -10,8 +10,8 @@ import net.minecraft.util.Identifier;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry; import net.minecraft.registry.Registry;
public class umbrella { public class Umbrella {
public static final umbrellaDyeTest UMBRELLA = new umbrellaDyeTest(new FabricItemSettings().maxCount(1).maxDamage(1200)); public static final UmbrellaDyeTest UMBRELLA = new UmbrellaDyeTest(new FabricItemSettings().maxCount(1).maxDamage(1200));
public static void registerItems() { public static void registerItems() {

View File

@@ -3,9 +3,9 @@ package com.smithy.terraoriginum.items;
import net.minecraft.item.DyeableItem; import net.minecraft.item.DyeableItem;
import net.minecraft.item.Item; import net.minecraft.item.Item;
public class umbrellaDyeTest extends Item implements DyeableItem { public class UmbrellaDyeTest extends Item implements DyeableItem {
public umbrellaDyeTest(Settings settings) { public UmbrellaDyeTest(Settings settings) {
super(settings); super(settings);
} }

View File

@@ -1,7 +1,7 @@
package com.smithy.terraoriginum.mixin; package com.smithy.terraoriginum.mixin;
import com.smithy.terraoriginum.items.umbrella; import com.smithy.terraoriginum.items.Umbrella;
import com.smithy.terraoriginum.power.preventBlockSlowness; import com.smithy.terraoriginum.power.PreventBlockSlowness;
import io.github.apace100.apoli.component.PowerHolderComponent; import io.github.apace100.apoli.component.PowerHolderComponent;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@@ -34,14 +34,14 @@ public abstract class EntityMixin {
private void isBeingRainedOn(CallbackInfoReturnable<Boolean> cir) { private void isBeingRainedOn(CallbackInfoReturnable<Boolean> cir) {
Iterable<ItemStack> hands = this.getHandItems(); Iterable<ItemStack> hands = this.getHandItems();
for (ItemStack stack : hands) { for (ItemStack stack : hands) {
if (stack.getItem() == umbrella.UMBRELLA) if (stack.getItem() == Umbrella.UMBRELLA)
cir.setReturnValue(false); cir.setReturnValue(false);
} }
} }
@Inject(method = "slowMovement", at = @At("HEAD"), cancellable = true) @Inject(method = "slowMovement", at = @At("HEAD"), cancellable = true)
private void terraoriginum$preventBlockSlowness(BlockState state, Vec3d multiplier, CallbackInfo ci) { private void terraoriginum$preventBlockSlowness(BlockState state, Vec3d multiplier, CallbackInfo ci) {
for (preventBlockSlowness power : PowerHolderComponent.getPowers((Entity) (Object) this, preventBlockSlowness.class)) { for (PreventBlockSlowness power : PowerHolderComponent.getPowers((Entity) (Object) this, PreventBlockSlowness.class)) {
if (power.isActive()) { if (power.isActive()) {
ci.cancel(); ci.cancel();
return; return;

View File

@@ -0,0 +1,47 @@
package com.smithy.terraoriginum.mixin;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.smithy.terraoriginum.power.WingsPower;
import dev.cammiescorner.icarus.api.IcarusPlayerValues;
import dev.cammiescorner.icarus.util.IcarusHelper;
import io.github.apace100.apoli.component.PowerHolderComponent;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import java.util.function.Function;
import java.util.function.Predicate;
@Mixin(value = IcarusHelper.class, remap = false)
public class IcarusHelperMixin {
@ModifyReturnValue(method = "getConfigValues", at = @At("RETURN"))
private static IcarusPlayerValues injectPowerConfigValues(IcarusPlayerValues original, LivingEntity entity) {
var list = PowerHolderComponent.getPowers(entity, WingsPower.class);
if(!list.isEmpty()) {
var power = list.get(0);
power.updateFallback(original);
return power;
}
return original;
}
@WrapOperation(method = "hasWings", at = @At(value = "INVOKE", target = "Ljava/util/function/Predicate;test(Ljava/lang/Object;)Z"))
private static boolean originHasWings(Predicate<LivingEntity> instance, Object entity, Operation<Boolean> original) {
return PowerHolderComponent.hasPower((LivingEntity) entity, WingsPower.class) || original.call(instance, entity);
}
@WrapOperation(method = "getEquippedWings", at = @At(value = "INVOKE", target = "Ljava/util/function/Function;apply(Ljava/lang/Object;)Ljava/lang/Object;"))
private static Object originGetWings(Function<LivingEntity, ItemStack> instance, Object entity, Operation<ItemStack> original) {
if (PowerHolderComponent.hasPower((LivingEntity) entity, WingsPower.class)) {
// null is special case
return null;
}
return original.call(instance, entity);
}
}

View File

@@ -2,7 +2,7 @@ package com.smithy.terraoriginum.mixin;
import io.github.apace100.apoli.power.factory.condition.EntityConditions; import io.github.apace100.apoli.power.factory.condition.EntityConditions;
import io.github.apace100.calio.data.SerializableData; import io.github.apace100.calio.data.SerializableData;
import com.smithy.terraoriginum.items.umbrella; import com.smithy.terraoriginum.items.Umbrella;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
@@ -16,7 +16,7 @@ public class PlayerConditionsMixin {
@Inject(method = { "lambda$register$10" }, at = { @At("HEAD") }, cancellable = true) @Inject(method = { "lambda$register$10" }, at = { @At("HEAD") }, cancellable = true)
private static void sunDamagePrevention(SerializableData.Instance data, Entity player, CallbackInfoReturnable<Boolean> cir) { private static void sunDamagePrevention(SerializableData.Instance data, Entity player, CallbackInfoReturnable<Boolean> cir) {
for (ItemStack stack : player.getHandItems()) { for (ItemStack stack : player.getHandItems()) {
if (stack.getItem().equals(umbrella.UMBRELLA) && stack.getDamage() < stack.getMaxDamage() - 1) { if (stack.getItem().equals(Umbrella.UMBRELLA) && stack.getDamage() < stack.getMaxDamage() - 1) {
cir.setReturnValue(false); cir.setReturnValue(false);
} }
} }
@@ -25,7 +25,7 @@ public class PlayerConditionsMixin {
@Inject(method = { "lambda$register$11" }, at = { @At("HEAD") }, cancellable = true) @Inject(method = { "lambda$register$11" }, at = { @At("HEAD") }, cancellable = true)
private static void umbrellaRainedOn(SerializableData.Instance data, Entity player, CallbackInfoReturnable<Boolean> cir) { private static void umbrellaRainedOn(SerializableData.Instance data, Entity player, CallbackInfoReturnable<Boolean> cir) {
for (ItemStack stack : player.getHandItems()) { for (ItemStack stack : player.getHandItems()) {
if (stack.getItem().equals(umbrella.UMBRELLA) && stack.getDamage() < stack.getMaxDamage() - 1) { if (stack.getItem().equals(Umbrella.UMBRELLA) && stack.getDamage() < stack.getMaxDamage() - 1) {
cir.setReturnValue(false); cir.setReturnValue(false);
} }
} }

View File

@@ -1,7 +1,7 @@
package com.smithy.terraoriginum.mixin; package com.smithy.terraoriginum.mixin;
import io.github.apace100.apoli.mixin.EntityAccessor; import io.github.apace100.apoli.mixin.EntityAccessor;
import com.smithy.terraoriginum.items.umbrella; import com.smithy.terraoriginum.items.Umbrella;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.EquipmentSlot;
@@ -37,7 +37,7 @@ public abstract class PlayerEntityMixin extends Entity {
if (isBeingRainedOn && this.age % 10 == 0) { if (isBeingRainedOn && this.age % 10 == 0) {
for (ItemStack stack : this.getHandItems()) { for (ItemStack stack : this.getHandItems()) {
if (stack.getItem().equals(umbrella.UMBRELLA) && stack.getDamage() < stack.getMaxDamage() - 1) { if (stack.getItem().equals(Umbrella.UMBRELLA) && stack.getDamage() < stack.getMaxDamage() - 1) {
// Set damage instead of calling stack.damage, otherwise an animation is // Set damage instead of calling stack.damage, otherwise an animation is
// triggered for each damage tick. // triggered for each damage tick.
stack.setDamage(stack.getDamage() + 1); stack.setDamage(stack.getDamage() + 1);
@@ -58,7 +58,7 @@ public abstract class PlayerEntityMixin extends Entity {
} }
private void repairStack(ItemStack stack, boolean isHot, boolean isExposed) { private void repairStack(ItemStack stack, boolean isHot, boolean isExposed) {
if (stack.getItem().equals(umbrella.UMBRELLA) && stack.isDamaged()) { if (stack.getItem().equals(Umbrella.UMBRELLA) && stack.isDamaged()) {
stack.setDamage(stack.getDamage() - 1); stack.setDamage(stack.getDamage() - 1);
if (isHot) { if (isHot) {
// Umbrellas dry faster in hot climates. // Umbrellas dry faster in hot climates.

View File

@@ -8,13 +8,13 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.smithy.terraoriginum.power.canStandOnPowderSnow; import com.smithy.terraoriginum.power.CanStandOnPowderSnow;
@Mixin(PowderSnowBlock.class) @Mixin(PowderSnowBlock.class)
public class PowderSnowBlockMixin { public class PowderSnowBlockMixin {
@Inject(method = "canWalkOnPowderSnow", at = @At("HEAD"), cancellable = true) @Inject(method = "canWalkOnPowderSnow", at = @At("HEAD"), cancellable = true)
private static void terraoriginum$canStandOnPowderSnow(Entity entity, CallbackInfoReturnable<Boolean> cir) { private static void terraoriginum$canStandOnPowderSnow(Entity entity, CallbackInfoReturnable<Boolean> cir) {
for (canStandOnPowderSnow canStandOnPowderSnowPower : PowerHolderComponent.getPowers(entity, canStandOnPowderSnow.class)) { for (CanStandOnPowderSnow canStandOnPowderSnowPower : PowerHolderComponent.getPowers(entity, CanStandOnPowderSnow.class)) {
if (canStandOnPowderSnowPower.isActive()) { if (canStandOnPowderSnowPower.isActive()) {
cir.setReturnValue(true); cir.setReturnValue(true);
return; return;

View File

@@ -0,0 +1,26 @@
package com.smithy.terraoriginum.mixin.client;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.smithy.terraoriginum.power.WingsPower;
import dev.cammiescorner.icarus.client.IcarusClient;
import io.github.apace100.apoli.component.PowerHolderComponent;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@Mixin(value = IcarusClient.class, remap = false)
public class IcarusClientMixin {
@ModifyReturnValue(method = "getWingsForRendering", at = @At(value = "RETURN"))
private static ItemStack injectOriginWings(ItemStack original, LivingEntity entity) {
if(original.isEmpty()) {
var list = PowerHolderComponent.getPowers(entity, WingsPower.class);
if (!list.isEmpty()) {
return list.get(0).getWingsType();
}
}
return original;
}
}

View File

@@ -4,8 +4,8 @@ import io.github.apace100.apoli.power.Power;
import io.github.apace100.apoli.power.PowerType; import io.github.apace100.apoli.power.PowerType;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
public class canStandOnPowderSnow extends Power { public class CanStandOnPowderSnow extends Power {
public canStandOnPowderSnow(PowerType<?> type, LivingEntity entity) { public CanStandOnPowderSnow(PowerType<?> type, LivingEntity entity) {
super(type, entity); super(type, entity);
} }
} }

View File

@@ -4,8 +4,8 @@ import io.github.apace100.apoli.power.Power;
import io.github.apace100.apoli.power.PowerType; import io.github.apace100.apoli.power.PowerType;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
public class preventBlockSlowness extends Power { public class PreventBlockSlowness extends Power {
public preventBlockSlowness(PowerType<?> type, LivingEntity entity) { public PreventBlockSlowness(PowerType<?> type, LivingEntity entity) {
super(type, entity); super(type, entity);
} }
} }

View File

@@ -0,0 +1,113 @@
package com.smithy.terraoriginum.power;
import com.smithy.terraoriginum.TerraOriginum;
import com.smithy.terraoriginum.util.CustomDataTypes;
import com.smithy.terraoriginum.util.OptionalBool;
import dev.cammiescorner.icarus.api.IcarusPlayerValues;
import dev.cammiescorner.icarus.util.ServerPlayerFallbackValues;
import io.github.apace100.apoli.power.Power;
import io.github.apace100.apoli.power.PowerType;
import io.github.apace100.apoli.power.factory.PowerFactory;
import io.github.apace100.calio.data.SerializableData;
import net.minecraft.util.Identifier;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import java.util.OptionalDouble;
import java.util.OptionalInt;
public class WingsPower extends Power implements IcarusPlayerValues {
public static final Identifier POWER_TYPE_ID = new Identifier(TerraOriginum.MOD_ID, "wings");
private final ItemStack wingsType;
private final OptionalBool armorSlows;
private final OptionalDouble maxSlowedMultiplier;
private final OptionalDouble wingsSpeed;
private final OptionalDouble exhaustionAmount;
private final OptionalInt maxHeightAboveWorld;
private IcarusPlayerValues fallback = new ServerPlayerFallbackValues();
public WingsPower(PowerType<?> type, LivingEntity entity, ItemStack wingsType, OptionalBool armorSlows, OptionalDouble maxSlowedMultiplier, OptionalDouble wingsSpeed, OptionalDouble exhaustionAmount, OptionalInt maxHeightAboveWorld) {
super(type, entity);
this.wingsType = wingsType;
this.armorSlows = armorSlows;
this.maxSlowedMultiplier = maxSlowedMultiplier;
this.wingsSpeed = wingsSpeed;
this.exhaustionAmount = exhaustionAmount;
this.maxHeightAboveWorld = maxHeightAboveWorld;
}
public ItemStack getWingsType() {
return wingsType;
}
public void updateFallback(IcarusPlayerValues fallback) {
this.fallback = fallback;
}
@Override
public float wingsSpeed() {
return (float) wingsSpeed.orElseGet(fallback::wingsSpeed);
}
@Override
public float maxSlowedMultiplier() {
return (float) maxSlowedMultiplier.orElseGet(fallback::maxSlowedMultiplier);
}
@Override
public boolean armorSlows() {
return armorSlows.orElseGet(fallback::armorSlows);
}
@Override
public boolean canLoopDeLoop() {
return fallback.canLoopDeLoop();
}
@Override
public boolean canSlowFall() {
return fallback.canSlowFall();
}
@Override
public float exhaustionAmount() {
return (float) exhaustionAmount.orElseGet(fallback::exhaustionAmount);
}
@Override
public int maxHeightAboveWorld() {
return maxHeightAboveWorld.orElseGet(fallback::maxHeightAboveWorld);
}
@Override
public boolean maxHeightEnabled() {
return maxHeightAboveWorld.isPresent() || fallback.maxHeightEnabled();
}
public static PowerFactory<WingsPower> createFactory() {
return new PowerFactory<>(POWER_TYPE_ID,
new SerializableData()
.add("wings_type", CustomDataTypes.STACK_OR_ITEM_NAME)
.add("armor_slows", CustomDataTypes.OPTIONAL_BOOL, OptionalBool.DEFAULT)
.add("max_slowed_multiplier", CustomDataTypes.OPTIONAL_DOUBLE, OptionalDouble.empty())
.add("wings_speed", CustomDataTypes.OPTIONAL_DOUBLE, OptionalDouble.empty())
.add("exhaustion_amount", CustomDataTypes.OPTIONAL_DOUBLE, OptionalDouble.empty())
.add("max_height_above_world", CustomDataTypes.OPTIONAL_INT, OptionalInt.empty()),
data -> (type, owner) -> {
ItemStack wingsType = data.get("wings_type");
OptionalBool armorSlows = data.get("armor_slows");
OptionalDouble maxSlowedMultiplier = data.get("max_slowed_multiplier");
OptionalDouble wingsSpeed = data.get("wings_speed");
OptionalDouble exhaustionAmount = data.get("exhaustion_amount");
OptionalInt maxHeightAboveWorld = data.get("max_height_above_world");
return new WingsPower(type, owner, wingsType, armorSlows, maxSlowedMultiplier, wingsSpeed, exhaustionAmount, maxHeightAboveWorld);
}
);
}
}

View File

@@ -1,6 +1,7 @@
package com.smithy.terraoriginum.registry; package com.smithy.terraoriginum.registry;
import com.smithy.terraoriginum.TerraOriginum; import com.smithy.terraoriginum.TerraOriginum;
import com.smithy.terraoriginum.enchantment.LightProtectionEnchantment;
import com.smithy.terraoriginum.enchantment.SunProtectionEnchantment; import com.smithy.terraoriginum.enchantment.SunProtectionEnchantment;
import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentTarget; import net.minecraft.enchantment.EnchantmentTarget;
@@ -9,12 +10,14 @@ import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.registry.Registry; import net.minecraft.registry.Registry;
public class modEnchantments { public class ModEnchantments {
public static final Enchantment SUN_PROTECTION = new SunProtectionEnchantment(Enchantment.Rarity.RARE, EnchantmentTarget.ARMOR, new EquipmentSlot[]{EquipmentSlot.HEAD, EquipmentSlot.CHEST, EquipmentSlot.LEGS, EquipmentSlot.FEET}); public static final Enchantment SUN_PROTECTION = new SunProtectionEnchantment(Enchantment.Rarity.RARE, EnchantmentTarget.ARMOR, new EquipmentSlot[]{EquipmentSlot.HEAD, EquipmentSlot.CHEST, EquipmentSlot.LEGS, EquipmentSlot.FEET});
public static final Enchantment LIGHT_PROTECTION = new LightProtectionEnchantment(Enchantment.Rarity.RARE, EnchantmentTarget.ARMOR_CHEST, new EquipmentSlot[]{EquipmentSlot.CHEST});
public static void register() { public static void register() {
register("sun_protection", SUN_PROTECTION); register("sun_protection", SUN_PROTECTION);
register("light_protection", LIGHT_PROTECTION);
} }
private static Enchantment register(String path, Enchantment enchantment) { private static Enchantment register(String path, Enchantment enchantment) {

View File

@@ -1,8 +1,9 @@
package com.smithy.terraoriginum.registry; package com.smithy.terraoriginum.registry;
import com.smithy.terraoriginum.TerraOriginum; import com.smithy.terraoriginum.TerraOriginum;
import com.smithy.terraoriginum.power.canStandOnPowderSnow; import com.smithy.terraoriginum.power.CanStandOnPowderSnow;
import com.smithy.terraoriginum.power.preventBlockSlowness; import com.smithy.terraoriginum.power.PreventBlockSlowness;
import com.smithy.terraoriginum.power.WingsPower;
import io.github.apace100.apoli.power.factory.PowerFactory; import io.github.apace100.apoli.power.factory.PowerFactory;
import io.github.apace100.apoli.registry.ApoliRegistries; import io.github.apace100.apoli.registry.ApoliRegistries;
@@ -10,15 +11,17 @@ import io.github.apace100.calio.data.SerializableData;
import net.minecraft.registry.Registry; import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
public class modPowers { public class ModPowers {
public static final PowerFactory<?> CAN_WALK_ON_POWDER_SNOW = new PowerFactory<>( new Identifier(TerraOriginum.MOD_ID, "can_walk_on_powder_snow"), new SerializableData(), data -> (type, entity) -> new canStandOnPowderSnow(type, entity)).allowCondition(); public static final PowerFactory<?> CAN_WALK_ON_POWDER_SNOW = new PowerFactory<>( new Identifier(TerraOriginum.MOD_ID, "can_walk_on_powder_snow"), new SerializableData(), data -> (type, entity) -> new CanStandOnPowderSnow(type, entity)).allowCondition();
public static final PowerFactory<?> PREVENT_BLOCK_SLOWNESS = new PowerFactory<>(new Identifier(TerraOriginum.MOD_ID, "prevent_block_slowness"), new SerializableData(), data -> (type, entity) -> new preventBlockSlowness(type, entity)).allowCondition(); public static final PowerFactory<?> PREVENT_BLOCK_SLOWNESS = new PowerFactory<>(new Identifier(TerraOriginum.MOD_ID, "prevent_block_slowness"), new SerializableData(), data -> (type, entity) -> new PreventBlockSlowness(type, entity)).allowCondition();
public static final PowerFactory<?> WINGS_POWER = WingsPower.createFactory().allowCondition();
public static void register() { public static void register() {
Registry.register(ApoliRegistries.POWER_FACTORY, CAN_WALK_ON_POWDER_SNOW.getSerializerId(), CAN_WALK_ON_POWDER_SNOW); Registry.register(ApoliRegistries.POWER_FACTORY, CAN_WALK_ON_POWDER_SNOW.getSerializerId(), CAN_WALK_ON_POWDER_SNOW);
Registry.register(ApoliRegistries.POWER_FACTORY, PREVENT_BLOCK_SLOWNESS.getSerializerId(), PREVENT_BLOCK_SLOWNESS); Registry.register(ApoliRegistries.POWER_FACTORY, PREVENT_BLOCK_SLOWNESS.getSerializerId(), PREVENT_BLOCK_SLOWNESS);
Registry.register(ApoliRegistries.POWER_FACTORY, WingsPower.POWER_TYPE_ID, WINGS_POWER);
} }
} }

View File

@@ -0,0 +1,13 @@
package com.smithy.terraoriginum.util;
import com.mojang.datafixers.util.Either;
import com.mojang.serialization.Codec;
import net.minecraft.registry.Registries;
import net.minecraft.item.ItemStack;
import java.util.function.UnaryOperator;
public class CodecHelper {
public static final Codec<ItemStack> STACK_OR_ITEM_NAME = Codec.either(ItemStack.CODEC, Registries.ITEM.getCodec()).xmap(either -> either.map(UnaryOperator.identity(), ItemStack::new), Either::left);
}

View File

@@ -0,0 +1,78 @@
package com.smithy.terraoriginum.util;
import com.google.gson.JsonParseException;
import com.mojang.serialization.JsonOps;
import io.github.apace100.calio.data.SerializableDataType;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketByteBuf;
import java.util.OptionalDouble;
import java.util.OptionalInt;
public class CustomDataTypes {
public static final SerializableDataType<ItemStack> STACK_OR_ITEM_NAME = new SerializableDataType<>(
ItemStack.class,
PacketByteBuf::writeItemStack,
PacketByteBuf::readItemStack,
jsonElement -> CodecHelper.STACK_OR_ITEM_NAME.decode(JsonOps.INSTANCE, jsonElement).result().orElseThrow(() -> new JsonParseException("Could not parse ItemStack from JSON.")).getFirst()
);
/*new SerializableDataType<>(ItemStack.class,
PacketByteBuf::writeItem,
PacketByteBuf::readItem,
jsonElement -> CodecHelper.STACK_OR_ITEM_NAME.decode(JsonOps.INSTANCE, jsonElement).result().orElseThrow(() -> new JsonParseException("Could not parse ItemStack from JSON.")).getFirst()
);*/
public static final SerializableDataType<OptionalBool> OPTIONAL_BOOL = new SerializableDataType<>(OptionalBool.class,
PacketByteBuf::writeEnumConstant,
buf -> buf.readEnumConstant(OptionalBool.class),
jsonElement -> {
if (jsonElement.isJsonPrimitive() && jsonElement.getAsJsonPrimitive().isBoolean()) {
return OptionalBool.of(jsonElement.getAsBoolean());
}
return OptionalBool.DEFAULT;
}
);
public static final SerializableDataType<OptionalDouble> OPTIONAL_DOUBLE = new SerializableDataType<>(OptionalDouble.class,
(buf, optionalDouble) -> {
buf.writeBoolean(optionalDouble.isPresent());
if (optionalDouble.isPresent()) {
buf.writeDouble(optionalDouble.getAsDouble());
}
},
buf -> {
if (buf.readBoolean()) {
return OptionalDouble.of(buf.readDouble());
}
return OptionalDouble.empty();
},
jsonElement -> {
if (jsonElement.isJsonPrimitive() && jsonElement.getAsJsonPrimitive().isNumber()) {
return OptionalDouble.of(jsonElement.getAsDouble());
}
return OptionalDouble.empty();
}
);
public static final SerializableDataType<OptionalInt> OPTIONAL_INT = new SerializableDataType<>(OptionalInt.class,
(buf, optionalInt) -> {
buf.writeBoolean(optionalInt.isPresent());
if (optionalInt.isPresent()) {
buf.writeInt(optionalInt.getAsInt());
}
},
buf -> {
if (buf.readBoolean()) {
return OptionalInt.of(buf.readInt());
}
return OptionalInt.empty();
},
jsonElement -> {
if (jsonElement.isJsonPrimitive() && jsonElement.getAsJsonPrimitive().isNumber()) {
return OptionalInt.of(jsonElement.getAsInt());
}
return OptionalInt.empty();
}
);
}

View File

@@ -1,6 +1,6 @@
package com.smithy.terraoriginum.util; package com.smithy.terraoriginum.util;
import com.smithy.terraoriginum.items.cottonItems; import com.smithy.terraoriginum.items.CottonItems;
import net.fabricmc.fabric.api.loot.v2.LootTableEvents; import net.fabricmc.fabric.api.loot.v2.LootTableEvents;
import net.minecraft.loot.LootPool; import net.minecraft.loot.LootPool;
import net.minecraft.loot.condition.RandomChanceLootCondition; import net.minecraft.loot.condition.RandomChanceLootCondition;
@@ -20,7 +20,7 @@ public class LootTableModifiers {
LootPool.Builder poolBuilder = LootPool.builder() LootPool.Builder poolBuilder = LootPool.builder()
.rolls(ConstantLootNumberProvider.create(1)) .rolls(ConstantLootNumberProvider.create(1))
.conditionally(RandomChanceLootCondition.builder(0.08f)) .conditionally(RandomChanceLootCondition.builder(0.08f))
.with(ItemEntry.builder(cottonItems.COTTON_SEEDS)) .with(ItemEntry.builder(CottonItems.COTTON_SEEDS))
.apply(SetCountLootFunction.builder(UniformLootNumberProvider.create(1.0f, 1.0f)).build()); .apply(SetCountLootFunction.builder(UniformLootNumberProvider.create(1.0f, 1.0f)).build());
tableBuilder.pool(poolBuilder.build()); tableBuilder.pool(poolBuilder.build());

View File

@@ -0,0 +1,38 @@
package com.smithy.terraoriginum.util;
import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import java.util.Optional;
import java.util.function.BooleanSupplier;
public enum OptionalBool {
TRUE,
FALSE,
DEFAULT;
public static OptionalBool of(Boolean value) {
return value == null ? DEFAULT : value ? TRUE : FALSE;
}
public boolean isTrue() {
return this == TRUE;
}
public boolean orElse(boolean defaultValue) {
return this == TRUE || (this == DEFAULT && defaultValue);
}
public boolean orElseGet(BooleanSupplier defaultValue) {
return this == TRUE || (this == DEFAULT && defaultValue.getAsBoolean());
}
public Optional<Boolean> asOptional() {
return this == DEFAULT ? Optional.empty() : Optional.of(isTrue());
}
public static MapCodec<OptionalBool> codecFieldOf(String fieldName) {
return Codec.BOOL.optionalFieldOf(fieldName).xmap(opt -> opt.map(aBoolean -> aBoolean ? TRUE : FALSE).orElse(DEFAULT), OptionalBool::asOptional);
}
}

View File

@@ -0,0 +1,10 @@
package com.smithy.terraoriginum.util;
import net.minecraft.entity.Entity;
public class TerraHelper {
public static boolean isWet(Entity entity) {
return entity.isWet();
}
}

View File

@@ -16,6 +16,9 @@
"death.attack.boiling": "%1$s boiled up", "death.attack.boiling": "%1$s boiled up",
"death.attack.boiling.player": "%1$s boiled up whilst trying to fight off %2$s", "death.attack.boiling.player": "%1$s boiled up whilst trying to fight off %2$s",
"enchantment.terraoriginum.sun_protection": "Sun Protection", "enchantment.terraoriginum.sun_protection": "Sun Protection",
"enchantment.terraoriginum.sun_protection.description": "Protects Latians from the sun temporarily",
"enchantment.terraoriginum.light_protection": "Light Protection",
"enchantment.terraoriginum.light_protection.description": "Reduces Ectoplasm loss for spirits",
"item.terraoriginum.ghostly_helmet": "Ghostly Hood", "item.terraoriginum.ghostly_helmet": "Ghostly Hood",
"item.terraoriginum.ghostly_chestplate": "Ghostly Robe", "item.terraoriginum.ghostly_chestplate": "Ghostly Robe",
"item.terraoriginum.ghostly_leggings": "Ghostly Pants", "item.terraoriginum.ghostly_leggings": "Ghostly Pants",

View File

@@ -11,7 +11,8 @@
"terraoriginum:munch-powers/quiet", "terraoriginum:munch-powers/quiet",
"terraoriginum:munch-powers/climbing", "terraoriginum:munch-powers/climbing",
"terraoriginum:munch-powers/mounting", "terraoriginum:munch-powers/mounting",
"terraoriginum:munch-powers/speedy_bastard" "terraoriginum:munch-powers/speedy_bastard",
"terraoriginum:wings"
], ],
"icon": { "icon": {
"item": "terraoriginum:tiny" "item": "terraoriginum:tiny"

View File

@@ -4,6 +4,6 @@
"interval": 20, "interval": 20,
"entity_action": { "entity_action": {
"type": "origins:execute_command", "type": "origins:execute_command",
"command": "/scale set pehkui:hitbox_height 0.5" "command": "/scale set pehkui:hitbox_height 1"
} }
} }

View File

@@ -4,6 +4,6 @@
"interval": 20, "interval": 20,
"entity_action": { "entity_action": {
"type": "origins:execute_command", "type": "origins:execute_command",
"command": "/scale set pehkui:hitbox_height 0.5" "command": "/scale set pehkui:hitbox_height 1"
} }
} }

View File

@@ -2,7 +2,7 @@
"type": "origins:inventory", "type": "origins:inventory",
"drop_on_death": false, "drop_on_death": false,
"key": { "key": {
"key": "key.origins.secondary_active", "key": "key.origins.ternary_active",
"continuous": false "continuous": false
} }
} }

View File

@@ -12,7 +12,7 @@
}, },
"hidden": true, "hidden": true,
"key": { "key": {
"key": "key.origins.secondary_active", "key": "key.origins.ternary_active",
"continuous": false "continuous": false
}, },
"cooldown": 0, "cooldown": 0,

View File

@@ -33,5 +33,5 @@
"bypasses_armor": true "bypasses_armor": true
}, },
"protection_enchantment": "terraoriginum:sun_protection", "protection_enchantment": "terraoriginum:sun_protection",
"protection_effectiveness": 1.1 "protection_effectiveness": 1.2
} }

View File

@@ -1,6 +1,6 @@
{ {
"type": "origins:action_over_time", "type": "origins:action_over_time",
"interval": 20, "interval": 40,
"entity_action": { "entity_action": {
"type": "origins:if_else_list", "type": "origins:if_else_list",
"actions": [ "actions": [
@@ -68,7 +68,27 @@
{ {
"type": "origins:change_resource", "type": "origins:change_resource",
"resource": "terraoriginum:spirit-powers/ectoplasm", "resource": "terraoriginum:spirit-powers/ectoplasm",
"change": 2, "change": 4,
"operation": "add"
}
]
}
},
{
"condition": {
"type": "origins:enchantment",
"enchantment": "terraoriginum:light_protection",
"calculation": "sum",
"comparison": ">=",
"compare_to": 1
},
"action": {
"type": "origins:and",
"actions": [
{
"type": "origins:change_resource",
"resource": "terraoriginum:spirit-powers/ectoplasm",
"change": -1,
"operation": "add" "operation": "add"
} }
] ]
@@ -86,7 +106,7 @@
{ {
"type": "origins:change_resource", "type": "origins:change_resource",
"resource": "terraoriginum:spirit-powers/ectoplasm", "resource": "terraoriginum:spirit-powers/ectoplasm",
"change": -1, "change": -2,
"operation": "add" "operation": "add"
} }
] ]
@@ -109,7 +129,7 @@
{ {
"type": "origins:change_resource", "type": "origins:change_resource",
"resource": "terraoriginum:spirit-powers/ectoplasm", "resource": "terraoriginum:spirit-powers/ectoplasm",
"change": 2, "change": 4,
"operation": "add" "operation": "add"
} }
] ]

View File

@@ -0,0 +1,4 @@
{
"type": "terraoriginum:wings",
"wings_type": "icarus:white_feathered_wings"
}

View File

@@ -24,7 +24,7 @@
], ],
"client": [ "client": [
"com.smithy.terraoriginum.client.TerraKeybinds", "com.smithy.terraoriginum.client.TerraKeybinds",
"com.smithy.terraoriginum.client.layerRenderer" "com.smithy.terraoriginum.client.LayerRenderer"
] ]
}, },
"mixins": [ "mixins": [

View File

@@ -7,7 +7,11 @@
"PlayerConditionsMixin", "PlayerConditionsMixin",
"PlayerEntityMixin", "PlayerEntityMixin",
"EntityMixin", "EntityMixin",
"PowderSnowBlockMixin" "PowderSnowBlockMixin",
"IcarusHelperMixin"
],
"client": [
"client.IcarusClientMixin"
], ],
"injectors": { "injectors": {
"defaultRequire": 1 "defaultRequire": 1