diff --git a/src/main/java/io/github/unix_supremacist/Alchemist.java b/src/main/java/io/github/unix_supremacist/Alchemist.java index 1c3169a..c51c3af 100644 --- a/src/main/java/io/github/unix_supremacist/Alchemist.java +++ b/src/main/java/io/github/unix_supremacist/Alchemist.java @@ -10,10 +10,9 @@ import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; import net.minecraft.core.Registry; import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.CreativeModeTab; -import net.minecraft.world.item.ItemStack; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.ResourceLocation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,9 +20,9 @@ public class Alchemist { public static final String MODID = "alchemist"; public static final Logger LOGGER = LoggerFactory.getLogger(MODID); public static final ResourceLocation empower_packet = new ResourceLocation(Alchemist.MODID, "empower_packet"); - public static final CreativeModeTab tab = FabricItemGroup.builder() + public static final CreativeTabs tab = FabricItemGroup.builder() .icon(() -> new ItemStack(AlchemistItems.philosophers_stone.getItem())) - .title(Component.translatable("itemGroup."+MODID)) + .title(IChatComponent.translatable("itemGroup."+MODID)) .build(); diff --git a/src/main/java/io/github/unix_supremacist/block/TransmutionCircleBlock.java b/src/main/java/io/github/unix_supremacist/block/TransmutionCircleBlock.java index 42b9c7a..8d6d8ff 100644 --- a/src/main/java/io/github/unix_supremacist/block/TransmutionCircleBlock.java +++ b/src/main/java/io/github/unix_supremacist/block/TransmutionCircleBlock.java @@ -1,17 +1,17 @@ package io.github.unix_supremacist.block; import io.github.unix_supremacist.interfaces.TransmuteEntity; -import net.minecraft.core.BlockPos; +import net.minecraft.block.Block; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.entity.npc.Villager; -import net.minecraft.world.entity.player.Player; +import net.minecraft.world.World; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; @@ -25,12 +25,12 @@ public TransmutionCircleBlock(Properties properties) { } @Override - public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + public InteractionResult use(BlockState state, World level, ChunkCoordinates pos, EntityPlayer player, InteractionHand hand, BlockHitResult hit) { if (!level.isClientSide()) { - AABB aABB = new AABB(pos); - List villagerList = level.getEntitiesOfClass(Villager.class, aABB); + AxisAlignedBB aABB = new AxisAlignedBB(pos); + List villagerList = level.getEntitiesOfClass(EntityVillager.class, aABB); if(!villagerList.isEmpty()){ - level.setBlock(pos, Blocks.AIR.defaultBlockState(), 3); + level.setBlock(pos, Blocks.air.defaultBlockState(), 3); return transmuteEntity(villagerList.get(0), level); } } @@ -39,17 +39,17 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player } @Override - public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { + public VoxelShape getShape(BlockState state, BlockGetter level, ChunkCoordinates pos, CollisionContext context) { return Shapes.box(0f, 0f, 0f, 1f, 0.02f, 1f); } @Override - public VoxelShape getCollisionShape(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos, CollisionContext collisionContext) { + public VoxelShape getCollisionShape(BlockState blockState, BlockGetter blockGetter, ChunkCoordinates blockPos, CollisionContext collisionContext) { return Shapes.empty(); } @Override - public VoxelShape getOcclusionShape(BlockState state, BlockGetter level, BlockPos pos) { + public VoxelShape getOcclusionShape(BlockState state, BlockGetter level, ChunkCoordinates pos) { return Shapes.empty(); } } diff --git a/src/main/java/io/github/unix_supremacist/content/AlchemistBlocks.java b/src/main/java/io/github/unix_supremacist/content/AlchemistBlocks.java index 25feda2..df87fb7 100644 --- a/src/main/java/io/github/unix_supremacist/content/AlchemistBlocks.java +++ b/src/main/java/io/github/unix_supremacist/content/AlchemistBlocks.java @@ -4,10 +4,10 @@ import io.github.unix_supremacist.block.TransmutionCircleBlock; import lombok.Getter; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; +import net.minecraft.block.Block; import net.minecraft.core.Registry; import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.block.Block; +import net.minecraft.util.ResourceLocation; public enum AlchemistBlocks { transmutation_circle(new TransmutionCircleBlock(FabricBlockSettings.create())); diff --git a/src/main/java/io/github/unix_supremacist/content/AlchemistItems.java b/src/main/java/io/github/unix_supremacist/content/AlchemistItems.java index 319bb28..b8e412b 100644 --- a/src/main/java/io/github/unix_supremacist/content/AlchemistItems.java +++ b/src/main/java/io/github/unix_supremacist/content/AlchemistItems.java @@ -7,12 +7,12 @@ import net.fabricmc.fabric.api.registry.FuelRegistry; import net.minecraft.core.Registry; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.Item.Properties; import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.Item.Properties; +import net.minecraft.util.ResourceLocation; import net.minecraft.world.item.Tiers; -import net.minecraft.world.level.block.Blocks; public enum AlchemistItems { alchemical_coal(25600), diff --git a/src/main/java/io/github/unix_supremacist/data/BlockTag.java b/src/main/java/io/github/unix_supremacist/data/BlockTag.java index dd1712b..90c1cff 100644 --- a/src/main/java/io/github/unix_supremacist/data/BlockTag.java +++ b/src/main/java/io/github/unix_supremacist/data/BlockTag.java @@ -3,13 +3,12 @@ import io.github.unix_supremacist.Alchemist; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; +import net.minecraft.block.Block; import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.init.Blocks; import net.minecraft.tags.TagKey; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; - +import net.minecraft.util.ResourceLocation; import java.util.ArrayList; import java.util.HashSet; import java.util.concurrent.CompletableFuture; @@ -48,16 +47,16 @@ public static void init(){ protected void addTags(HolderLookup.Provider arg) { FabricTagBuilder terra = getOrCreateTagBuilder(terratag); terra.add(Blocks.GRASS_BLOCK); - terra.add(Blocks.DIRT); + terra.add(Blocks.dirt); terra.add(Blocks.COARSE_DIRT); - terra.add(Blocks.COBBLESTONE); - terra.add(Blocks.MOSSY_COBBLESTONE); + terra.add(Blocks.cobblestone); + terra.add(Blocks.mossy_cobblestone); terra.add(Blocks.COBBLED_DEEPSLATE); - terra.add(Blocks.STONE); + terra.add(Blocks.stone); terra.add(Blocks.DEEPSLATE); - terra.add(Blocks.SAND); + terra.add(Blocks.sand); terra.add(Blocks.RED_SAND); - terra.add(Blocks.GRAVEL); + terra.add(Blocks.gravel); FabricTagBuilder wood = getOrCreateTagBuilder(woodtag); wood.add(Blocks.OAK_LOG); @@ -107,16 +106,16 @@ protected void addTags(HolderLookup.Provider arg) { stone.add(Blocks.ANDESITE); stone.add(Blocks.DIORITE); stone.add(Blocks.GRANITE); - stone.add(Blocks.SANDSTONE); + stone.add(Blocks.sandstone); stone.add(Blocks.RED_SANDSTONE); - stone.add(Blocks.CLAY); + stone.add(Blocks.clay); FabricTagBuilder obsidian = getOrCreateTagBuilder(obsidiantag); - obsidian.add(Blocks.OBSIDIAN); + obsidian.add(Blocks.obsidian); obsidian.add(Blocks.CRYING_OBSIDIAN); FabricTagBuilder stonebricks = getOrCreateTagBuilder(stonebrickstag); - stonebricks.add(Blocks.STONE_BRICKS); + stonebricks.add(Blocks.stonebrick); stonebricks.add(Blocks.MOSSY_STONE_BRICKS); } diff --git a/src/main/java/io/github/unix_supremacist/data/ItemTag.java b/src/main/java/io/github/unix_supremacist/data/ItemTag.java index 448804a..1077ddf 100644 --- a/src/main/java/io/github/unix_supremacist/data/ItemTag.java +++ b/src/main/java/io/github/unix_supremacist/data/ItemTag.java @@ -5,10 +5,9 @@ import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.item.Item; import net.minecraft.tags.TagKey; -import net.minecraft.world.item.Item; - +import net.minecraft.util.ResourceLocation; import java.util.concurrent.CompletableFuture; import static io.github.unix_supremacist.content.AlchemistItems.*; diff --git a/src/main/java/io/github/unix_supremacist/data/Language.java b/src/main/java/io/github/unix_supremacist/data/Language.java index 5c42989..080f265 100644 --- a/src/main/java/io/github/unix_supremacist/data/Language.java +++ b/src/main/java/io/github/unix_supremacist/data/Language.java @@ -7,7 +7,7 @@ import net.fabricmc.fabric.api.datagen.v1.provider.FabricLanguageProvider; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ResourceLocation; import org.apache.commons.lang3.text.WordUtils; diff --git a/src/main/java/io/github/unix_supremacist/data/Recipe.java b/src/main/java/io/github/unix_supremacist/data/Recipe.java index 3ba6769..707a9f4 100644 --- a/src/main/java/io/github/unix_supremacist/data/Recipe.java +++ b/src/main/java/io/github/unix_supremacist/data/Recipe.java @@ -5,9 +5,9 @@ import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.recipes.*; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.Items; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.util.ResourceLocation; import static io.github.unix_supremacist.content.AlchemistItems.*; @@ -30,10 +30,10 @@ public void buildRecipes(RecipeOutput recipeoutput) { .pattern("III") .pattern("ILI") .pattern("III") - .define('I', Items.IRON_INGOT) + .define('I', Items.iron_ingot) .define('L', ItemTag.lava_bucket) - .unlockedBy(RecipeProvider.getHasName(Items.IRON_INGOT), RecipeProvider.has(Items.IRON_INGOT)) - .unlockedBy(RecipeProvider.getHasName(Items.LAVA_BUCKET), RecipeProvider.has(Items.LAVA_BUCKET)) + .unlockedBy(RecipeProvider.getHasName(Items.iron_ingot), RecipeProvider.has(Items.iron_ingot)) + .unlockedBy(RecipeProvider.getHasName(Items.lava_bucket), RecipeProvider.has(Items.lava_bucket)) .save(recipeoutput); ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, catalytic_lens.getItem()) .pattern("DDD") @@ -48,11 +48,11 @@ public void buildRecipes(RecipeOutput recipeoutput) { .pattern("FRF") .pattern("ASA") .pattern("FRF") - .define('F', Items.FLINT_AND_STEEL) + .define('F', Items.flint_and_steel) .define('A', aeternalis_fuel.getItem()) .define('S', philosophers_stone.getItem()) .define('R', red_matter.getItem()) - .unlockedBy(RecipeProvider.getHasName(Items.FLINT_AND_STEEL), RecipeProvider.has(Items.FLINT_AND_STEEL)) + .unlockedBy(RecipeProvider.getHasName(Items.flint_and_steel), RecipeProvider.has(Items.flint_and_steel)) .unlockedBy(RecipeProvider.getHasName(aeternalis_fuel.getItem()), RecipeProvider.has(aeternalis_fuel.getItem())) .unlockedBy(RecipeProvider.getHasName(philosophers_stone.getItem()), RecipeProvider.has(philosophers_stone.getItem())) .unlockedBy(RecipeProvider.getHasName(red_matter.getItem()), RecipeProvider.has(red_matter.getItem())) @@ -64,7 +64,7 @@ public void buildRecipes(RecipeOutput recipeoutput) { .define('D', dark_matter.getItem()) .define('L', ItemTag.lava_bucket) .unlockedBy(RecipeProvider.getHasName(dark_matter.getItem()), RecipeProvider.has(dark_matter.getItem())) - .unlockedBy(RecipeProvider.getHasName(Items.LAVA_BUCKET), RecipeProvider.has(Items.LAVA_BUCKET)) + .unlockedBy(RecipeProvider.getHasName(Items.lava_bucket), RecipeProvider.has(Items.lava_bucket)) .save(recipeoutput); ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, evertide_amulet.getItem()) .pattern("WWW") @@ -73,23 +73,23 @@ public void buildRecipes(RecipeOutput recipeoutput) { .define('D', dark_matter.getItem()) .define('W', ItemTag.water_bucket) .unlockedBy(RecipeProvider.getHasName(dark_matter.getItem()), RecipeProvider.has(dark_matter.getItem())) - .unlockedBy(RecipeProvider.getHasName(Items.WATER_BUCKET), RecipeProvider.has(Items.WATER_BUCKET)) + .unlockedBy(RecipeProvider.getHasName(Items.water_bucket), RecipeProvider.has(Items.water_bucket)) .save(recipeoutput); ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, chalk.getItem()) .pattern("CD") .pattern("D ") .define('D', Items.DIORITE) - .define('C', Items.CLAY_BALL) + .define('C', Items.clay_ball) .unlockedBy(RecipeProvider.getHasName(Items.DIORITE), RecipeProvider.has(Items.DIORITE)) - .unlockedBy(RecipeProvider.getHasName(Items.CLAY_BALL), RecipeProvider.has(Items.CLAY_BALL)) + .unlockedBy(RecipeProvider.getHasName(Items.clay_ball), RecipeProvider.has(Items.clay_ball)) .save(recipeoutput); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.COBBLESTONE) .pattern("WPL") .define('W', ItemTag.water_bucket) .define('P', philosophers_stone.getItem()) .define('L', ItemTag.lava_bucket) - .unlockedBy(RecipeProvider.getHasName(Items.LAVA_BUCKET), RecipeProvider.has(Items.LAVA_BUCKET)) - .unlockedBy(RecipeProvider.getHasName(Items.WATER_BUCKET), RecipeProvider.has(Items.WATER_BUCKET)) + .unlockedBy(RecipeProvider.getHasName(Items.lava_bucket), RecipeProvider.has(Items.lava_bucket)) + .unlockedBy(RecipeProvider.getHasName(Items.water_bucket), RecipeProvider.has(Items.water_bucket)) .unlockedBy(RecipeProvider.getHasName(philosophers_stone.getItem()), RecipeProvider.has(philosophers_stone.getItem())) .save(recipeoutput); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.OBSIDIAN) @@ -97,8 +97,8 @@ public void buildRecipes(RecipeOutput recipeoutput) { .define('W', ItemTag.water_bucket) .define('P', philosophers_stone.getItem()) .define('L', ItemTag.lava_bucket) - .unlockedBy(RecipeProvider.getHasName(Items.LAVA_BUCKET), RecipeProvider.has(Items.LAVA_BUCKET)) - .unlockedBy(RecipeProvider.getHasName(Items.WATER_BUCKET), RecipeProvider.has(Items.WATER_BUCKET)) + .unlockedBy(RecipeProvider.getHasName(Items.lava_bucket), RecipeProvider.has(Items.lava_bucket)) + .unlockedBy(RecipeProvider.getHasName(Items.water_bucket), RecipeProvider.has(Items.water_bucket)) .unlockedBy(RecipeProvider.getHasName(philosophers_stone.getItem()), RecipeProvider.has(philosophers_stone.getItem())) .save(recipeoutput); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.STONE) @@ -106,8 +106,8 @@ public void buildRecipes(RecipeOutput recipeoutput) { .define('W', ItemTag.water_bucket) .define('P', philosophers_stone.getItem()) .define('L', ItemTag.lava_bucket) - .unlockedBy(RecipeProvider.getHasName(Items.LAVA_BUCKET), RecipeProvider.has(Items.LAVA_BUCKET)) - .unlockedBy(RecipeProvider.getHasName(Items.WATER_BUCKET), RecipeProvider.has(Items.WATER_BUCKET)) + .unlockedBy(RecipeProvider.getHasName(Items.lava_bucket), RecipeProvider.has(Items.lava_bucket)) + .unlockedBy(RecipeProvider.getHasName(Items.water_bucket), RecipeProvider.has(Items.water_bucket)) .unlockedBy(RecipeProvider.getHasName(philosophers_stone.getItem()), RecipeProvider.has(philosophers_stone.getItem())) .save(recipeoutput); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, dark_matter.getItem()) @@ -128,48 +128,48 @@ public void buildRecipes(RecipeOutput recipeoutput) { .unlockedBy(RecipeProvider.getHasName(dark_matter.getItem()), RecipeProvider.has(dark_matter.getItem())) .unlockedBy(RecipeProvider.getHasName(aeternalis_fuel.getItem()), RecipeProvider.has(aeternalis_fuel.getItem())) .save(recipeoutput); - twoWayPhilStoneRecipe(Items.COAL, Items.CHARCOAL, 1, recipeoutput); - philStoneRecipe(coal_coke.getItem(), 2, Items.COAL, 2, recipeoutput); + twoWayPhilStoneRecipe(Items.coal, Items.CHARCOAL, 1, recipeoutput); + philStoneRecipe(coal_coke.getItem(), 2, Items.coal, 2, recipeoutput); twoWayPhilStoneRecipe(alchemical_coal.getItem(), coal_coke.getItem(), 8, recipeoutput); twoWayPhilStoneRecipe(mobius_fuel.getItem(), alchemical_coal.getItem(), 8, recipeoutput); twoWayPhilStoneRecipe(aeternalis_fuel.getItem(), mobius_fuel.getItem(), 8, recipeoutput); twoWayPhilStoneRecipe(Items.COPPER_INGOT, BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:tin_ingot")), 1, recipeoutput); - twoWayPhilStoneRecipe(Items.IRON_INGOT, Items.COPPER_INGOT, 8, recipeoutput); - twoWayPhilStoneRecipe(BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:aluminum_ingot")), Items.IRON_INGOT, 2, recipeoutput); + twoWayPhilStoneRecipe(Items.iron_ingot, Items.COPPER_INGOT, 8, recipeoutput); + twoWayPhilStoneRecipe(BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:aluminum_ingot")), Items.iron_ingot, 2, recipeoutput); twoWayPhilStoneRecipe(BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:nickel_ingot")), BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:aluminum_ingot")), 2, recipeoutput); twoWayPhilStoneRecipe(BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:silver_ingot")), BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:lead_ingot")), 2, recipeoutput); - twoWayPhilStoneRecipe(Items.GOLD_INGOT, BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:silver_ingot")), 2, recipeoutput); + twoWayPhilStoneRecipe(Items.gold_ingot, BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:silver_ingot")), 2, recipeoutput); twoWayPhilStoneRecipe(BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:peridot_gem")), BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:yellow_garnet_gem")), 2, recipeoutput); twoWayPhilStoneRecipe(BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:ruby_gem")), BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:red_garnet_gem")), 2, recipeoutput); twoWayPhilStoneRecipe(BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:peridot_gem")), 6, BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:ruby_gem")), 6, recipeoutput); twoWayPhilStoneRecipe(BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:peridot_gem")), 8, BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:sapphire_gem")), 8, recipeoutput); twoWayPhilStoneRecipe(BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:ruby_gem")), 4, BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:sapphire_gem")), 4, recipeoutput); - twoWayPhilStoneRecipe(Items.DIAMOND, Items.GOLD_INGOT, 4, recipeoutput); - twoWayPhilStoneRecipe(Items.DIAMOND,2, BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:ruby_gem")), 8, recipeoutput); - twoWayPhilStoneRecipe(Items.NETHERITE_SCRAP, Items.DIAMOND, 4, recipeoutput); + twoWayPhilStoneRecipe(Items.diamond, Items.gold_ingot, 4, recipeoutput); + twoWayPhilStoneRecipe(Items.diamond,2, BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:ruby_gem")), 8, recipeoutput); + twoWayPhilStoneRecipe(Items.NETHERITE_SCRAP, Items.diamond, 4, recipeoutput); twoWayPhilStoneRecipe(BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:platinum_ingot")), BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:titanium_ingot")), 2, recipeoutput); twoWayPhilStoneRecipe(Items.NETHERITE_INGOT, BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:platinum_ingot")), 2, recipeoutput); twoWayPhilStoneRecipe(BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:tungsten_ingot")), Items.NETHERITE_INGOT, 2, recipeoutput); twoWayPhilStoneRecipe(BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:iridium_ingot")), BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:tungsten_ingot")), 2, recipeoutput); - philStoneRecipe(Items.FLINT, 3, Items.GRAVEL, 3, recipeoutput); + philStoneRecipe(Items.flint, 3, Items.GRAVEL, 3, recipeoutput); twoWayPhilStoneRecipe(Items.GRAVEL, 4, Items.COBBLESTONE, 4, recipeoutput); twoWayPhilStoneRecipe(Items.DIRT, 4, Items.SAND, 4, recipeoutput); twoWayPhilStoneRecipe(Items.GRAVEL, 8, Items.DIRT, 8, recipeoutput); twoWayPhilStoneRecipe(Items.COBBLESTONE, 8, Items.SAND, 8, recipeoutput); - twoWayPhilStoneRecipe(Items.CLAY_BALL, Items.STONE, 4, recipeoutput); + twoWayPhilStoneRecipe(Items.clay_ball, Items.STONE, 4, recipeoutput); twoWayPhilStoneRecipe(Items.RAW_COPPER, 2, BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:raw_tin")), 2, recipeoutput); twoWayPhilStoneRecipe(Items.RAW_COPPER, Items.CLAY, 4, recipeoutput); twoWayPhilStoneRecipe(Items.RAW_IRON, Items.RAW_COPPER, 8, recipeoutput); twoWayPhilStoneRecipe(BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:raw_silver")), BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:raw_lead")), 2, recipeoutput); twoWayPhilStoneRecipe(Items.RAW_GOLD, 2, BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:raw_silver")), 4, recipeoutput); twoWayPhilStoneRecipe(Items.RAW_GOLD, Items.RAW_IRON, 8, recipeoutput); - twoWayPhilStoneRecipe(Items.GUNPOWDER, Items.EMERALD, 1, recipeoutput); - twoWayPhilStoneRecipe(Items.BLAZE_ROD, Items.GUNPOWDER, 2, recipeoutput); - twoWayPhilStoneRecipe(Items.ENDER_PEARL, Items.BLAZE_ROD, 2, recipeoutput); + twoWayPhilStoneRecipe(Items.gunpowder, Items.emerald, 1, recipeoutput); + twoWayPhilStoneRecipe(Items.blaze_rod, Items.gunpowder, 2, recipeoutput); + twoWayPhilStoneRecipe(Items.ender_pearl, Items.blaze_rod, 2, recipeoutput); } diff --git a/src/main/java/io/github/unix_supremacist/interfaces/AreaBox.java b/src/main/java/io/github/unix_supremacist/interfaces/AreaBox.java index 1978182..78b5d18 100644 --- a/src/main/java/io/github/unix_supremacist/interfaces/AreaBox.java +++ b/src/main/java/io/github/unix_supremacist/interfaces/AreaBox.java @@ -1,14 +1,13 @@ package io.github.unix_supremacist.interfaces; import io.github.unix_supremacist.Alchemist; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; - import java.util.ArrayList; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.EnumFacing; public interface AreaBox { - default ArrayList getArea(Direction dir, BlockPos anchor, BlockPos negative, BlockPos positive){ - ArrayList blocks = new ArrayList<>(); + default ArrayList getArea(EnumFacing dir, ChunkCoordinates anchor, ChunkCoordinates negative, ChunkCoordinates positive){ + ArrayList blocks = new ArrayList<>(); for(int x = negative.getX(); x <= positive.getX(); x++) for (int y = negative.getY(); y <= positive.getY(); y++) @@ -17,20 +16,20 @@ default ArrayList getArea(Direction dir, BlockPos anchor, BlockPos neg return blocks; } - default ArrayList getAreaFromFacing(Direction dir, BlockPos anchor, int size, int depth){ + default ArrayList getAreaFromFacing(EnumFacing dir, ChunkCoordinates anchor, int size, int depth){ switch(dir) { case SOUTH: - return getArea(dir, anchor, new BlockPos(-size, -size, -depth), new BlockPos(size, size, 0)); + return getArea(dir, anchor, new ChunkCoordinates(-size, -size, -depth), new ChunkCoordinates(size, size, 0)); case NORTH: - return getArea(dir, anchor, new BlockPos(-size, -size, 0), new BlockPos(size, size, depth)); + return getArea(dir, anchor, new ChunkCoordinates(-size, -size, 0), new ChunkCoordinates(size, size, depth)); case EAST: - return getArea(dir, anchor, new BlockPos(-depth, -size, -size), new BlockPos(0, size, size)); + return getArea(dir, anchor, new ChunkCoordinates(-depth, -size, -size), new ChunkCoordinates(0, size, size)); case WEST: - return getArea(dir, anchor, new BlockPos(0, -size, -size), new BlockPos(depth, size, size)); + return getArea(dir, anchor, new ChunkCoordinates(0, -size, -size), new ChunkCoordinates(depth, size, size)); case UP: - return getArea(dir, anchor, new BlockPos(-size, -depth, -size), new BlockPos(size, 0, size)); + return getArea(dir, anchor, new ChunkCoordinates(-size, -depth, -size), new ChunkCoordinates(size, 0, size)); case DOWN: - return getArea(dir, anchor, new BlockPos(-size, 0, -size), new BlockPos(size, depth, size)); + return getArea(dir, anchor, new ChunkCoordinates(-size, 0, -size), new ChunkCoordinates(size, depth, size)); default: Alchemist.LOGGER.error("HOW DID YOU CLICK A DIRECTION THAT ISN'T NORTH SOUTH EAST WEST UP OR DOWN"); return null; diff --git a/src/main/java/io/github/unix_supremacist/interfaces/Destroyer.java b/src/main/java/io/github/unix_supremacist/interfaces/Destroyer.java index 0ca21a6..f7fcb65 100644 --- a/src/main/java/io/github/unix_supremacist/interfaces/Destroyer.java +++ b/src/main/java/io/github/unix_supremacist/interfaces/Destroyer.java @@ -1,27 +1,26 @@ package io.github.unix_supremacist.interfaces; -import net.minecraft.core.BlockPos; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.InteractionResult; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.Level; - +import net.minecraft.world.World; import java.util.ArrayList; public interface Destroyer { - default void destroy(Level level, BlockPos pos, LivingEntity entity){ + default void destroy(World level, ChunkCoordinates pos, EntityLivingBase entity){ if(!level.isClientSide() && !(level.getBlockState(pos).getBlock().defaultDestroyTime() < 0)){ - if (entity instanceof Player) - level.destroyBlock(pos, !((Player) entity).isCreative()); + if (entity instanceof EntityPlayer) + level.destroyBlock(pos, !((EntityPlayer) entity).isCreative()); else level.destroyBlock(pos, true); } } - default InteractionResult destroyArea(Level level, ArrayList blocks, LivingEntity entity){ + default InteractionResult destroyArea(World level, ArrayList blocks, EntityLivingBase entity){ if(!level.isClientSide()){ if(!blocks.isEmpty()){ - for (BlockPos b : blocks){ + for (ChunkCoordinates b : blocks){ destroy(level, b, entity); } return InteractionResult.SUCCESS; diff --git a/src/main/java/io/github/unix_supremacist/interfaces/DurablityBar.java b/src/main/java/io/github/unix_supremacist/interfaces/DurablityBar.java index 8105ef1..2bb1be4 100644 --- a/src/main/java/io/github/unix_supremacist/interfaces/DurablityBar.java +++ b/src/main/java/io/github/unix_supremacist/interfaces/DurablityBar.java @@ -1,10 +1,10 @@ package io.github.unix_supremacist.interfaces; -import net.minecraft.util.Mth; +import net.minecraft.util.MathHelper; public interface DurablityBar { default int getColor(int max, int current) { float f = Math.max(0.0F, ((float)max - (float)current) / (float)max); - return Mth.hsvToRgb(f / 1.1F, 1.0F, 1.0F); + return MathHelper.hsvToRgb(f / 1.1F, 1.0F, 1.0F); } } diff --git a/src/main/java/io/github/unix_supremacist/interfaces/TransmuteEntity.java b/src/main/java/io/github/unix_supremacist/interfaces/TransmuteEntity.java index 6c2c786..3a93a5a 100644 --- a/src/main/java/io/github/unix_supremacist/interfaces/TransmuteEntity.java +++ b/src/main/java/io/github/unix_supremacist/interfaces/TransmuteEntity.java @@ -1,17 +1,17 @@ package io.github.unix_supremacist.interfaces; import io.github.unix_supremacist.content.AlchemistItems; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.item.ItemStack; import net.minecraft.world.InteractionResult; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.item.ItemEntity; -import net.minecraft.world.entity.npc.Villager; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; +import net.minecraft.world.World; public interface TransmuteEntity { - default InteractionResult transmuteEntity(LivingEntity entity, Level level){ - if(entity instanceof Villager){ - level.addFreshEntity(new ItemEntity(level, entity.getPosition(0).x(), entity.getPosition(0).y(), entity.getPosition(0).z(), new ItemStack(AlchemistItems.philosophers_stone.getItem()))); + default InteractionResult transmuteEntity(EntityLivingBase entity, World level){ + if(entity instanceof EntityVillager){ + level.addFreshEntity(new EntityItem(level, entity.getPosition(0).getX(), entity.getPosition(0).getY(), entity.getPosition(0).getZ(), new ItemStack(AlchemistItems.philosophers_stone.getItem()))); entity.kill(); return InteractionResult.SUCCESS; } diff --git a/src/main/java/io/github/unix_supremacist/item/AbstractEmpowerableItem.java b/src/main/java/io/github/unix_supremacist/item/AbstractEmpowerableItem.java index 91e002a..578b397 100644 --- a/src/main/java/io/github/unix_supremacist/item/AbstractEmpowerableItem.java +++ b/src/main/java/io/github/unix_supremacist/item/AbstractEmpowerableItem.java @@ -1,11 +1,11 @@ package io.github.unix_supremacist.item; import io.github.unix_supremacist.interfaces.DurablityBar; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Rarity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; public class AbstractEmpowerableItem extends Item implements DurablityBar { protected final int maxPower; @@ -25,25 +25,25 @@ public boolean isBarVisible(ItemStack item) { } public int getPower(ItemStack item){ - if (item.getTag() != null){ - return item.getTag().getInt("alchemist.empowered"); + if (item.getTagCompound() != null){ + return item.getTagCompound().getInteger("alchemist.empowered"); } else { - item.setTag(new CompoundTag()); + item.setTagCompound(new NBTTagCompound()); return 0; } } public void setPower(ItemStack item, int i){ - if (item.getTag() != null){ - item.getTag().putInt("alchemist.empowered", i); + if (item.getTagCompound() != null){ + item.getTagCompound().setInteger("alchemist.empowered", i); } else { - CompoundTag tag = new CompoundTag(); - tag.putInt("alchemist.empowered", i); - item.setTag(tag); + NBTTagCompound tag = new NBTTagCompound(); + tag.setInteger("alchemist.empowered", i); + item.setTagCompound(tag); } } - public void empower(ItemStack item, Player p){ + public void empower(ItemStack item, EntityPlayer p){ if(isBarVisible(item)) setPower(item, getPower(item)-1); else @@ -56,7 +56,7 @@ public int getBarWidth(ItemStack item) { } @Override - public Rarity getRarity(ItemStack s){ - return Rarity.EPIC; + public EnumRarity getRarity(ItemStack s){ + return EnumRarity.EPIC; } } diff --git a/src/main/java/io/github/unix_supremacist/item/AlchemistBlockItem.java b/src/main/java/io/github/unix_supremacist/item/AlchemistBlockItem.java index 0246cd8..34af9c0 100644 --- a/src/main/java/io/github/unix_supremacist/item/AlchemistBlockItem.java +++ b/src/main/java/io/github/unix_supremacist/item/AlchemistBlockItem.java @@ -1,15 +1,14 @@ package io.github.unix_supremacist.item; import io.github.unix_supremacist.interfaces.DurablityBar; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.ItemStack; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Rarity; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.item.context.UseOnContext; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; import static io.github.unix_supremacist.content.AlchemistItems.chalk; @@ -23,7 +22,7 @@ public InteractionResult useOn(UseOnContext context) { InteractionResult interactionResult; ItemStack item = context.getItemInHand(); if(context.getLevel().getBlockState(context.getClickedPos().relative(context.getClickedFace())) == Blocks.LAVA.defaultBlockState() && item.getDamageValue() < this.getMaxDamage()){ - context.getLevel().setBlock(context.getClickedPos().relative(context.getClickedFace()), Blocks.AIR.defaultBlockState(), 0); + context.getLevel().setBlock(context.getClickedPos().relative(context.getClickedFace()), Blocks.air.defaultBlockState(), 0); context.getItemInHand().setDamageValue(item.getDamageValue()+1); interactionResult = InteractionResult.SUCCESS; } else { @@ -58,7 +57,7 @@ public boolean isValidRepairItem(ItemStack itemStack2, ItemStack itemStack) { }*/ @Override - public Rarity getRarity(ItemStack s){ - return s.getItem()==chalk.getItem() ? Rarity.COMMON : Rarity.EPIC; + public EnumRarity getRarity(ItemStack s){ + return s.getItem()==chalk.getItem() ? EnumRarity.COMMON : EnumRarity.EPIC; } } diff --git a/src/main/java/io/github/unix_supremacist/item/AlchemistDiggerItem.java b/src/main/java/io/github/unix_supremacist/item/AlchemistDiggerItem.java index 58af05f..f309c73 100644 --- a/src/main/java/io/github/unix_supremacist/item/AlchemistDiggerItem.java +++ b/src/main/java/io/github/unix_supremacist/item/AlchemistDiggerItem.java @@ -3,19 +3,17 @@ import io.github.unix_supremacist.interfaces.AreaBox; import io.github.unix_supremacist.interfaces.Destroyer; import io.github.unix_supremacist.interfaces.DurablityBar; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; +import net.minecraft.block.Block; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.ItemStack; import net.minecraft.tags.TagKey; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.item.DiggerItem; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Rarity; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; import net.minecraft.world.item.Tier; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.phys.Vec3; - import java.util.ArrayList; public class AlchemistDiggerItem extends DiggerItem implements AreaBox, Destroyer, DurablityBar { @@ -24,9 +22,9 @@ public AlchemistDiggerItem(float f, float g, Tier tier, TagKey tagKey, Pr } @Override - public boolean mineBlock(ItemStack itemStack, Level level, BlockState state, BlockPos pos, LivingEntity entity) { - Vec3 look = entity.getLookAngle(); - ArrayList blocks = getAreaFromFacing(Direction.getNearest(look.x(), look.y(), look.z()), pos, 1, 0); + public boolean mineBlock(ItemStack itemStack, World level, BlockState state, ChunkCoordinates pos, EntityLivingBase entity) { + Vec3 look = entity.getLookVec(); + ArrayList blocks = getAreaFromFacing(EnumFacing.getNearest(look.getX(), look.getY(), look.getZ()), pos, 1, 0); destroyArea(level, blocks, entity); return super.mineBlock(itemStack, level, state, pos, entity); } @@ -37,7 +35,7 @@ public int getBarColor(ItemStack item) { } @Override - public Rarity getRarity(ItemStack s){ - return Rarity.EPIC; + public EnumRarity getRarity(ItemStack s){ + return EnumRarity.EPIC; } } diff --git a/src/main/java/io/github/unix_supremacist/item/AlchemistHammerItem.java b/src/main/java/io/github/unix_supremacist/item/AlchemistHammerItem.java index 2f9a6d4..a70d837 100644 --- a/src/main/java/io/github/unix_supremacist/item/AlchemistHammerItem.java +++ b/src/main/java/io/github/unix_supremacist/item/AlchemistHammerItem.java @@ -2,16 +2,15 @@ import io.github.unix_supremacist.interfaces.AreaBox; import io.github.unix_supremacist.interfaces.Destroyer; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; import net.minecraft.tags.BlockTags; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.item.ItemStack; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; import net.minecraft.world.item.Tier; -import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.phys.Vec3; - import java.util.ArrayList; public class AlchemistHammerItem extends AlchemistDiggerItem implements AreaBox, Destroyer { @@ -21,10 +20,10 @@ public AlchemistHammerItem(Tier tier, int i, float f, Properties properties) { } @Override - public boolean mineBlock(ItemStack itemStack, Level level, BlockState state, BlockPos pos, LivingEntity entity) { - Vec3 look = entity.getLookAngle(); - Direction dir = Direction.getNearest(look.x(), look.y(), look.z()); - ArrayList blocks = getAreaFromFacing(dir, pos, 1, 0); + public boolean mineBlock(ItemStack itemStack, World level, BlockState state, ChunkCoordinates pos, EntityLivingBase entity) { + Vec3 look = entity.getLookVec(); + EnumFacing dir = EnumFacing.getNearest(look.getX(), look.getY(), look.getZ()); + ArrayList blocks = getAreaFromFacing(dir, pos, 1, 0); destroyArea(level, blocks, entity); return super.mineBlock(itemStack, level, state, pos, entity); } diff --git a/src/main/java/io/github/unix_supremacist/item/DestructionItem.java b/src/main/java/io/github/unix_supremacist/item/DestructionItem.java index 36df38d..39c44fc 100644 --- a/src/main/java/io/github/unix_supremacist/item/DestructionItem.java +++ b/src/main/java/io/github/unix_supremacist/item/DestructionItem.java @@ -2,11 +2,11 @@ import io.github.unix_supremacist.interfaces.AreaBox; import io.github.unix_supremacist.interfaces.Destroyer; -import net.minecraft.core.BlockPos; -import net.minecraft.network.chat.Component; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.IChatComponent; import net.minecraft.world.InteractionResult; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.UseOnContext; import java.util.ArrayList; @@ -31,14 +31,14 @@ public DestructionItem(Properties properties, int maxWidth, int maxDepth, int mu } @Override - public void empower(ItemStack item, Player p){ + public void empower(ItemStack item, EntityPlayer p){ super.empower(item, p); - p.displayClientMessage(Component.literal("Width: "+((maxWidth-1)*2-MODES[getPower(item)*2]*2+1)+" and Depth: "+((maxDepth-1-MODES[getPower(item)*2+1])*mult+1)), true); + p.displayClientMessage(IChatComponent.literal("Width: "+((maxWidth-1)*2-MODES[getPower(item)*2]*2+1)+" and Depth: "+((maxDepth-1-MODES[getPower(item)*2+1])*mult+1)), true); } @Override public InteractionResult useOn(UseOnContext context) { - ArrayList blocks = getAreaFromFacing(context.getClickedFace(), context.getClickedPos(), maxWidth-1-MODES[getPower(context.getItemInHand())*2], (maxDepth-1-MODES[getPower(context.getItemInHand())*2+1])*mult); + ArrayList blocks = getAreaFromFacing(context.getClickedFace(), context.getClickedPos(), maxWidth-1-MODES[getPower(context.getItemInHand())*2], (maxDepth-1-MODES[getPower(context.getItemInHand())*2+1])*mult); return destroyArea(context.getLevel(), blocks, context.getPlayer()); } } diff --git a/src/main/java/io/github/unix_supremacist/item/GaleItem.java b/src/main/java/io/github/unix_supremacist/item/GaleItem.java index 5981d51..617e493 100644 --- a/src/main/java/io/github/unix_supremacist/item/GaleItem.java +++ b/src/main/java/io/github/unix_supremacist/item/GaleItem.java @@ -6,10 +6,10 @@ import io.github.ladysnake.pal.Pal; import io.github.ladysnake.pal.VanillaAbilities; import io.github.unix_supremacist.Alchemist; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Rarity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.ItemStack; public class GaleItem extends TrinketItem { public GaleItem(Properties properties) { @@ -18,21 +18,21 @@ public GaleItem(Properties properties) { public static final AbilitySource gale_ability = Pal.getAbilitySource(Alchemist.MODID, "swiftwolfs_rending_gale"); @Override - public void onEquip(ItemStack stack, SlotReference slot, LivingEntity entity) { + public void onEquip(ItemStack stack, SlotReference slot, EntityLivingBase entity) { if (!entity.level().isClientSide()) - if (entity instanceof Player) - gale_ability.grantTo((Player) entity, VanillaAbilities.ALLOW_FLYING); + if (entity instanceof EntityPlayer) + gale_ability.grantTo((EntityPlayer) entity, VanillaAbilities.ALLOW_FLYING); } @Override - public void onUnequip(ItemStack stack, SlotReference slot, LivingEntity entity) { + public void onUnequip(ItemStack stack, SlotReference slot, EntityLivingBase entity) { if (!entity.level().isClientSide()) - if (entity instanceof Player) - gale_ability.revokeFrom((Player) entity, VanillaAbilities.ALLOW_FLYING); + if (entity instanceof EntityPlayer) + gale_ability.revokeFrom((EntityPlayer) entity, VanillaAbilities.ALLOW_FLYING); } @Override - public Rarity getRarity(ItemStack s){ - return Rarity.EPIC; + public EnumRarity getRarity(ItemStack s){ + return EnumRarity.EPIC; } } diff --git a/src/main/java/io/github/unix_supremacist/item/PhilosophersStoneItem.java b/src/main/java/io/github/unix_supremacist/item/PhilosophersStoneItem.java index eb41815..5283600 100644 --- a/src/main/java/io/github/unix_supremacist/item/PhilosophersStoneItem.java +++ b/src/main/java/io/github/unix_supremacist/item/PhilosophersStoneItem.java @@ -3,15 +3,14 @@ import io.github.unix_supremacist.data.BlockTag; import io.github.unix_supremacist.interfaces.AreaBox; import io.github.unix_supremacist.interfaces.TransmuteEntity; -import net.minecraft.core.BlockPos; +import net.minecraft.block.Block; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.UseOnContext; -import net.minecraft.world.level.block.Block; - import java.util.ArrayList; public class PhilosophersStoneItem extends AbstractEmpowerableItem implements AreaBox, TransmuteEntity { @@ -21,7 +20,7 @@ public PhilosophersStoneItem(Properties properties) { @Override public InteractionResult useOn(UseOnContext context) { - ArrayList blocks = getAreaFromFacing(context.getClickedFace(), context.getClickedPos(), 2 - getPower(context.getItemInHand()), 0); + ArrayList blocks = getAreaFromFacing(context.getClickedFace(), context.getClickedPos(), 2 - getPower(context.getItemInHand()), 0); ArrayList exchange = new ArrayList<>(); InteractionResult result = InteractionResult.PASS; for (ArrayList e : BlockTag.exchanges){ @@ -32,11 +31,11 @@ public InteractionResult useOn(UseOnContext context) { } } if(!blocks.isEmpty()){ - if (!context.getLevel().isClientSide()) for (BlockPos b : blocks){ + if (!context.getLevel().isClientSide()) for (ChunkCoordinates b : blocks){ Block block = context.getLevel().getBlockState(b).getBlock(); if (exchange.contains(block)) { Block newBlock; - if(context.getPlayer().isShiftKeyDown()) + if(context.getPlayer().isSneaking()) newBlock = BlockTag.getBlockWithOffset(block, exchange,-1); else newBlock = BlockTag.getBlockWithOffset(block, exchange,+1); @@ -50,7 +49,7 @@ public InteractionResult useOn(UseOnContext context) { return result; } - public InteractionResult interactLivingEntity(ItemStack stack, Player player, LivingEntity entity, InteractionHand hand) { + public InteractionResult interactLivingEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity, InteractionHand hand) { return transmuteEntity(entity, player.level()); }