diff --git a/src/main/java/ml/pluto7073/plutoscoffee/blocks/CoffeeMachineBlock.java b/src/main/java/ml/pluto7073/plutoscoffee/blocks/CoffeeMachineBlock.java deleted file mode 100644 index 8962936..0000000 --- a/src/main/java/ml/pluto7073/plutoscoffee/blocks/CoffeeMachineBlock.java +++ /dev/null @@ -1,33 +0,0 @@ -package ml.pluto7073.plutoscoffee.blocks; - -import ml.pluto7073.plutoscoffee.registry.ModStats; -import net.minecraft.block.AbstractFurnaceBlock; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.screen.NamedScreenHandlerFactory; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import org.jetbrains.annotations.Nullable; - -public class CoffeeMachineBlock extends AbstractFurnaceBlock { - - public CoffeeMachineBlock(Settings settings) { - super(settings); - } - - @Override - protected void openScreen(World world, BlockPos pos, PlayerEntity player) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity instanceof CoffeeMachineBlockEntity) { - player.openHandledScreen((NamedScreenHandlerFactory) blockEntity); - player.incrementStat(ModStats.INTERACT_WITH_COFFEE_MACHINE); - } - } - - @Nullable - @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { - return new CoffeeMachineBlockEntity(); - } -} diff --git a/src/main/java/ml/pluto7073/plutoscoffee/blocks/CoffeeMachineBlockEntity.java b/src/main/java/ml/pluto7073/plutoscoffee/blocks/CoffeeMachineBlockEntity.java deleted file mode 100644 index e242540..0000000 --- a/src/main/java/ml/pluto7073/plutoscoffee/blocks/CoffeeMachineBlockEntity.java +++ /dev/null @@ -1,25 +0,0 @@ -package ml.pluto7073.plutoscoffee.blocks; - -import ml.pluto7073.plutoscoffee.recipes.CoffeeBrewingRecipe; -import net.minecraft.block.entity.AbstractFurnaceBlockEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.text.Text; -import net.minecraft.text.TranslatableText; - -public class CoffeeMachineBlockEntity extends AbstractFurnaceBlockEntity { - - public CoffeeMachineBlockEntity() { - super(CoffeeBrewingRecipe.COFFEE_MACHINE_BLOCK_ENTITY, CoffeeBrewingRecipe.Type.INSTANCE); - } - - @Override - protected Text getContainerName() { - return new TranslatableText("container.plutoscoffee.coffee_machine"); - } - - @Override - protected ScreenHandler createScreenHandler(int syncId, PlayerInventory playerInventory) { - return new CoffeeMachineScreenHandler(syncId, playerInventory, this, this.propertyDelegate); - } -} diff --git a/src/main/java/ml/pluto7073/plutoscoffee/recipes/CoffeeBrewingRecipe.java b/src/main/java/ml/pluto7073/plutoscoffee/recipes/CoffeeBrewingRecipe.java deleted file mode 100644 index 827edc9..0000000 --- a/src/main/java/ml/pluto7073/plutoscoffee/recipes/CoffeeBrewingRecipe.java +++ /dev/null @@ -1,74 +0,0 @@ -package ml.pluto7073.plutoscoffee.recipes; - -import net.minecraft.inventory.CraftingInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.Ingredient; -import net.minecraft.recipe.Recipe; -import net.minecraft.recipe.RecipeSerializer; -import net.minecraft.recipe.RecipeType; -import net.minecraft.util.Identifier; -import net.minecraft.world.World; - -public class CoffeeBrewingRecipe implements Recipe { - - private final Ingredient base; - private final Ingredient addition; - private final ItemStack result; - private final Identifier id; - - public CoffeeBrewingRecipe(Identifier id, ItemStack result, Ingredient base, Ingredient addition) { - this.id = id; - this.result = result; - this.base = base; - this.addition = addition; - } - - public Ingredient getBase() { - return this.base; - } - - public Ingredient getAddition() { - return this.addition; - } - - @Override - public boolean matches(CraftingInventory inventory, World world) { - if (inventory.size() < 2) return false; - return base.test(inventory.getStack(0)) && addition.test(inventory.getStack(1)); - } - - @Override - public ItemStack craft(CraftingInventory inventory) { - return this.getOutput().copy(); - } - - @Override - public boolean fits(int width, int height) { - return true; - } - - public ItemStack getOutput() { - return this.result; - } - - public Identifier getId() { - return id; - } - - @Override - public RecipeSerializer getSerializer() { - return null; - } - - @Override - public RecipeType getType() { - return Type.INSTANCE; - } - - public static class Type implements RecipeType { - private Type(){} - public static final Type INSTANCE = new Type(); - public static final String ID = "coffee_brewing"; - } - -} diff --git a/src/main/java/ml/pluto7073/plutoscoffee/registry/ModBlocks.java b/src/main/java/ml/pluto7073/plutoscoffee/registry/ModBlocks.java index fa1e4a1..2b61fe7 100644 --- a/src/main/java/ml/pluto7073/plutoscoffee/registry/ModBlocks.java +++ b/src/main/java/ml/pluto7073/plutoscoffee/registry/ModBlocks.java @@ -2,34 +2,22 @@ import ml.pluto7073.plutoscoffee.PlutosCoffee; import ml.pluto7073.plutoscoffee.blocks.CoffeeCrop; -import ml.pluto7073.plutoscoffee.blocks.CoffeeMachineBlock; -import ml.pluto7073.plutoscoffee.blocks.CoffeeMachineBlockEntity; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.block.Block; import net.minecraft.block.Material; -import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.item.AliasedBlockItem; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; -import net.minecraft.item.ItemGroup; import net.minecraft.util.Identifier; import net.minecraft.util.registry.Registry; public class ModBlocks { public static final Block COFFEE_CROP = new CoffeeCrop(); - public static final BlockEntityType COFFEE_MACHINE_BLOCK_ENTITY; - public static final Block COFFEE_MACHINE = new CoffeeMachineBlock(FabricBlockSettings.of(Material.METAL)); static { - COFFEE_MACHINE_BLOCK_ENTITY = - Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(PlutosCoffee.MOD_ID, "coffee_machine"), - BlockEntityType.Builder.create(CoffeeMachineBlockEntity::new, COFFEE_MACHINE).build(null)); + } public static void registerBlocks() { Registry.register(Registry.BLOCK, new Identifier(PlutosCoffee.MOD_ID, "coffee_plant"), COFFEE_CROP); - Registry.register(Registry.BLOCK, new Identifier(PlutosCoffee.MOD_ID, "coffee_machine"), COFFEE_MACHINE); } } diff --git a/src/main/java/ml/pluto7073/plutoscoffee/registry/ModStats.java b/src/main/java/ml/pluto7073/plutoscoffee/registry/ModStats.java index 06c1300..f3524b0 100644 --- a/src/main/java/ml/pluto7073/plutoscoffee/registry/ModStats.java +++ b/src/main/java/ml/pluto7073/plutoscoffee/registry/ModStats.java @@ -8,12 +8,9 @@ public class ModStats { - public static final Identifier INTERACT_WITH_COFFEE_MACHINE = new Identifier(PlutosCoffee.MOD_ID, "interact_with_coffee_machine"); public static final Identifier DRINK_COFFEE = new Identifier(PlutosCoffee.MOD_ID, "drink_coffee"); public static void registerStats() { - Registry.register(Registry.CUSTOM_STAT, INTERACT_WITH_COFFEE_MACHINE.getPath(), INTERACT_WITH_COFFEE_MACHINE); - Stats.CUSTOM.getOrCreateStat(INTERACT_WITH_COFFEE_MACHINE, StatFormatter.DEFAULT); Registry.register(Registry.CUSTOM_STAT, DRINK_COFFEE.getPath(), DRINK_COFFEE); Stats.CUSTOM.getOrCreateStat(DRINK_COFFEE, StatFormatter.DEFAULT); }