-nochmal überprüft
-ein paar Kommentare hinzugefügt
-der Block ist jetzt nicht mehr durchsichtig
This commit is contained in:
Paula 2024-07-13 15:25:34 +02:00
parent e8fadaa2d5
commit a072d525a5
11 changed files with 16 additions and 41 deletions

View File

@ -1,37 +1,11 @@
package modchest.block.custom; package modchest.block.custom;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
public class suspiciousBlock extends Block { public class suspiciousBlock extends Block {
//beim rechtsklick mit einer schüssel kriegt man suspicious stew und der block wird kleiner -> siehe useBlockCallback
public suspiciousBlock(Settings settings) { public suspiciousBlock(Settings settings) {
super(settings); super(settings);
} }
/*public void onNeighborChanged(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving) {
if (this.isInContactWithWater(world, pos)) {
// Wenn Lava mit Wasser in Kontakt kommt, bestimmen wir, welcher Block entsteht.
Block blockToCreate = this.getBlockToCreate(world, pos);
world.setBlockState(pos, blockToCreate.getDefaultState());
}
}
public Block getBlockToCreate(World world, BlockPos pos) {
// Prüfen, ob die Lavaquelle stationär ist oder fließt.
boolean isSource = world.getBlockState(pos).getFluidState(). == 0;
if (isSource) {
return Blocks.OBSIDIAN;
} else {
return Blocks.COBBLESTONE;
}
}*/
} }

View File

@ -1,7 +1,7 @@
package modchest.block.custom; package modchest.block.custom;
public class suspiciousBlockMinusDrei extends suspiciousBlock { public class suspiciousBlockMinusDrei extends suspiciousBlock {
//siehe suspiciousBlock
public suspiciousBlockMinusDrei(Settings settings) { public suspiciousBlockMinusDrei(Settings settings) {
super(settings); super(settings);
} }

View File

@ -1,7 +1,7 @@
package modchest.block.custom; package modchest.block.custom;
public class suspiciousBlockMinusEins extends suspiciousBlock { public class suspiciousBlockMinusEins extends suspiciousBlock {
//siehe suspiciousBlock
public suspiciousBlockMinusEins(Settings settings) { public suspiciousBlockMinusEins(Settings settings) {
super(settings); super(settings);
} }

View File

@ -1,7 +1,7 @@
package modchest.block.custom; package modchest.block.custom;
public class suspiciousBlockMinusFuenf extends suspiciousBlock { public class suspiciousBlockMinusFuenf extends suspiciousBlock {
//siehe suspiciousBlock
public suspiciousBlockMinusFuenf(Settings settings) { public suspiciousBlockMinusFuenf(Settings settings) {
super(settings); super(settings);
} }

View File

@ -1,7 +1,7 @@
package modchest.block.custom; package modchest.block.custom;
public class suspiciousBlockMinusSechs extends suspiciousBlock { public class suspiciousBlockMinusSechs extends suspiciousBlock {
//siehe suspiciousBlock
public suspiciousBlockMinusSechs(Settings settings) { public suspiciousBlockMinusSechs(Settings settings) {
super(settings); super(settings);
} }

View File

@ -1,7 +1,7 @@
package modchest.block.custom; package modchest.block.custom;
public class suspiciousBlockMinusSieben extends suspiciousBlock { public class suspiciousBlockMinusSieben extends suspiciousBlock {
//siehe suspiciousBlock
public suspiciousBlockMinusSieben(Settings settings) { public suspiciousBlockMinusSieben(Settings settings) {
super(settings); super(settings);
} }

View File

@ -1,7 +1,7 @@
package modchest.block.custom; package modchest.block.custom;
public class suspiciousBlockMinusVier extends suspiciousBlock { public class suspiciousBlockMinusVier extends suspiciousBlock {
//siehe suspiciousBlock
public suspiciousBlockMinusVier(Settings settings) { public suspiciousBlockMinusVier(Settings settings) {
super(settings); super(settings);
} }

View File

@ -1,7 +1,7 @@
package modchest.block.custom; package modchest.block.custom;
public class suspiciousBlockMinusZwei extends suspiciousBlock { public class suspiciousBlockMinusZwei extends suspiciousBlock {
//siehe suspiciousBlock
public suspiciousBlockMinusZwei(Settings settings) { public suspiciousBlockMinusZwei(Settings settings) {
super(settings); super(settings);
} }

View File

@ -31,15 +31,18 @@ public class modBlocks {
modItemGroup.modchest); modItemGroup.modchest);
suspicious_block = registerBlock("suspicious_block", suspicious_block = registerBlock("suspicious_block",
new suspiciousBlock(FabricBlockSettings.of(Material.SPONGE).strength(1.0f).requiresTool()), new suspiciousBlock(FabricBlockSettings.of(Material.SPONGE).strength(1.0f).requiresTool()
.nonOpaque()),
modItemGroup.modchest); modItemGroup.modchest);
suspicious_block_minus_eins = registerBlock("suspicious_block_minus_eins", suspicious_block_minus_eins = registerBlock("suspicious_block_minus_eins",
new suspiciousBlock(FabricBlockSettings.of(Material.SPONGE).strength(1.0f).requiresTool()), new suspiciousBlock(FabricBlockSettings.of(Material.SPONGE).strength(1.0f).requiresTool()
.nonOpaque()),
modItemGroup.modchest); modItemGroup.modchest);
suspicious_block_minus_zwei = registerBlock("suspicious_block_minus_zwei", suspicious_block_minus_zwei = registerBlock("suspicious_block_minus_zwei",
new suspiciousBlock(FabricBlockSettings.of(Material.SPONGE).strength(1.0f).requiresTool()), new suspiciousBlock(FabricBlockSettings.of(Material.SPONGE).strength(1.0f).requiresTool()
.nonOpaque()),
modItemGroup.modchest); modItemGroup.modchest);
suspicious_block_minus_drei = registerBlock("suspicious_block_minus_drei", suspicious_block_minus_drei = registerBlock("suspicious_block_minus_drei",

View File

@ -16,7 +16,7 @@ public class useBlockCallback implements UseBlockCallback {
public ActionResult interact(PlayerEntity player, World world, Hand hand, BlockHitResult hitResult) { public ActionResult interact(PlayerEntity player, World world, Hand hand, BlockHitResult hitResult) {
BlockPos pos = hitResult.getBlockPos(); BlockPos pos = hitResult.getBlockPos();
BlockState state = world.getBlockState(hitResult.getBlockPos()); BlockState state = world.getBlockState(hitResult.getBlockPos());
String hitResultString = world.getBlockState(hitResult.getBlockPos()).getBlock().toString(); String hitResultString = state.getBlock().toString();
if (player.getMainHandStack().getItem().equals(Items.BOWL)) { if (player.getMainHandStack().getItem().equals(Items.BOWL)) {
if (hitResultString.equals("Block{modchest:suspicious_block}") || if (hitResultString.equals("Block{modchest:suspicious_block}") ||

View File

@ -1,5 +1,5 @@
{ {
"type": "minecraft:crafting_shaped", "type": "minecraft:crafting_shaped",
"pattern": [ "pattern": [
"MMM", "MMM",
"M#M", "M#M",
@ -9,12 +9,10 @@
"M":{ "M":{
"item": "minecraft:honeycomb_block" "item": "minecraft:honeycomb_block"
}, },
"#":{ "#":{
"item": "minecraft:water_bucket" "item": "minecraft:water_bucket"
} }
}, },
"result": { "result": {
"item": "modchest:suspicious_block" "item": "modchest:suspicious_block"
} }