i am very annoyed
This commit is contained in:
@@ -27,3 +27,6 @@
|
||||
|
||||
## 1.20.1-1.0.10
|
||||
- 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
|
||||
34
build.gradle
34
build.gradle
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id 'fabric-loom' version '1.9-SNAPSHOT'
|
||||
id 'fabric-loom' version '1.10.1'
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
@@ -46,12 +46,36 @@ repositories {
|
||||
includeGroupByRegex("software\\.bernie.*")
|
||||
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 {
|
||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||
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-api:fabric-api:${project.fabric_version}"
|
||||
@@ -60,11 +84,17 @@ dependencies {
|
||||
|
||||
modImplementation "com.github.apace100:origins-fabric:${project.origins_version}"
|
||||
modImplementation "com.github.apace100:apoli:${project.apoli_version}"
|
||||
modImplementation "com.github.apace100:calio:${project.calio_version}"
|
||||
modApi("com.github.Virtuoel:Pehkui:${pehkui_version}", {
|
||||
exclude group: "net.fabricmc.fabric-api"
|
||||
})
|
||||
modImplementation("software.bernie.geckolib:geckolib-fabric-${minecraft_version}:${geckolib_version}")
|
||||
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 {
|
||||
|
||||
@@ -6,6 +6,10 @@ minecraft_version=1.20.1
|
||||
yarn_mappings=1.20.1+build.10
|
||||
loader_version=0.16.10
|
||||
|
||||
#more mappings
|
||||
parchment_minecraft=1.20.1
|
||||
parchment_mappings=2023.09.03
|
||||
|
||||
# Mod Properties
|
||||
mod_version=1.20.1-1.0.9
|
||||
maven_group=com.smithy
|
||||
@@ -18,3 +22,7 @@ pehkui_version=3.7.8
|
||||
origins_version=v1.10.0
|
||||
apoli_version=2.9.0
|
||||
geckolib_version=4.7
|
||||
icarus_version=2.11.0
|
||||
emi_version=1.1.22+1.20.1
|
||||
calio_version=v1.11.0
|
||||
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
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
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
package com.smithy.terraoriginum;
|
||||
|
||||
import com.smithy.terraoriginum.blocks.cottonCropBlock;
|
||||
import com.smithy.terraoriginum.blocks.crucifix;
|
||||
import com.smithy.terraoriginum.blocks.CottonCropBlock;
|
||||
import com.smithy.terraoriginum.blocks.Crucifix;
|
||||
import com.smithy.terraoriginum.items.*;
|
||||
import com.smithy.terraoriginum.registry.modEnchantments;
|
||||
import com.smithy.terraoriginum.registry.modPowers;
|
||||
import com.smithy.terraoriginum.registry.ModEnchantments;
|
||||
import com.smithy.terraoriginum.registry.ModPowers;
|
||||
import com.smithy.terraoriginum.util.LootTableModifiers;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
|
||||
// import net.minecraft.item.ItemGroups;
|
||||
import net.minecraft.item.ItemGroups;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -21,24 +22,24 @@ public class TerraOriginum implements ModInitializer {
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
umbrella.registerItems();
|
||||
iconItems.register();
|
||||
modEnchantments.register();
|
||||
crucifix.register();
|
||||
cottonCropBlock.register();
|
||||
cottonItems.register();
|
||||
sunTotem.register();
|
||||
ghostlyItems.register();
|
||||
ghostlyArmourItems.register();
|
||||
modPowers.register();
|
||||
Umbrella.registerItems();
|
||||
IconItems.register();
|
||||
ModEnchantments.register();
|
||||
Crucifix.register();
|
||||
CottonCropBlock.register();
|
||||
CottonItems.register();
|
||||
SunTotem.register();
|
||||
GhostlyItems.register();
|
||||
GhostlyArmourItems.register();
|
||||
ModPowers.register();
|
||||
|
||||
LootTableModifiers.modifyLootTables();
|
||||
|
||||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register((content) -> content.add(umbrella.UMBRELLA));
|
||||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register((content) -> content.add(sunTotem.SUN_TOTEM));
|
||||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.FUNCTIONAL).register((content) -> content.add(crucifix.CRUCIFIX));
|
||||
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.TOOLS).register((content) -> content.add(Umbrella.UMBRELLA));
|
||||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register((content) -> content.add(SunTotem.SUN_TOTEM));
|
||||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.FUNCTIONAL).register((content) -> content.add(Crucifix.CRUCIFIX));
|
||||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.NATURAL).register((content) -> content.add(CottonItems.COTTON_SEEDS));
|
||||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register((content) -> content.add(CottonItems.COTTON_BALL));
|
||||
LOGGER.info("man this Origins is " + MOD_ID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
@@ -15,7 +15,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
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),
|
||||
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)
|
||||
};
|
||||
|
||||
public cottonCropBlock(AbstractBlock.Settings settings) {
|
||||
public CottonCropBlock(AbstractBlock.Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
public ItemConvertible getSeedsItem() {
|
||||
return cottonItems.COTTON_SEEDS;
|
||||
return CottonItems.COTTON_SEEDS;
|
||||
}
|
||||
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||
@@ -9,9 +9,9 @@ import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
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() {
|
||||
// Registry.register(Registries.BLOCK, new Identifier(TerraOriginum.MOD_ID, "crucifix"), new BlockItem(CRUCIFIX, new FabricItemSettings()));
|
||||
@@ -8,9 +8,9 @@ import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
package com.smithy.terraoriginum.client;
|
||||
|
||||
import com.smithy.terraoriginum.blocks.cottonCropBlock;
|
||||
import com.smithy.terraoriginum.items.umbrella;
|
||||
import com.smithy.terraoriginum.blocks.CottonCropBlock;
|
||||
import com.smithy.terraoriginum.items.Umbrella;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
|
||||
public class layerRenderer implements ClientModInitializer {
|
||||
public class LayerRenderer implements ClientModInitializer {
|
||||
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
umbrella.registerRenderLayers();
|
||||
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(), cottonCropBlock.COTTON_CROP_BLOCK);
|
||||
Umbrella.registerRenderLayers();
|
||||
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(), CottonCropBlock.COTTON_CROP_BLOCK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,23 +1,23 @@
|
||||
package com.smithy.terraoriginum.client.armour;
|
||||
|
||||
import com.smithy.terraoriginum.items.ghostlyArmour;
|
||||
import com.smithy.terraoriginum.items.GhostlyArmour;
|
||||
import net.minecraft.util.Identifier;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class ghostlyArmourModel extends GeoModel<ghostlyArmour> {
|
||||
public class GhostlyArmourModel extends GeoModel<GhostlyArmour> {
|
||||
|
||||
@Override
|
||||
public Identifier getModelResource(ghostlyArmour animatable) {
|
||||
public Identifier getModelResource(GhostlyArmour animatable) {
|
||||
return new Identifier("terraoriginum", "geo/ghostly_armour.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getTextureResource(ghostlyArmour animatable) {
|
||||
public Identifier getTextureResource(GhostlyArmour animatable) {
|
||||
return new Identifier("terraoriginum", "textures/models/armor/ghost_armour_model_texture");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getAnimationResource(ghostlyArmour animatable) {
|
||||
public Identifier getAnimationResource(GhostlyArmour animatable) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
package com.smithy.terraoriginum.client.armour;
|
||||
|
||||
import com.smithy.terraoriginum.TerraOriginum;
|
||||
import com.smithy.terraoriginum.items.ghostlyArmour;
|
||||
import com.smithy.terraoriginum.items.GhostlyArmour;
|
||||
import net.minecraft.util.Identifier;
|
||||
import software.bernie.geckolib.GeckoLib;
|
||||
import software.bernie.geckolib.model.DefaultedItemGeoModel;
|
||||
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")));
|
||||
}
|
||||
|
||||
@@ -9,11 +9,11 @@ import net.minecraft.sound.SoundEvents;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
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,
|
||||
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 int durabilityMultiplier;
|
||||
@@ -26,7 +26,7 @@ public enum robesMaterial implements ArmorMaterial {
|
||||
|
||||
private static final int[] BASE_DURABILITY = { 11, 16, 15, 13 };
|
||||
|
||||
robesMaterial(
|
||||
RobesMaterial(
|
||||
String name,
|
||||
int durabilityMultiplier,
|
||||
int[] protectionAmounts,
|
||||
@@ -1,15 +1,15 @@
|
||||
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.Item;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
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 void register() {
|
||||
@@ -1,6 +1,6 @@
|
||||
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.ObjectOpenHashSet;
|
||||
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.Supplier;
|
||||
|
||||
public class ghostlyArmour extends ArmorItem implements GeoItem {
|
||||
public class GhostlyArmour extends ArmorItem implements GeoItem {
|
||||
|
||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(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);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ghostlyArmour extends ArmorItem implements GeoItem {
|
||||
@Override
|
||||
public BipedEntityModel<LivingEntity> getHumanoidArmorModel(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, BipedEntityModel<LivingEntity> original) {
|
||||
if (this.renderer == null)
|
||||
this.renderer = new ghostlyArmourRenderer();
|
||||
this.renderer = new GhostlyArmourRenderer();
|
||||
|
||||
// This prepares our GeoArmorRenderer for the current render frame.
|
||||
// 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
|
||||
boolean isFullSet = wornArmor.containsAll(ObjectArrayList.of(
|
||||
ghostlyArmourItems.GHOSTLY_BOOTS,
|
||||
ghostlyArmourItems.GHOSTLY_LEGGING,
|
||||
ghostlyArmourItems.GHOSTLY_CHESTPLATE,
|
||||
ghostlyArmourItems.GHOSTLY_HELMET));
|
||||
GhostlyArmourItems.GHOSTLY_BOOTS,
|
||||
GhostlyArmourItems.GHOSTLY_LEGGING,
|
||||
GhostlyArmourItems.GHOSTLY_CHESTPLATE,
|
||||
GhostlyArmourItems.GHOSTLY_HELMET));
|
||||
|
||||
// Play the animation if the full set is being worn, otherwise stop
|
||||
return isFullSet ? PlayState.CONTINUE : PlayState.STOP;
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.smithy.terraoriginum.items;
|
||||
|
||||
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.itemgroup.v1.ItemGroupEvents;
|
||||
@@ -13,12 +13,12 @@ import net.minecraft.registry.Registry;
|
||||
import net.minecraft.util.Identifier;
|
||||
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_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_BOOTS = new ghostlyArmour(robesMaterial.ROBES, ArmorItem.Type.BOOTS, 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_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 void register() {
|
||||
Registry.register(Registries.ITEM, new Identifier(TerraOriginum.MOD_ID, "ghostly_helmet"), GHOSTLY_HELMET);
|
||||
@@ -8,7 +8,7 @@ import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class ghostlyItems {
|
||||
public class GhostlyItems {
|
||||
|
||||
public static final Item GHOSTLY_CLOTH = new Item(new FabricItemSettings());
|
||||
|
||||
@@ -7,7 +7,7 @@ import net.minecraft.util.Rarity;
|
||||
import net.minecraft.registry.Registries;
|
||||
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 SPIRIT = new Item(new Item.Settings().maxCount(1).rarity(Rarity.EPIC));
|
||||
@@ -7,7 +7,7 @@ import net.minecraft.registry.Registry;
|
||||
import net.minecraft.util.Identifier;
|
||||
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));
|
||||
|
||||
@@ -10,8 +10,8 @@ import net.minecraft.util.Identifier;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
|
||||
public class umbrella {
|
||||
public static final umbrellaDyeTest UMBRELLA = new umbrellaDyeTest(new FabricItemSettings().maxCount(1).maxDamage(1200));
|
||||
public class Umbrella {
|
||||
public static final UmbrellaDyeTest UMBRELLA = new UmbrellaDyeTest(new FabricItemSettings().maxCount(1).maxDamage(1200));
|
||||
|
||||
|
||||
public static void registerItems() {
|
||||
@@ -3,9 +3,9 @@ package com.smithy.terraoriginum.items;
|
||||
import net.minecraft.item.DyeableItem;
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.smithy.terraoriginum.mixin;
|
||||
|
||||
import com.smithy.terraoriginum.items.umbrella;
|
||||
import com.smithy.terraoriginum.power.preventBlockSlowness;
|
||||
import com.smithy.terraoriginum.items.Umbrella;
|
||||
import com.smithy.terraoriginum.power.PreventBlockSlowness;
|
||||
|
||||
import io.github.apace100.apoli.component.PowerHolderComponent;
|
||||
import net.minecraft.block.BlockState;
|
||||
@@ -34,14 +34,14 @@ public abstract class EntityMixin {
|
||||
private void isBeingRainedOn(CallbackInfoReturnable<Boolean> cir) {
|
||||
Iterable<ItemStack> hands = this.getHandItems();
|
||||
for (ItemStack stack : hands) {
|
||||
if (stack.getItem() == umbrella.UMBRELLA)
|
||||
if (stack.getItem() == Umbrella.UMBRELLA)
|
||||
cir.setReturnValue(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "slowMovement", at = @At("HEAD"), cancellable = true)
|
||||
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()) {
|
||||
ci.cancel();
|
||||
return;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package com.smithy.terraoriginum.mixin;
|
||||
|
||||
import io.github.apace100.apoli.power.factory.condition.EntityConditions;
|
||||
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.item.ItemStack;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -16,7 +16,7 @@ public class PlayerConditionsMixin {
|
||||
@Inject(method = { "lambda$register$10" }, at = { @At("HEAD") }, cancellable = true)
|
||||
private static void sunDamagePrevention(SerializableData.Instance data, Entity player, CallbackInfoReturnable<Boolean> cir) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public class PlayerConditionsMixin {
|
||||
@Inject(method = { "lambda$register$11" }, at = { @At("HEAD") }, cancellable = true)
|
||||
private static void umbrellaRainedOn(SerializableData.Instance data, Entity player, CallbackInfoReturnable<Boolean> cir) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.smithy.terraoriginum.mixin;
|
||||
|
||||
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.EntityType;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
@@ -37,7 +37,7 @@ public abstract class PlayerEntityMixin extends Entity {
|
||||
|
||||
if (isBeingRainedOn && this.age % 10 == 0) {
|
||||
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
|
||||
// triggered for each damage tick.
|
||||
stack.setDamage(stack.getDamage() + 1);
|
||||
@@ -58,7 +58,7 @@ public abstract class PlayerEntityMixin extends Entity {
|
||||
}
|
||||
|
||||
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);
|
||||
if (isHot) {
|
||||
// Umbrellas dry faster in hot climates.
|
||||
|
||||
@@ -8,13 +8,13 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import com.smithy.terraoriginum.power.canStandOnPowderSnow;
|
||||
import com.smithy.terraoriginum.power.CanStandOnPowderSnow;
|
||||
|
||||
@Mixin(PowderSnowBlock.class)
|
||||
public class PowderSnowBlockMixin {
|
||||
@Inject(method = "canWalkOnPowderSnow", at = @At("HEAD"), cancellable = true)
|
||||
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()) {
|
||||
cir.setReturnValue(true);
|
||||
return;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,8 @@ import io.github.apace100.apoli.power.Power;
|
||||
import io.github.apace100.apoli.power.PowerType;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
public class canStandOnPowderSnow extends Power {
|
||||
public canStandOnPowderSnow(PowerType<?> type, LivingEntity entity) {
|
||||
public class CanStandOnPowderSnow extends Power {
|
||||
public CanStandOnPowderSnow(PowerType<?> type, LivingEntity entity) {
|
||||
super(type, entity);
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,8 @@ import io.github.apace100.apoli.power.Power;
|
||||
import io.github.apace100.apoli.power.PowerType;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
public class preventBlockSlowness extends Power {
|
||||
public preventBlockSlowness(PowerType<?> type, LivingEntity entity) {
|
||||
public class PreventBlockSlowness extends Power {
|
||||
public PreventBlockSlowness(PowerType<?> type, LivingEntity entity) {
|
||||
super(type, entity);
|
||||
}
|
||||
}
|
||||
113
src/main/java/com/smithy/terraoriginum/power/WingsPower.java
Normal file
113
src/main/java/com/smithy/terraoriginum/power/WingsPower.java
Normal 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);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.Identifier;
|
||||
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});
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.smithy.terraoriginum.registry;
|
||||
|
||||
import com.smithy.terraoriginum.TerraOriginum;
|
||||
import com.smithy.terraoriginum.power.canStandOnPowderSnow;
|
||||
import com.smithy.terraoriginum.power.preventBlockSlowness;
|
||||
import com.smithy.terraoriginum.power.CanStandOnPowderSnow;
|
||||
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.registry.ApoliRegistries;
|
||||
@@ -10,15 +11,17 @@ import io.github.apace100.calio.data.SerializableData;
|
||||
import net.minecraft.registry.Registry;
|
||||
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<?> 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<?> 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<?> WINGS_POWER = WingsPower.createFactory().allowCondition();
|
||||
|
||||
|
||||
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, PREVENT_BLOCK_SLOWNESS.getSerializerId(), PREVENT_BLOCK_SLOWNESS);
|
||||
Registry.register(ApoliRegistries.POWER_FACTORY, WingsPower.POWER_TYPE_ID, WINGS_POWER);
|
||||
|
||||
}
|
||||
}
|
||||
13
src/main/java/com/smithy/terraoriginum/util/CodecHelper.java
Normal file
13
src/main/java/com/smithy/terraoriginum/util/CodecHelper.java
Normal 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);
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
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.minecraft.loot.LootPool;
|
||||
import net.minecraft.loot.condition.RandomChanceLootCondition;
|
||||
@@ -20,7 +20,7 @@ public class LootTableModifiers {
|
||||
LootPool.Builder poolBuilder = LootPool.builder()
|
||||
.rolls(ConstantLootNumberProvider.create(1))
|
||||
.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());
|
||||
|
||||
tableBuilder.pool(poolBuilder.build());
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
10
src/main/java/com/smithy/terraoriginum/util/TerraHelper.java
Normal file
10
src/main/java/com/smithy/terraoriginum/util/TerraHelper.java
Normal 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();
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,8 @@
|
||||
"terraoriginum:munch-powers/quiet",
|
||||
"terraoriginum:munch-powers/climbing",
|
||||
"terraoriginum:munch-powers/mounting",
|
||||
"terraoriginum:munch-powers/speedy_bastard"
|
||||
"terraoriginum:munch-powers/speedy_bastard",
|
||||
"terraoriginum:wings"
|
||||
],
|
||||
"icon": {
|
||||
"item": "terraoriginum:tiny"
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
"interval": 20,
|
||||
"entity_action": {
|
||||
"type": "origins:execute_command",
|
||||
"command": "/scale set pehkui:hitbox_height 0.5"
|
||||
"command": "/scale set pehkui:hitbox_height 1"
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,6 @@
|
||||
"interval": 20,
|
||||
"entity_action": {
|
||||
"type": "origins:execute_command",
|
||||
"command": "/scale set pehkui:hitbox_height 0.5"
|
||||
"command": "/scale set pehkui:hitbox_height 1"
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"type": "origins:inventory",
|
||||
"drop_on_death": false,
|
||||
"key": {
|
||||
"key": "ternary",
|
||||
"key": "key.origins.ternary_active",
|
||||
"continuous": false
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
},
|
||||
"hidden": true,
|
||||
"key": {
|
||||
"key": "key.origins.secondary_active",
|
||||
"key": "key.origins.ternary_active",
|
||||
"continuous": false
|
||||
},
|
||||
"cooldown": 0,
|
||||
|
||||
@@ -33,5 +33,5 @@
|
||||
"bypasses_armor": true
|
||||
},
|
||||
"protection_enchantment": "terraoriginum:sun_protection",
|
||||
"protection_effectiveness": 1.1
|
||||
"protection_effectiveness": 1.2
|
||||
}
|
||||
4
src/main/resources/data/terraoriginum/powers/wings.json
Normal file
4
src/main/resources/data/terraoriginum/powers/wings.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"type": "terraoriginum:wings",
|
||||
"wings_type": "icarus:white_feathered_wings"
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
],
|
||||
"client": [
|
||||
"com.smithy.terraoriginum.client.TerraKeybinds",
|
||||
"com.smithy.terraoriginum.client.layerRenderer"
|
||||
"com.smithy.terraoriginum.client.LayerRenderer"
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
|
||||
@@ -7,7 +7,11 @@
|
||||
"PlayerConditionsMixin",
|
||||
"PlayerEntityMixin",
|
||||
"EntityMixin",
|
||||
"PowderSnowBlockMixin"
|
||||
"PowderSnowBlockMixin",
|
||||
"IcarusHelperMixin"
|
||||
],
|
||||
"client": [
|
||||
"client.IcarusClientMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
||||
Reference in New Issue
Block a user