Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Starexify committed Oct 30, 2024
1 parent 70813b8 commit edb92ec
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 59 deletions.
6 changes: 3 additions & 3 deletions src/main/java/net/nova/nmt/block/EnderBrewingStandBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -100,7 +99,7 @@ protected void setItems(NonNullList<ItemStack> 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);
}
Expand Down Expand Up @@ -185,7 +184,7 @@ private static void doBrew(Level level, BlockPos pos, NonNullList<ItemStack> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/net/nova/nmt/event/NMTEventBus.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}

Expand Down
31 changes: 8 additions & 23 deletions src/main/java/net/nova/nmt/init/CreativeTab.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -40,36 +37,24 @@ 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<Holder<Potion>> nmtPotions = Arrays.asList(
NMTPotions.LAVA,
NMTPotions.AWFULLY
);

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));
}
}
12 changes: 3 additions & 9 deletions src/main/java/net/nova/nmt/init/NMTBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -56,7 +55,7 @@ public class NMTBlocks {
));

// Ender Wart
public static final DeferredBlock<Block> ENDER_WART = registerCrop("ender_wart", () -> new EnderWartCrop(BlockBehaviour.Properties.of()
public static final DeferredBlock<Block> ENDER_WART = BLOCKS.register("ender_wart", () -> new EnderWartCrop(BlockBehaviour.Properties.of()
.mapColor(MapColor.COLOR_PURPLE)
.noCollission()
.randomTicks()
Expand All @@ -78,18 +77,13 @@ public static Boolean never(BlockState state, BlockGetter blockGetter, BlockPos
}

// Registers
public static <T extends Block> DeferredBlock<T> registerCrop(String name, Supplier<T> block) {
DeferredBlock<T> toReturn = BLOCKS.register(name, block);
return toReturn;
}

public static <T extends Block> DeferredBlock<T> registerBlock(String name, Supplier<T> block) {
DeferredBlock<T> toReturn = BLOCKS.register(name, block);
registerBlockItems(name, toReturn);
return toReturn;
}

public static <T extends Block> DeferredItem<Item> registerBlockItems(String name, DeferredBlock<T> block) {
return NMTItems.ITEMS.register(name, () -> new BlockItem(block.get(), new Item.Properties()));
public static <T extends Block> void registerBlockItems(String name, DeferredBlock<T> block) {
NMTItems.ITEMS.register(name, () -> new BlockItem(block.get(), new Item.Properties()));
}
}
2 changes: 1 addition & 1 deletion src/main/java/net/nova/nmt/recipe/EnderPotionBrewing.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public EnderPotionBrewing build() {
}
}

static record Mix<T>(Holder<T> from, Ingredient ingredient, Holder<T> to, boolean preserveEffect) {
record Mix<T>(Holder<T> from, Ingredient ingredient, Holder<T> to, boolean preserveEffect) {
public Mix(Holder<T> from, Ingredient ingredient, Holder<T> to) {
this(from, ingredient, to, false);
}
Expand Down

0 comments on commit edb92ec

Please sign in to comment.