added drill
This commit is contained in:
parent
a7311b9da0
commit
c70270758f
@ -0,0 +1,37 @@
|
|||||||
|
package de.jottyfan.minecraft.quickiefabric.blockentity;
|
||||||
|
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
|
import net.minecraft.util.Tickable;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jotty
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DrillBlockEntity extends BlockEntity implements Tickable {
|
||||||
|
|
||||||
|
private static final Integer MAXDRILLSTEP = 16;
|
||||||
|
private Integer drillstep;
|
||||||
|
|
||||||
|
public DrillBlockEntity() {
|
||||||
|
super(QuickieFabricBlockEntity.DRILL);
|
||||||
|
drillstep = MAXDRILLSTEP;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick() {
|
||||||
|
BlockPos pos = getPos();
|
||||||
|
World world = getWorld();
|
||||||
|
drillstep--;
|
||||||
|
if (drillstep < 1) {
|
||||||
|
drillstep = MAXDRILLSTEP;
|
||||||
|
BlockPos down = pos.down();
|
||||||
|
if (!world.getBlockState(down).isOf(Blocks.BEDROCK)) {
|
||||||
|
world.breakBlock(down, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -11,4 +11,5 @@ public class QuickieFabricBlockEntity {
|
|||||||
public static BlockEntityType<ItemHoarderBlockEntity> ITEMHOARDER;
|
public static BlockEntityType<ItemHoarderBlockEntity> ITEMHOARDER;
|
||||||
public static BlockEntityType<MonsterHoarderBlockEntity> MONSTERHOARDER;
|
public static BlockEntityType<MonsterHoarderBlockEntity> MONSTERHOARDER;
|
||||||
public static BlockEntityType<EmptyLavaHoarderBlockEntity> EMPTYLAVAHOARDER;
|
public static BlockEntityType<EmptyLavaHoarderBlockEntity> EMPTYLAVAHOARDER;
|
||||||
|
public static BlockEntityType<DrillBlockEntity> DRILL;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
package de.jottyfan.minecraft.quickiefabric.blocks;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import de.jottyfan.minecraft.quickiefabric.blockentity.DrillBlockEntity;
|
||||||
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
|
import net.minecraft.block.BlockEntityProvider;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.FallingBlock;
|
||||||
|
import net.minecraft.block.Material;
|
||||||
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.loot.context.LootContext.Builder;
|
||||||
|
import net.minecraft.world.BlockView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jotty
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class BlockDrill extends FallingBlock implements BlockEntityProvider {
|
||||||
|
|
||||||
|
public BlockDrill() {
|
||||||
|
super(FabricBlockSettings.of(Material.STONE).hardness(2.5f));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockEntity createBlockEntity(BlockView world) {
|
||||||
|
return new DrillBlockEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
|
||||||
|
List<ItemStack> list = new ArrayList<>();
|
||||||
|
list.add(new ItemStack(QuickieBlocks.DRILL));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
@ -19,4 +19,5 @@ public class QuickieBlocks {
|
|||||||
public static final BlockKelpstack KELPSTACK = new BlockKelpstack();
|
public static final BlockKelpstack KELPSTACK = new BlockKelpstack();
|
||||||
public static final BlockCottonplant COTTONPLANT = new BlockCottonplant();
|
public static final BlockCottonplant COTTONPLANT = new BlockCottonplant();
|
||||||
public static final BlockSulphor BLOCKSULPHOR = new BlockSulphor();
|
public static final BlockSulphor BLOCKSULPHOR = new BlockSulphor();
|
||||||
|
public static final BlockDrill DRILL = new BlockDrill();
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import java.util.function.Supplier;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
import de.jottyfan.minecraft.quickiefabric.blockentity.DrillBlockEntity;
|
||||||
import de.jottyfan.minecraft.quickiefabric.blockentity.EmptyLavaHoarderBlockEntity;
|
import de.jottyfan.minecraft.quickiefabric.blockentity.EmptyLavaHoarderBlockEntity;
|
||||||
import de.jottyfan.minecraft.quickiefabric.blockentity.ItemHoarderBlockEntity;
|
import de.jottyfan.minecraft.quickiefabric.blockentity.ItemHoarderBlockEntity;
|
||||||
import de.jottyfan.minecraft.quickiefabric.blockentity.MonsterHoarderBlockEntity;
|
import de.jottyfan.minecraft.quickiefabric.blockentity.MonsterHoarderBlockEntity;
|
||||||
@ -139,6 +140,7 @@ public class RegistryManager {
|
|||||||
stacks.add(new ItemStack(QuickieBlocks.MONSTERHOARDER));
|
stacks.add(new ItemStack(QuickieBlocks.MONSTERHOARDER));
|
||||||
stacks.add(new ItemStack(QuickieBlocks.KELPSTACK));
|
stacks.add(new ItemStack(QuickieBlocks.KELPSTACK));
|
||||||
stacks.add(new ItemStack(QuickieBlocks.BLOCKSULPHOR));
|
stacks.add(new ItemStack(QuickieBlocks.BLOCKSULPHOR));
|
||||||
|
stacks.add(new ItemStack(QuickieBlocks.DRILL));
|
||||||
}).build();
|
}).build();
|
||||||
|
|
||||||
private static final void registerBlock(Block block, String name) {
|
private static final void registerBlock(Block block, String name) {
|
||||||
@ -169,6 +171,8 @@ public class RegistryManager {
|
|||||||
QuickieFabricBlockEntity.EMPTYLAVAHOARDER = (BlockEntityType<EmptyLavaHoarderBlockEntity>) registerBlockEntity(
|
QuickieFabricBlockEntity.EMPTYLAVAHOARDER = (BlockEntityType<EmptyLavaHoarderBlockEntity>) registerBlockEntity(
|
||||||
"emptylavahoarderblockentity", EmptyLavaHoarderBlockEntity::new, QuickieBlocks.EMPTYLAVAHOARDER,
|
"emptylavahoarderblockentity", EmptyLavaHoarderBlockEntity::new, QuickieBlocks.EMPTYLAVAHOARDER,
|
||||||
QuickieBlocks.LAVAHOARDER);
|
QuickieBlocks.LAVAHOARDER);
|
||||||
|
QuickieFabricBlockEntity.DRILL = (BlockEntityType<DrillBlockEntity>) registerBlockEntity("drillblockentity",
|
||||||
|
DrillBlockEntity::new, QuickieBlocks.DRILL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void registerBlocks() {
|
public static final void registerBlocks() {
|
||||||
@ -186,6 +190,7 @@ public class RegistryManager {
|
|||||||
registerBlock(QuickieBlocks.KELPSTACK, "kelpstack");
|
registerBlock(QuickieBlocks.KELPSTACK, "kelpstack");
|
||||||
registerBlock(QuickieBlocks.COTTONPLANT, "cottonplant");
|
registerBlock(QuickieBlocks.COTTONPLANT, "cottonplant");
|
||||||
registerBlock(QuickieBlocks.BLOCKSULPHOR, "blocksulphor");
|
registerBlock(QuickieBlocks.BLOCKSULPHOR, "blocksulphor");
|
||||||
|
registerBlock(QuickieBlocks.DRILL, "drill");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void registerItems() {
|
public static final void registerItems() {
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": {
|
||||||
|
"model": "quickiefabric:block/drill"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -52,6 +52,7 @@
|
|||||||
"block.quickiefabric.kelpstack": "Seegrassbündel",
|
"block.quickiefabric.kelpstack": "Seegrassbündel",
|
||||||
"block.quickiefabric.cottonplant": "Baumwollpflanze",
|
"block.quickiefabric.cottonplant": "Baumwollpflanze",
|
||||||
"block.quickiefabric.blocksulphor": "Schwefelblock",
|
"block.quickiefabric.blocksulphor": "Schwefelblock",
|
||||||
|
"block.quickiefabric.drill": "Bohrer",
|
||||||
"container.quickiefabric.backpack": "Rucksack",
|
"container.quickiefabric.backpack": "Rucksack",
|
||||||
"msg.buildingplan.start": "beginne Konstruktionsaufnahme bei %s,%s,%s",
|
"msg.buildingplan.start": "beginne Konstruktionsaufnahme bei %s,%s,%s",
|
||||||
"msg.buildingplan.end": "beende Konstruktionsaufnahme bei %s,%s,%s",
|
"msg.buildingplan.end": "beende Konstruktionsaufnahme bei %s,%s,%s",
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
"block.quickiefabric.kelpstack": "kelp bundle",
|
"block.quickiefabric.kelpstack": "kelp bundle",
|
||||||
"block.quickiefabric.cottonplant": "cotton plant",
|
"block.quickiefabric.cottonplant": "cotton plant",
|
||||||
"block.quickiefabric.blocksulphor": "block of sulfur",
|
"block.quickiefabric.blocksulphor": "block of sulfur",
|
||||||
|
"block.quickiefabric.drill": "drill",
|
||||||
"container.quickiefabric.backpack": "backpack",
|
"container.quickiefabric.backpack": "backpack",
|
||||||
"msg.buildingplan.start": "started recording of construction at %s,%s,%s",
|
"msg.buildingplan.start": "started recording of construction at %s,%s,%s",
|
||||||
"msg.buildingplan.end": "finished recording of construction at %s,%s,%s",
|
"msg.buildingplan.end": "finished recording of construction at %s,%s,%s",
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "block/cube_all",
|
||||||
|
"textures": {
|
||||||
|
"all": "quickiefabric:block/drill"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"parent": "quickiefabric:block/drill",
|
||||||
|
"display": {
|
||||||
|
"thirdperson": {
|
||||||
|
"rotation": [ 10, -45, 170 ],
|
||||||
|
"translation": [ 0, 1.5, -2.75 ],
|
||||||
|
"scale": [ 0.375, 0.375, 0.375 ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
src/main/resources/assets/quickiefabric/textures/block/drill.png
Normal file
BIN
src/main/resources/assets/quickiefabric/textures/block/drill.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
20
src/main/resources/data/quickiefabric/recipes/drill.json
Normal file
20
src/main/resources/data/quickiefabric/recipes/drill.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"pattern": [
|
||||||
|
"sss",
|
||||||
|
"srs",
|
||||||
|
"sss"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"s": {
|
||||||
|
"item": "quickiefabric:speedpowder"
|
||||||
|
},
|
||||||
|
"r": {
|
||||||
|
"item": "minecraft:redstone_block"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"item": "quickiefabric:drill",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user