From edb92ecae259c1aee43a2b28a6b810163e3992c0 Mon Sep 17 00:00:00 2001 From: Starexify Date: Thu, 31 Oct 2024 00:47:49 +0100 Subject: [PATCH] 1.0.0 --- .../nmt/block/EnderBrewingStandBlock.java | 6 ++-- .../EnderBrewingStandBlockEntity.java | 5 ++- .../nova/nmt/data/recipe/CraftingRecipes.java | 1 - .../data/worldgen/NMTConfiguredFeature.java | 2 -- .../nmt/data/worldgen/NMTPlacedFeatures.java | 7 ----- .../projectile/ThrownObsidianPotion.java | 1 - .../java/net/nova/nmt/event/NMTEventBus.java | 3 +- .../EnderBrewingStandMenu.java | 10 ++---- .../java/net/nova/nmt/init/CreativeTab.java | 31 +++++-------------- .../java/net/nova/nmt/init/NMTBlocks.java | 12 ++----- .../nova/nmt/recipe/EnderPotionBrewing.java | 2 +- 11 files changed, 21 insertions(+), 59 deletions(-) diff --git a/src/main/java/net/nova/nmt/block/EnderBrewingStandBlock.java b/src/main/java/net/nova/nmt/block/EnderBrewingStandBlock.java index ef68dd4..1f250db 100644 --- a/src/main/java/net/nova/nmt/block/EnderBrewingStandBlock.java +++ b/src/main/java/net/nova/nmt/block/EnderBrewingStandBlock.java @@ -49,9 +49,9 @@ public EnderBrewingStandBlock(Properties properties) { this.registerDefaultState( this.stateDefinition .any() - .setValue(HAS_BOTTLE[0], Boolean.valueOf(false)) - .setValue(HAS_BOTTLE[1], Boolean.valueOf(false)) - .setValue(HAS_BOTTLE[2], Boolean.valueOf(false)) + .setValue(HAS_BOTTLE[0], Boolean.FALSE) + .setValue(HAS_BOTTLE[1], Boolean.FALSE) + .setValue(HAS_BOTTLE[2], Boolean.FALSE) ); } diff --git a/src/main/java/net/nova/nmt/blockentity/EnderBrewingStandBlockEntity.java b/src/main/java/net/nova/nmt/blockentity/EnderBrewingStandBlockEntity.java index e4f7e7c..9551104 100644 --- a/src/main/java/net/nova/nmt/blockentity/EnderBrewingStandBlockEntity.java +++ b/src/main/java/net/nova/nmt/blockentity/EnderBrewingStandBlockEntity.java @@ -18,7 +18,6 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BaseContainerBlockEntity; import net.minecraft.world.level.block.state.BlockState; -import net.neoforged.neoforge.event.EventHooks; import net.nova.nmt.NoMoreThings; import net.nova.nmt.block.EnderBrewingStandBlock; import net.nova.nmt.gui.ender_brewing_stand.EnderBrewingStandMenu; @@ -100,7 +99,7 @@ protected void setItems(NonNullList items) { public static void serverTick(Level level, BlockPos pos, BlockState state, EnderBrewingStandBlockEntity blockEntity) { ItemStack itemstack = blockEntity.items.get(4); if (blockEntity.fuel <= 0 && itemstack.is(Items.WIND_CHARGE)) { - blockEntity.fuel = 20; + blockEntity.fuel = FUEL_USES; itemstack.shrink(1); setChanged(level, pos, state); } @@ -185,7 +184,7 @@ private static void doBrew(Level level, BlockPos pos, NonNullList ite if (itemstack.isEmpty()) { itemstack = itemstack1; } else { - Containers.dropItemStack(level, (double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), itemstack1); + Containers.dropItemStack(level, pos.getX(), pos.getY(), pos.getZ(), itemstack1); } } else itemstack.shrink(1); diff --git a/src/main/java/net/nova/nmt/data/recipe/CraftingRecipes.java b/src/main/java/net/nova/nmt/data/recipe/CraftingRecipes.java index ef09d2e..7b13211 100644 --- a/src/main/java/net/nova/nmt/data/recipe/CraftingRecipes.java +++ b/src/main/java/net/nova/nmt/data/recipe/CraftingRecipes.java @@ -6,7 +6,6 @@ import net.minecraft.data.recipes.RecipeOutput; import net.minecraft.data.recipes.ShapedRecipeBuilder; import net.minecraft.world.item.Items; -import net.minecraft.world.level.block.Blocks; import net.neoforged.neoforge.common.Tags; import net.nova.nmt.init.NMTBlocks; import net.nova.nmt.init.NMTItems; diff --git a/src/main/java/net/nova/nmt/data/worldgen/NMTConfiguredFeature.java b/src/main/java/net/nova/nmt/data/worldgen/NMTConfiguredFeature.java index c7a11f9..1395cb2 100644 --- a/src/main/java/net/nova/nmt/data/worldgen/NMTConfiguredFeature.java +++ b/src/main/java/net/nova/nmt/data/worldgen/NMTConfiguredFeature.java @@ -6,12 +6,10 @@ import net.minecraft.data.worldgen.BootstrapContext; import net.minecraft.resources.ResourceKey; import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration; import net.nova.nmt.NoMoreThings; -import net.nova.nmt.init.NMTBlocks; import net.nova.nmt.init.NMTFeature; import net.nova.nmt.world.features.configurations.StructureFeatureConfiguration; diff --git a/src/main/java/net/nova/nmt/data/worldgen/NMTPlacedFeatures.java b/src/main/java/net/nova/nmt/data/worldgen/NMTPlacedFeatures.java index 530d28f..c4a35ec 100644 --- a/src/main/java/net/nova/nmt/data/worldgen/NMTPlacedFeatures.java +++ b/src/main/java/net/nova/nmt/data/worldgen/NMTPlacedFeatures.java @@ -2,18 +2,11 @@ import net.minecraft.core.Holder; import net.minecraft.core.HolderGetter; -import net.minecraft.core.Vec3i; import net.minecraft.core.registries.Registries; import net.minecraft.data.worldgen.BootstrapContext; import net.minecraft.data.worldgen.placement.PlacementUtils; import net.minecraft.resources.ResourceKey; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.levelgen.Heightmap; -import net.minecraft.world.level.levelgen.VerticalAnchor; -import net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; -import net.minecraft.world.level.levelgen.heightproviders.HeightProvider; -import net.minecraft.world.level.levelgen.heightproviders.UniformHeight; import net.minecraft.world.level.levelgen.placement.*; import net.nova.nmt.NoMoreThings; diff --git a/src/main/java/net/nova/nmt/entity/projectile/ThrownObsidianPotion.java b/src/main/java/net/nova/nmt/entity/projectile/ThrownObsidianPotion.java index 4513ef6..2eb9422 100644 --- a/src/main/java/net/nova/nmt/entity/projectile/ThrownObsidianPotion.java +++ b/src/main/java/net/nova/nmt/entity/projectile/ThrownObsidianPotion.java @@ -12,7 +12,6 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.alchemy.PotionContents; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Blocks; import net.minecraft.world.phys.HitResult; import net.nova.nmt.init.NMTItems; import net.nova.nmt.init.NMTPotions; diff --git a/src/main/java/net/nova/nmt/event/NMTEventBus.java b/src/main/java/net/nova/nmt/event/NMTEventBus.java index 4584aa8..9366b07 100644 --- a/src/main/java/net/nova/nmt/event/NMTEventBus.java +++ b/src/main/java/net/nova/nmt/event/NMTEventBus.java @@ -23,7 +23,6 @@ import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.common.EventBusSubscriber; import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; -import net.neoforged.neoforge.registries.datamaps.builtin.Compostable; import net.nova.nmt.init.NMTItems; import net.nova.nmt.init.NMTPotions; @@ -75,7 +74,7 @@ public ItemStack execute(BlockSource blockSource, ItemStack item) { serverlevel.sendParticles( ParticleTypes.LAVA, (double) blockpos.getX() + serverlevel.random.nextDouble(), - (double) (blockpos.getY() + 1), + blockpos.getY() + 1, (double) blockpos.getZ() + serverlevel.random.nextDouble(), 1, 0.0, diff --git a/src/main/java/net/nova/nmt/gui/ender_brewing_stand/EnderBrewingStandMenu.java b/src/main/java/net/nova/nmt/gui/ender_brewing_stand/EnderBrewingStandMenu.java index 8411ea9..80f9c22 100644 --- a/src/main/java/net/nova/nmt/gui/ender_brewing_stand/EnderBrewingStandMenu.java +++ b/src/main/java/net/nova/nmt/gui/ender_brewing_stand/EnderBrewingStandMenu.java @@ -66,7 +66,7 @@ public boolean stillValid(Player player) { public ItemStack quickMoveStack(Player player, int index) { ItemStack itemstack = ItemStack.EMPTY; Slot slot = this.slots.get(index); - if (slot != null && slot.hasItem()) { + if (slot.hasItem()) { ItemStack itemstack1 = slot.getItem(); itemstack = itemstack1.copy(); if ((index < 0 || index > 2) && index != 3 && index != 4) { @@ -158,12 +158,8 @@ public boolean mayPlace(ItemStack stack) { static class PotionSlot extends Slot { private final EnderPotionBrewing potionBrewing; - public PotionSlot(Container container, int slot, int x, int y) { - this(EnderPotionBrewing.EMPTY, container, slot, x, y); - } - - public PotionSlot(EnderPotionBrewing potionBrewing, Container p_39123_, int p_39124_, int p_39125_, int p_39126_) { - super(p_39123_, p_39124_, p_39125_, p_39126_); + public PotionSlot(EnderPotionBrewing potionBrewing, Container container, int p_39124_, int p_39125_, int p_39126_) { + super(container, p_39124_, p_39125_, p_39126_); this.potionBrewing = potionBrewing; } diff --git a/src/main/java/net/nova/nmt/init/CreativeTab.java b/src/main/java/net/nova/nmt/init/CreativeTab.java index 7c0533c..e63e182 100644 --- a/src/main/java/net/nova/nmt/init/CreativeTab.java +++ b/src/main/java/net/nova/nmt/init/CreativeTab.java @@ -1,14 +1,11 @@ package net.nova.nmt.init; import net.minecraft.core.Holder; -import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; -import net.minecraft.world.flag.FeatureFlagSet; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; import net.minecraft.world.item.alchemy.Potion; import net.minecraft.world.item.alchemy.PotionContents; import net.neoforged.neoforge.registries.DeferredRegister; @@ -40,29 +37,17 @@ public class CreativeTab { // Obsidian Glass Bottle output.accept(NMTItems.OBSIDIAN_GLASS_BOTTLE); /// Obsidian Pots - itemDisplayParameters.holders() - .lookup(Registries.POTION) - .ifPresent( - builder -> { - generatePotionEffectTypes( - output, NMTItems.OBSIDIAN_POTION.get(), CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS - ); - generatePotionEffectTypes( - output, - NMTItems.SPLASH_OBSIDIAN_POTION.get(), - CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS - ); - generatePotionEffectTypes( - output, - NMTItems.LINGERING_OBSIDIAN_POTION.get(), - CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS - ); - }); + itemDisplayParameters.holders().lookup(Registries.POTION) + .ifPresent(builder -> { + generatePotionEffectTypes(output, NMTItems.OBSIDIAN_POTION.get()); + generatePotionEffectTypes(output, NMTItems.SPLASH_OBSIDIAN_POTION.get()); + generatePotionEffectTypes(output, NMTItems.LINGERING_OBSIDIAN_POTION.get()); + }); }).build() ); - private static void generatePotionEffectTypes(CreativeModeTab.Output output, Item item, CreativeModeTab.TabVisibility tabVisibility) { + private static void generatePotionEffectTypes(CreativeModeTab.Output output, Item item) { List> nmtPotions = Arrays.asList( NMTPotions.LAVA, NMTPotions.AWFULLY @@ -70,6 +55,6 @@ private static void generatePotionEffectTypes(CreativeModeTab.Output output, Ite nmtPotions.stream() .map(potion -> PotionContents.createItemStack(item, potion)) - .forEach(itemStack -> output.accept(itemStack, tabVisibility)); + .forEach(itemStack -> output.accept(itemStack, CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS)); } } \ No newline at end of file diff --git a/src/main/java/net/nova/nmt/init/NMTBlocks.java b/src/main/java/net/nova/nmt/init/NMTBlocks.java index c193c1e..96fb5e7 100644 --- a/src/main/java/net/nova/nmt/init/NMTBlocks.java +++ b/src/main/java/net/nova/nmt/init/NMTBlocks.java @@ -13,7 +13,6 @@ import net.minecraft.world.level.material.MapColor; import net.minecraft.world.level.material.PushReaction; import net.neoforged.neoforge.registries.DeferredBlock; -import net.neoforged.neoforge.registries.DeferredItem; import net.neoforged.neoforge.registries.DeferredRegister; import net.nova.nmt.block.EnderBrewingStandBlock; import net.nova.nmt.block.EnderWartCrop; @@ -56,7 +55,7 @@ public class NMTBlocks { )); // Ender Wart - public static final DeferredBlock ENDER_WART = registerCrop("ender_wart", () -> new EnderWartCrop(BlockBehaviour.Properties.of() + public static final DeferredBlock ENDER_WART = BLOCKS.register("ender_wart", () -> new EnderWartCrop(BlockBehaviour.Properties.of() .mapColor(MapColor.COLOR_PURPLE) .noCollission() .randomTicks() @@ -78,18 +77,13 @@ public static Boolean never(BlockState state, BlockGetter blockGetter, BlockPos } // Registers - public static DeferredBlock registerCrop(String name, Supplier block) { - DeferredBlock toReturn = BLOCKS.register(name, block); - return toReturn; - } - public static DeferredBlock registerBlock(String name, Supplier block) { DeferredBlock toReturn = BLOCKS.register(name, block); registerBlockItems(name, toReturn); return toReturn; } - public static DeferredItem registerBlockItems(String name, DeferredBlock block) { - return NMTItems.ITEMS.register(name, () -> new BlockItem(block.get(), new Item.Properties())); + public static void registerBlockItems(String name, DeferredBlock block) { + NMTItems.ITEMS.register(name, () -> new BlockItem(block.get(), new Item.Properties())); } } diff --git a/src/main/java/net/nova/nmt/recipe/EnderPotionBrewing.java b/src/main/java/net/nova/nmt/recipe/EnderPotionBrewing.java index d662697..70fcfec 100644 --- a/src/main/java/net/nova/nmt/recipe/EnderPotionBrewing.java +++ b/src/main/java/net/nova/nmt/recipe/EnderPotionBrewing.java @@ -209,7 +209,7 @@ public EnderPotionBrewing build() { } } - static record Mix(Holder from, Ingredient ingredient, Holder to, boolean preserveEffect) { + record Mix(Holder from, Ingredient ingredient, Holder to, boolean preserveEffect) { public Mix(Holder from, Ingredient ingredient, Holder to) { this(from, ingredient, to, false); }