added sulforpad, but not yet spawning on lava lakes (as wished)
This commit is contained in:
parent
3dcf5e09e4
commit
57a3ebfdc0
@ -9,7 +9,7 @@ yarn_mappings=1.20.3-pre2+build.5
|
||||
loader_version=0.14.24
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.20.3.3
|
||||
mod_version = 1.20.3.4
|
||||
maven_group = de.jottyfan.minecraft
|
||||
archives_base_name = quickiefabric
|
||||
|
||||
|
@ -22,7 +22,8 @@ public class QuickieFabricClient implements ClientModInitializer {
|
||||
public void onInitializeClient() {
|
||||
HandledScreens.register(RegistryManager.BACKPACK_SCREEN_HANDLER, BackpackScreen::new);
|
||||
HandledScreens.register(RegistryManager.BLOCKSTACKER_SCREEN_HANDLER, BlockStackerScreen::new);
|
||||
// make cotton plant block transparent
|
||||
// make cotton plant block and sulforpad transparent
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(QuickieBlocks.COTTONPLANT, RenderLayer.getCutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(QuickieBlocks.SULFORPAD, RenderLayer.getCutout());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,87 @@
|
||||
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.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.CropBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemConvertible;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.loot.context.LootContextParameterSet.Builder;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.ItemScatterer;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
public class BlockSulforpad extends CropBlock {
|
||||
|
||||
public BlockSulforpad(AbstractBlock.Settings settings) {
|
||||
super(settings.nonOpaque().blockVision(Blocks::never).solidBlock(Blocks::never));
|
||||
}
|
||||
|
||||
protected BlockSulforpad() {
|
||||
super(FabricBlockSettings.create());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
|
||||
return Arrays.asList(new ItemStack[] { new ItemStack(QuickieItems.SULPHOR, 2) });
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||
return Block.createCuboidShape(1.0, 0.0, 1.0, 15.0, 1.5, 15.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canPlantOnTop(BlockState floor, BlockView world, BlockPos pos) {
|
||||
return floor.getBlock().equals(Blocks.LAVA) || floor.getBlock().equals(Blocks.LAVA_CAULDRON);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemConvertible getSeedsItem() {
|
||||
return QuickieItems.SULPHOR;
|
||||
}
|
||||
|
||||
private void spawnHarvested(World world, BlockPos pos, BlockState state) {
|
||||
DefaultedList<ItemStack> list = DefaultedList.of();
|
||||
getDroppedStacks(state, null).forEach(itemStack -> {
|
||||
list.add(itemStack);
|
||||
});
|
||||
ItemScatterer.spawn(world, pos, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand,
|
||||
BlockHitResult hitResult) {
|
||||
if (!world.isClient && isMature(state)) {
|
||||
spawnHarvested(world, pos, state);
|
||||
world.setBlockState(pos, state.with(AGE, 0));
|
||||
}
|
||||
return super.onUse(state, world, pos, player, hand, hitResult);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapCodec<? extends BlockSulforpad> getCodec() {
|
||||
return BlockSulforpad.createCodec(BlockSulforpad::new);
|
||||
}
|
||||
}
|
@ -36,4 +36,5 @@ public class QuickieBlocks {
|
||||
public static final BlockSpreader BLOCKSPREADER = new BlockSpreader();
|
||||
public static final BlockSpeedpowder BLOCKSPEEDPOWDER = new BlockSpeedpowder();
|
||||
public static final BlockQuickiepowder BLOCKQUICKIEPOWDER = new BlockQuickiepowder();
|
||||
public static final BlockSulforpad SULFORPAD = new BlockSulforpad();
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public class FeaturesManager {
|
||||
return RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, new Identifier(RegistryManager.QUICKIEFABRIC, name));
|
||||
}
|
||||
|
||||
private static final RegistryKey<PlacedFeature> genPf(String name) {
|
||||
private static final RegistryKey<PlacedFeature> genPf(String name) {
|
||||
return RegistryKey.of(RegistryKeys.PLACED_FEATURE, new Identifier(RegistryManager.QUICKIEFABRIC, name));
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ public class RegistryManager {
|
||||
stacks.add(new ItemStack(QuickieBlocks.BLOCKSTACKERNORTH));
|
||||
stacks.add(new ItemStack(QuickieBlocks.BLOCKSTACKERSOUTH));
|
||||
stacks.add(new ItemStack(QuickieBlocks.BLOCKSPREADER));
|
||||
}).build());
|
||||
}).build());
|
||||
}
|
||||
|
||||
private static final void registerBlock(Block block, String name) {
|
||||
@ -222,6 +222,7 @@ public class RegistryManager {
|
||||
registerBlock(QuickieBlocks.BLOCKSTACKERNORTH, "blockstackernorth");
|
||||
registerBlock(QuickieBlocks.BLOCKSTACKERSOUTH, "blockstackersouth");
|
||||
registerBlock(QuickieBlocks.BLOCKSPREADER, "blockspreader");
|
||||
registerBlock(QuickieBlocks.SULFORPAD, "sulforpad");
|
||||
}
|
||||
|
||||
public static final void registerItems() {
|
||||
|
@ -1,7 +1,14 @@
|
||||
package de.jottyfan.minecraft.quickiefabric.items;
|
||||
|
||||
import de.jottyfan.minecraft.quickiefabric.blocks.QuickieBlocks;
|
||||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemUsageContext;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -13,4 +20,18 @@ public class ItemSulphor extends Item {
|
||||
public ItemSulphor() {
|
||||
super(new FabricItemSettings());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult useOnBlock(ItemUsageContext context) {
|
||||
World world = context.getWorld();
|
||||
BlockPos pos = context.getBlockPos();
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
if (Blocks.LAVA_CAULDRON.equals(block)) {
|
||||
if (world.getBlockState(pos.up()).isAir()) {
|
||||
world.setBlockState(pos.up(), QuickieBlocks.SULFORPAD.getDefaultState());
|
||||
context.getStack().decrement(1);
|
||||
}
|
||||
}
|
||||
return ActionResult.PASS;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,12 @@
|
||||
{
|
||||
"variants": {
|
||||
"age=0": { "model": "quickiefabric:block/sulforpad0" },
|
||||
"age=1": { "model": "quickiefabric:block/sulforpad0" },
|
||||
"age=2": { "model": "quickiefabric:block/sulforpad0" },
|
||||
"age=3": { "model": "quickiefabric:block/sulforpad0" },
|
||||
"age=4": { "model": "quickiefabric:block/sulforpad1" },
|
||||
"age=5": { "model": "quickiefabric:block/sulforpad1" },
|
||||
"age=6": { "model": "quickiefabric:block/sulforpad1" },
|
||||
"age=7": { "model": "quickiefabric:block/sulforpad2" }
|
||||
}
|
||||
}
|
@ -79,6 +79,7 @@
|
||||
"block.quickiefabric.blockstackernorth": "Nordstapler",
|
||||
"block.quickiefabric.blockstackersouth": "Südstapler",
|
||||
"block.quickiefabric.blockspreader": "Blockverteiler",
|
||||
"block.quickiefabric.sulforpad": "Schwefelablagerung",
|
||||
"container.quickiefabric.backpack": "Rucksack",
|
||||
"container.quickiefabric.blockstacker": "Blockstapler",
|
||||
"msg.buildingplan.start": "beginne Konstruktionsaufnahme bei %s,%s,%s",
|
||||
|
@ -79,6 +79,7 @@
|
||||
"block.quickiefabric.blockstackernorth": "north stacker",
|
||||
"block.quickiefabric.blockstackersouth": "south stacker",
|
||||
"block.quickiefabric.blockspreader": "block spreader",
|
||||
"block.quickiefabric.sulforpad": "sulphur deposition",
|
||||
"container.quickiefabric.backpack": "backpack",
|
||||
"container.quickiefabric.blockstacker": "block stacker",
|
||||
"msg.buildingplan.start": "started recording of construction at %s,%s,%s",
|
||||
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
"ambientocclusion": false,
|
||||
"textures": {
|
||||
"particle": "quickiefabric:block/sulforpad0",
|
||||
"texture": "quickiefabric:block/sulforpad0"
|
||||
},
|
||||
"elements": [
|
||||
{ "from": [ 0, 0.25, 0 ],
|
||||
"to": [ 16, 0.25, 16 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 0, 16, 16, 0 ], "texture": "#texture" },
|
||||
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture" }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
"ambientocclusion": false,
|
||||
"textures": {
|
||||
"particle": "quickiefabric:block/sulforpad1",
|
||||
"texture": "quickiefabric:block/sulforpad1"
|
||||
},
|
||||
"elements": [
|
||||
{ "from": [ 0, 0.25, 0 ],
|
||||
"to": [ 16, 0.25, 16 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 0, 16, 16, 0 ], "texture": "#texture" },
|
||||
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture" }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
"ambientocclusion": false,
|
||||
"textures": {
|
||||
"particle": "quickiefabric:block/sulforpad2",
|
||||
"texture": "quickiefabric:block/sulforpad2"
|
||||
},
|
||||
"elements": [
|
||||
{ "from": [ 0, 0.25, 0 ],
|
||||
"to": [ 16, 0.25, 16 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 0, 16, 16, 0 ], "texture": "#texture" },
|
||||
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture" }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "item/coal",
|
||||
"textures": {
|
||||
"layer0": "quickiefabric:item/sulphorpad2"
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
Loading…
x
Reference in New Issue
Block a user