Compare commits

4 Commits

Author SHA1 Message Date
a54ec93551 1.20.3-pre2 2023-11-23 17:54:39 +01:00
96a334448e snapshot version 2023-11-13 23:48:55 +01:00
8661f7f12e log compatibility on some mods 2023-10-31 20:50:39 +01:00
a687e935b2 added block speedpowder 2023-10-28 22:38:48 +02:00
45 changed files with 323 additions and 47 deletions

View File

@ -4,17 +4,17 @@
# Fabric Properties
# check these on https://fabricmc.net/versions.html
minecraft_version=1.20.2
yarn_mappings=1.20.2+build.1
loader_version=0.14.22
minecraft_version=1.20.3-pre2
yarn_mappings=1.20.3-pre2+build.2
loader_version=0.14.24
# Mod Properties
mod_version = 1.20.2.0
mod_version = 1.20.3.1
maven_group = de.jottyfan.minecraft
archives_base_name = quickiefabric
# Dependencies
fabric_version=0.89.1+1.20.2
fabric_version=0.90.12+1.20.3
# for ExtendedLeavesBlock
terraform_wood_api_version=7.0.1
terraform_wood_api_version=9.0.0-alpha.3

View File

@ -81,7 +81,7 @@ public class ItemHoarderBlockEntity extends LootableContainerBlockEntity {
@Override
public void writeNbt(NbtCompound nbt) {
super.writeNbt(nbt);
if (!this.serializeLootTable(nbt)) {
if (!this.writeLootTable(nbt)) {
Inventories.writeNbt(nbt, this.stacks);
}
}
@ -90,7 +90,7 @@ public class ItemHoarderBlockEntity extends LootableContainerBlockEntity {
public void readNbt(NbtCompound nbt) {
super.readNbt(nbt);
this.stacks = DefaultedList.ofSize(this.size(), ItemStack.EMPTY);
if (!this.deserializeLootTable(nbt)) {
if (!this.readLootTable(nbt)) {
Inventories.readNbt(nbt, this.stacks);
}
}
@ -104,8 +104,8 @@ public class ItemHoarderBlockEntity extends LootableContainerBlockEntity {
return 54; // container chest size (9 * 6)
}
@Override
protected DefaultedList<ItemStack> getInvStackList() {
@Override // before: getInvStackList
protected DefaultedList<ItemStack> method_11282() {
return stacks;
}

View File

@ -46,9 +46,9 @@ public class BlockCottonplant extends CropBlock {
}
@Override
public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) {
public BlockState onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) {
spawnHarvested(world, pos, state);
super.onBreak(world, pos, state, player);
return super.onBreak(world, pos, state, player);
}
@Override

View File

@ -4,11 +4,13 @@ import java.util.Arrays;
import java.util.List;
import java.util.Random;
import com.mojang.serialization.MapCodec;
import de.jottyfan.minecraft.quickiefabric.items.QuickieItems;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.GravelBlock;
import net.minecraft.block.FallingBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.loot.context.LootContextParameterSet.Builder;
@ -18,7 +20,7 @@ import net.minecraft.loot.context.LootContextParameterSet.Builder;
* @author jotty
*
*/
public class BlockDirtSalpeter extends GravelBlock {
public class BlockDirtSalpeter extends FallingBlock {
public BlockDirtSalpeter() {
super(FabricBlockSettings.create().hardness(3.1f));
@ -35,4 +37,10 @@ public class BlockDirtSalpeter extends GravelBlock {
: new ItemStack[] { salpeterStack, dirtStack };
return Arrays.asList(spawnies);
}
@Override
protected MapCodec<? extends FallingBlock> getCodec() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -3,6 +3,8 @@ package de.jottyfan.minecraft.quickiefabric.blocks;
import java.util.ArrayList;
import java.util.List;
import com.mojang.serialization.MapCodec;
import de.jottyfan.minecraft.quickiefabric.blockentity.DrillBlockDownEntity;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.BlockEntityProvider;
@ -48,4 +50,9 @@ public class BlockDrillDown extends FallingBlock implements BlockEntityProvider
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type){
return (world1, pos, state1, be) -> DrillBlockDownEntity.tick(world1, pos, state1, be);
}
@Override
protected MapCodec<? extends FallingBlock> getCodec() {
return null; // TODO: what to return here?
}
}

View File

@ -3,6 +3,8 @@ package de.jottyfan.minecraft.quickiefabric.blocks;
import java.util.ArrayList;
import java.util.List;
import com.mojang.serialization.MapCodec;
import de.jottyfan.minecraft.quickiefabric.blockentity.DrillBlockEastEntity;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.BlockEntityProvider;
@ -49,4 +51,10 @@ public class BlockDrillEast extends FallingBlock implements BlockEntityProvider
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type){
return (world1, pos, state1, be) -> DrillBlockEastEntity.tick(world1, pos, state1, be);
}
@Override
protected MapCodec<? extends FallingBlock> getCodec() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -3,6 +3,8 @@ package de.jottyfan.minecraft.quickiefabric.blocks;
import java.util.ArrayList;
import java.util.List;
import com.mojang.serialization.MapCodec;
import de.jottyfan.minecraft.quickiefabric.blockentity.DrillBlockNorthEntity;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.BlockEntityProvider;
@ -18,12 +20,12 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
/**
*
*
* @author jotty
*
*/
public class BlockDrillNorth extends FallingBlock implements BlockEntityProvider {
public BlockDrillNorth() {
super(FabricBlockSettings.create().hardness(2.5f));
}
@ -49,4 +51,10 @@ public class BlockDrillNorth extends FallingBlock implements BlockEntityProvider
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type){
return (world1, pos, state1, be) -> DrillBlockNorthEntity.tick(world1, pos, state1, be);
}
@Override
protected MapCodec<? extends FallingBlock> getCodec() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -3,6 +3,8 @@ package de.jottyfan.minecraft.quickiefabric.blocks;
import java.util.ArrayList;
import java.util.List;
import com.mojang.serialization.MapCodec;
import de.jottyfan.minecraft.quickiefabric.blockentity.DrillBlockSouthEntity;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.BlockEntityProvider;
@ -18,12 +20,12 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
/**
*
*
* @author jotty
*
*/
public class BlockDrillSouth extends FallingBlock implements BlockEntityProvider {
public BlockDrillSouth() {
super(FabricBlockSettings.create().hardness(2.5f));
}
@ -49,4 +51,10 @@ public class BlockDrillSouth extends FallingBlock implements BlockEntityProvider
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type){
return (world1, pos, state1, be) -> DrillBlockSouthEntity.tick(world1, pos, state1, be);
}
@Override
protected MapCodec<? extends FallingBlock> getCodec() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -3,6 +3,8 @@ package de.jottyfan.minecraft.quickiefabric.blocks;
import java.util.ArrayList;
import java.util.List;
import com.mojang.serialization.MapCodec;
import de.jottyfan.minecraft.quickiefabric.blockentity.DrillBlockWestEntity;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.BlockEntityProvider;
@ -18,12 +20,12 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
/**
*
*
* @author jotty
*
*/
public class BlockDrillWest extends FallingBlock implements BlockEntityProvider {
public BlockDrillWest() {
super(FabricBlockSettings.create().hardness(2.5f));
}
@ -49,4 +51,10 @@ public class BlockDrillWest extends FallingBlock implements BlockEntityProvider
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type){
return (world1, pos, state1, be) -> DrillBlockWestEntity.tick(world1, pos, state1, be);
}
@Override
protected MapCodec<? extends FallingBlock> getCodec() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -61,7 +61,7 @@ public class BlockItemhoarder extends Block implements BlockEntityProvider {
}
@Override
public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) {
public BlockState onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) {
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity instanceof ItemHoarderBlockEntity) {
ItemHoarderBlockEntity ihbe = (ItemHoarderBlockEntity) blockEntity;
@ -69,7 +69,7 @@ public class BlockItemhoarder extends Block implements BlockEntityProvider {
ItemScatterer.spawn(world, pos.getX(), pos.getY(), pos.getZ(), stack);
}
}
super.onBreak(world, pos, state, player);
return super.onBreak(world, pos, state, player);
}
@Override

View File

@ -3,9 +3,11 @@ package de.jottyfan.minecraft.quickiefabric.blocks;
import java.util.Arrays;
import java.util.List;
import com.mojang.serialization.MapCodec;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.BlockState;
import net.minecraft.block.GravelBlock;
import net.minecraft.block.FallingBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.loot.context.LootContextParameterSet.Builder;
@ -16,7 +18,7 @@ import net.minecraft.sound.BlockSoundGroup;
* @author jotty
*
*/
public class BlockKelpstack extends GravelBlock {
public class BlockKelpstack extends FallingBlock {
public BlockKelpstack() {
super(FabricBlockSettings.create().hardness(0.1f).slipperiness(1.0f)
@ -27,4 +29,10 @@ public class BlockKelpstack extends GravelBlock {
public List<ItemStack> getDroppedStacks(BlockState blockState, Builder builder) {
return Arrays.asList(new ItemStack[] { new ItemStack(Items.KELP, 9) });
}
@Override
protected MapCodec<? extends FallingBlock> getCodec() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -31,7 +31,7 @@ import net.minecraft.world.World;
public class BlockLavahoarder extends Block implements BlockEntityProvider {
public BlockLavahoarder() {
super(FabricBlockSettings.create().hardness(2.5f).luminance(16));
super(FabricBlockSettings.create().hardness(2.5f).luminance(state -> 15));
}
@Override

View File

@ -5,10 +5,7 @@ import java.util.List;
import de.jottyfan.minecraft.quickiefabric.blockentity.MonsterHoarderBlockEntity;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Block;
import net.minecraft.block.BlockEntityProvider;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityTicker;
import net.minecraft.block.entity.BlockEntityType;
@ -27,8 +24,9 @@ import net.minecraft.world.World;
*/
public class BlockMonsterhoarder extends Block implements BlockEntityProvider {
public BlockMonsterhoarder() {
super(FabricBlockSettings.create().hardness(2.5f).luminance(20));
super(FabricBlockSettings.create().hardness(2.5f).luminance(state -> 15));
}
@Override

View File

@ -3,6 +3,7 @@ package de.jottyfan.minecraft.quickiefabric.blocks;
import java.util.Arrays;
import java.util.List;
import de.jottyfan.minecraft.quickiefabric.blocks.help.IntProviderHelper;
import de.jottyfan.minecraft.quickiefabric.items.QuickieItems;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.BlockState;
@ -19,7 +20,7 @@ import net.minecraft.loot.context.LootContextParameterSet.Builder;
public class BlockOreDeepslateSulphor extends ExperienceDroppingBlock {
public BlockOreDeepslateSulphor() {
super(FabricBlockSettings.create().hardness(1.9f).requiresTool());
super(IntProviderHelper.of(0, 2), FabricBlockSettings.create().hardness(1.9f).requiresTool());
}
@Override

View File

@ -3,6 +3,7 @@ package de.jottyfan.minecraft.quickiefabric.blocks;
import java.util.Arrays;
import java.util.List;
import de.jottyfan.minecraft.quickiefabric.blocks.help.IntProviderHelper;
import de.jottyfan.minecraft.quickiefabric.items.QuickieItems;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.BlockState;
@ -19,7 +20,7 @@ import net.minecraft.loot.context.LootContextParameterSet.Builder;
public class BlockOreNetherSulphor extends ExperienceDroppingBlock {
public BlockOreNetherSulphor() {
super(FabricBlockSettings.create().hardness(2.1f).requiresTool());
super(IntProviderHelper.of(0, 2), FabricBlockSettings.create().hardness(2.1f).requiresTool());
}
@Override

View File

@ -3,6 +3,7 @@ package de.jottyfan.minecraft.quickiefabric.blocks;
import java.util.Arrays;
import java.util.List;
import de.jottyfan.minecraft.quickiefabric.blocks.help.IntProviderHelper;
import de.jottyfan.minecraft.quickiefabric.items.QuickieItems;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.BlockState;
@ -19,7 +20,7 @@ import net.minecraft.util.math.random.Random;
public class BlockOreSalpeter extends ExperienceDroppingBlock {
public BlockOreSalpeter() {
super(FabricBlockSettings.create().hardness(3.1f).requiresTool());
super(IntProviderHelper.of(0, 2), FabricBlockSettings.create().hardness(3.1f).requiresTool());
}
@Override

View File

@ -3,6 +3,7 @@ package de.jottyfan.minecraft.quickiefabric.blocks;
import java.util.Arrays;
import java.util.List;
import de.jottyfan.minecraft.quickiefabric.blocks.help.IntProviderHelper;
import de.jottyfan.minecraft.quickiefabric.items.QuickieItems;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.BlockState;
@ -20,7 +21,7 @@ import net.minecraft.util.math.random.Random;
public class BlockOreSandSalpeter extends ExperienceDroppingBlock {
public BlockOreSandSalpeter() {
super(FabricBlockSettings.create().hardness(2.9f).requiresTool());
super(IntProviderHelper.of(0, 2), FabricBlockSettings.create().hardness(2.9f).requiresTool());
}
@Override

View File

@ -3,6 +3,7 @@ package de.jottyfan.minecraft.quickiefabric.blocks;
import java.util.Arrays;
import java.util.List;
import de.jottyfan.minecraft.quickiefabric.blocks.help.IntProviderHelper;
import de.jottyfan.minecraft.quickiefabric.items.QuickieItems;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.BlockState;
@ -19,7 +20,7 @@ import net.minecraft.loot.context.LootContextParameterSet.Builder;
public class BlockOreSulphor extends ExperienceDroppingBlock {
public BlockOreSulphor() {
super(FabricBlockSettings.create().hardness(1.9f).requiresTool());
super(IntProviderHelper.of(0, 2), FabricBlockSettings.create().hardness(1.9f).requiresTool());
}
@Override

View File

@ -3,6 +3,7 @@ package de.jottyfan.minecraft.quickiefabric.blocks;
import java.util.Arrays;
import java.util.List;
import de.jottyfan.minecraft.quickiefabric.blocks.help.IntProviderHelper;
import de.jottyfan.minecraft.quickiefabric.items.QuickieItems;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.BlockState;
@ -18,7 +19,7 @@ import net.minecraft.loot.context.LootContextParameterSet.Builder;
public class BlockSalpeter extends ExperienceDroppingBlock {
public BlockSalpeter() {
super(FabricBlockSettings.create().hardness(0.5f));
super(IntProviderHelper.of(0, 2), FabricBlockSettings.create().hardness(0.5f));
}
@Override

View File

@ -3,11 +3,13 @@ package de.jottyfan.minecraft.quickiefabric.blocks;
import java.util.Arrays;
import java.util.List;
import com.mojang.serialization.MapCodec;
import de.jottyfan.minecraft.quickiefabric.items.QuickieItems;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.GravelBlock;
import net.minecraft.block.FallingBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContextParameterSet.Builder;
import net.minecraft.util.math.random.Random;
@ -17,7 +19,7 @@ import net.minecraft.util.math.random.Random;
* @author jotty
*
*/
public class BlockSandSalpeter extends GravelBlock {
public class BlockSandSalpeter extends FallingBlock {
public BlockSandSalpeter() {
super(FabricBlockSettings.create().hardness(3.1f).requiresTool());
@ -27,4 +29,10 @@ public class BlockSandSalpeter extends GravelBlock {
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
return Arrays.asList(new ItemStack[] { new ItemStack(QuickieItems.SALPETER, 3 + Random.create().nextInt(2)), new ItemStack(Blocks.SAND) });
}
@Override
protected MapCodec<? extends FallingBlock> getCodec() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -0,0 +1,42 @@
package de.jottyfan.minecraft.quickiefabric.blocks;
import java.util.Arrays;
import java.util.List;
import com.mojang.serialization.MapCodec;
import de.jottyfan.minecraft.quickiefabric.items.QuickieItems;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.BlockState;
import net.minecraft.block.FallingBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContextParameterSet.Builder;
import net.minecraft.world.explosion.Explosion;
/**
*
* @author jotty
*
*/
public class BlockSpeedpowder extends FallingBlock {
public BlockSpeedpowder() {
super(FabricBlockSettings.create().luminance(state -> 12));
}
@Override
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
return Arrays.asList(new ItemStack[] { new ItemStack(QuickieItems.SPEEDPOWDER, 9) });
}
@Override
public boolean shouldDropItemsOnExplosion(Explosion explosion) {
return true;
}
@Override
protected MapCodec<? extends FallingBlock> getCodec() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -2,6 +2,8 @@ package de.jottyfan.minecraft.quickiefabric.blocks;
import java.util.List;
import com.mojang.serialization.MapCodec;
import de.jottyfan.minecraft.quickiefabric.blockentity.BlockSpreaderEntity;
import de.jottyfan.minecraft.quickiefabric.blockentity.QuickieFabricBlockEntity;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
@ -48,4 +50,10 @@ public class BlockSpreader extends BlockWithEntity {
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
return List.of(new ItemStack(QuickieBlocks.BLOCKSPREADER.asItem()));
}
@Override
protected MapCodec<? extends BlockWithEntity> getCodec() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -2,6 +2,8 @@ package de.jottyfan.minecraft.quickiefabric.blocks;
import java.util.List;
import com.mojang.serialization.MapCodec;
import de.jottyfan.minecraft.quickiefabric.blockentity.BlockStackerEntity;
import de.jottyfan.minecraft.quickiefabric.blockentity.QuickieFabricBlockEntity;
import de.jottyfan.minecraft.quickiefabric.blocks.help.BlockStacker;
@ -102,4 +104,10 @@ public class BlockStackerDown extends BlockWithEntity implements BlockStacker {
public int getComparatorOutput(BlockState state, World world, BlockPos pos) {
return ScreenHandler.calculateComparatorOutput(world.getBlockEntity(pos));
}
@Override
protected MapCodec<? extends BlockWithEntity> getCodec() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -2,6 +2,8 @@ package de.jottyfan.minecraft.quickiefabric.blocks;
import java.util.List;
import com.mojang.serialization.MapCodec;
import de.jottyfan.minecraft.quickiefabric.blockentity.BlockStackerEntity;
import de.jottyfan.minecraft.quickiefabric.blockentity.QuickieFabricBlockEntity;
import de.jottyfan.minecraft.quickiefabric.blocks.help.BlockStacker;
@ -102,4 +104,10 @@ public class BlockStackerEast extends BlockWithEntity implements BlockStacker {
public int getComparatorOutput(BlockState state, World world, BlockPos pos) {
return ScreenHandler.calculateComparatorOutput(world.getBlockEntity(pos));
}
@Override
protected MapCodec<? extends BlockWithEntity> getCodec() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -2,6 +2,8 @@ package de.jottyfan.minecraft.quickiefabric.blocks;
import java.util.List;
import com.mojang.serialization.MapCodec;
import de.jottyfan.minecraft.quickiefabric.blockentity.BlockStackerEntity;
import de.jottyfan.minecraft.quickiefabric.blockentity.QuickieFabricBlockEntity;
import de.jottyfan.minecraft.quickiefabric.blocks.help.BlockStacker;
@ -102,4 +104,10 @@ public class BlockStackerNorth extends BlockWithEntity implements BlockStacker {
public int getComparatorOutput(BlockState state, World world, BlockPos pos) {
return ScreenHandler.calculateComparatorOutput(world.getBlockEntity(pos));
}
@Override
protected MapCodec<? extends BlockWithEntity> getCodec() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -2,6 +2,8 @@ package de.jottyfan.minecraft.quickiefabric.blocks;
import java.util.List;
import com.mojang.serialization.MapCodec;
import de.jottyfan.minecraft.quickiefabric.blockentity.BlockStackerEntity;
import de.jottyfan.minecraft.quickiefabric.blockentity.QuickieFabricBlockEntity;
import de.jottyfan.minecraft.quickiefabric.blocks.help.BlockStacker;
@ -102,4 +104,10 @@ public class BlockStackerSouth extends BlockWithEntity implements BlockStacker {
public int getComparatorOutput(BlockState state, World world, BlockPos pos) {
return ScreenHandler.calculateComparatorOutput(world.getBlockEntity(pos));
}
@Override
protected MapCodec<? extends BlockWithEntity> getCodec() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -2,6 +2,8 @@ package de.jottyfan.minecraft.quickiefabric.blocks;
import java.util.List;
import com.mojang.serialization.MapCodec;
import de.jottyfan.minecraft.quickiefabric.blockentity.BlockStackerEntity;
import de.jottyfan.minecraft.quickiefabric.blockentity.QuickieFabricBlockEntity;
import de.jottyfan.minecraft.quickiefabric.blocks.help.BlockStacker;
@ -102,4 +104,10 @@ public class BlockStackerUp extends BlockWithEntity implements BlockStacker {
public int getComparatorOutput(BlockState state, World world, BlockPos pos) {
return ScreenHandler.calculateComparatorOutput(world.getBlockEntity(pos));
}
@Override
protected MapCodec<? extends BlockWithEntity> getCodec() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -2,6 +2,8 @@ package de.jottyfan.minecraft.quickiefabric.blocks;
import java.util.List;
import com.mojang.serialization.MapCodec;
import de.jottyfan.minecraft.quickiefabric.blockentity.BlockStackerEntity;
import de.jottyfan.minecraft.quickiefabric.blockentity.QuickieFabricBlockEntity;
import de.jottyfan.minecraft.quickiefabric.blocks.help.BlockStacker;
@ -102,4 +104,10 @@ public class BlockStackerWest extends BlockWithEntity implements BlockStacker {
public int getComparatorOutput(BlockState state, World world, BlockPos pos) {
return ScreenHandler.calculateComparatorOutput(world.getBlockEntity(pos));
}
@Override
protected MapCodec<? extends BlockWithEntity> getCodec() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -3,6 +3,7 @@ package de.jottyfan.minecraft.quickiefabric.blocks;
import java.util.Arrays;
import java.util.List;
import de.jottyfan.minecraft.quickiefabric.blocks.help.IntProviderHelper;
import de.jottyfan.minecraft.quickiefabric.items.QuickieItems;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.BlockState;
@ -18,7 +19,7 @@ import net.minecraft.loot.context.LootContextParameterSet.Builder;
public class BlockSulphor extends ExperienceDroppingBlock {
public BlockSulphor() {
super(FabricBlockSettings.create().hardness(0.5f));
super(IntProviderHelper.of(0, 2), FabricBlockSettings.create().hardness(0.5f));
}
@Override

View File

@ -34,4 +34,5 @@ public class QuickieBlocks {
public static final BlockStackerNorth BLOCKSTACKERNORTH = new BlockStackerNorth();
public static final BlockStackerSouth BLOCKSTACKERSOUTH = new BlockStackerSouth();
public static final BlockSpreader BLOCKSPREADER = new BlockSpreader();
public static final BlockSpeedpowder BLOCKSPEEDPOWDER = new BlockSpeedpowder();;
}

View File

@ -0,0 +1,37 @@
package de.jottyfan.minecraft.quickiefabric.blocks.help;
import net.minecraft.util.math.intprovider.IntProvider;
import net.minecraft.util.math.intprovider.IntProviderType;
import net.minecraft.util.math.random.Random;
/**
*
* @author jotty
*
*/
public class IntProviderHelper {
public static final IntProvider of(Integer min, Integer max) {
return new IntProvider() {
@Override
public IntProviderType<?> getType() {
return IntProviderType.CONSTANT;
}
@Override
public int getMin() {
return min;
}
@Override
public int getMax() {
return max;
}
@Override
public int get(Random random) {
return random.nextBetween(min, max);
}
};
}
}

View File

@ -120,6 +120,7 @@ public class RegistryManager {
stacks.add(new ItemStack(QuickieBlocks.KELPSTACK));
stacks.add(new ItemStack(QuickieBlocks.BLOCKSULPHOR));
stacks.add(new ItemStack(QuickieBlocks.BLOCKSALPETER));
stacks.add(new ItemStack(QuickieBlocks.BLOCKSPEEDPOWDER));
stacks.add(new ItemStack(QuickieBlocks.DRILL_DOWN));
stacks.add(new ItemStack(QuickieBlocks.DRILL_EAST));
stacks.add(new ItemStack(QuickieBlocks.DRILL_SOUTH));
@ -199,6 +200,7 @@ public class RegistryManager {
registerBlock(QuickieBlocks.COTTONPLANT, "cottonplant");
registerBlock(QuickieBlocks.BLOCKSULPHOR, "blocksulphor");
registerBlock(QuickieBlocks.BLOCKSALPETER, "blocksalpeter");
registerBlock(QuickieBlocks.BLOCKSPEEDPOWDER, "blockspeedpowder");
registerBlock(QuickieBlocks.DRILL_DOWN, "drill");
registerBlock(QuickieBlocks.DRILL_EAST, "drilleast");
registerBlock(QuickieBlocks.DRILL_SOUTH, "drillsouth");

View File

@ -3,7 +3,7 @@ package de.jottyfan.minecraft.quickiefabric.mixin;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import de.jottyfan.minecraft.quickiefabric.event.BreakBlockCallback;
import net.minecraft.block.Block;
@ -14,15 +14,15 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
/**
*
*
* @author jotty
*
*/
@Mixin(Block.class)
public class BlockBreakMixin {
@Inject(at = @At("HEAD"), method = "onBreak(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Lnet/minecraft/entity/player/PlayerEntity;)V")
private void onBreak(final World world, final BlockPos blockPos, final BlockState blockState, final PlayerEntity playerEntity, final CallbackInfo info) {
@Inject(at = @At("HEAD"), method = "onBreak(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Lnet/minecraft/entity/player/PlayerEntity;)Lnet/minecraft/block/BlockState;")
private void onBreak(final World world, final BlockPos blockPos, final BlockState blockState, final PlayerEntity playerEntity, final CallbackInfoReturnable<BlockBreakMixin> info) {
ActionResult result = BreakBlockCallback.EVENT.invoker().injectBlockBreakCallback(world, blockPos, blockState, playerEntity);
if (result == ActionResult.FAIL) {
info.cancel();

View File

@ -50,7 +50,7 @@ public class ToolRangeableAxe extends AxeItem implements ToolRangeable {
@Override
public boolean canBreakNeighbors(BlockState blockIn) {
return super.isSuitableFor(blockIn) || isLeavesBlock(blockIn);
return super.isSuitableFor(blockIn) || isLeavesBlock(blockIn) || blockIn.isIn(BlockTags.LOGS);
}
@Override

View File

@ -79,7 +79,7 @@ public class ToolSpeedpowderHoe extends HoeItem implements ToolRangeable {
@Override
public boolean canBreakNeighbors(BlockState blockState) {
return super.isSuitableFor(blockState)
|| Blocks.GRASS.equals(blockState.getBlock())
|| Blocks.TALL_GRASS.equals(blockState.getBlock())
|| Blocks.FERN.equals(blockState.getBlock())
|| Blocks.LARGE_FERN.equals(blockState.getBlock());
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "quickiefabric:block/blockspeedpowder"
}
}
}

View File

@ -58,6 +58,7 @@
"block.quickiefabric.cottonplant": "Baumwollpflanze",
"block.quickiefabric.blocksulphor": "Schwefelblock",
"block.quickiefabric.blocksalpeter": "Salpeterblock",
"block.quickiefabric.blockspeedpowder": "Fluchtpulverblock",
"block.quickiefabric.drill": "Bohrer",
"block.quickiefabric.drilleast": "Ost-Bohrer",
"block.quickiefabric.drillsouth": "Süd-Bohrer",

View File

@ -58,6 +58,7 @@
"block.quickiefabric.cottonplant": "cotton plant",
"block.quickiefabric.blocksulphor": "block of sulfur",
"block.quickiefabric.blocksalpeter": "block of salpeter",
"block.quickiefabric.blockspeedpowder": "block of speedpowder",
"block.quickiefabric.drill": "drill",
"block.quickiefabric.drilleast": "east drill",
"block.quickiefabric.drillsouth": "south drill",

View File

@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "quickiefabric:block/blockspeedpowder"
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "quickiefabric:block/blockspeedpowder",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -0,0 +1,16 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "quickiefabric:blocksalpeter"
},{
"item": "quickiefabric:blocksulphor"
},{
"item": "minecraft:coal_block"
}
],
"result": {
"item": "quickiefabric:blockspeedpowder",
"count": 1
}
}

View File

@ -0,0 +1,17 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"sss",
"sss",
"sss"
],
"key": {
"s": {
"item": "quickiefabric:speedpowder"
}
},
"result": {
"item": "quickiefabric:blockspeedpowder",
"count": 1
}
}

View File

@ -0,0 +1,12 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "quickiefabric:blockspeedpowder"
}
],
"result": {
"item": "quickiefabric:speedpowder",
"count": 9
}
}

View File

@ -26,9 +26,9 @@
"quickiefabric.mixins.json"
],
"depends": {
"fabricloader": ">=0.14.22",
"fabricloader": ">=0.14.24",
"fabric": "*",
"minecraft": "1.20.2",
"minecraft": "1.20.3-pre2+build.2",
"java": ">=17"
},
"suggests": {