mirror of
https://github.com/dragonruler1000/hdm-mod.git
synced 2025-06-29 00:19:32 -05:00
Made the block of dust emmit light and made the subtle knife send a message to chat when used.
This commit is contained in:
parent
fd080d8e30
commit
170d0dbdef
2 changed files with 15 additions and 4 deletions
|
@ -2,6 +2,7 @@ package us.minecraftchest2.hdm_mod.block;
|
|||
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -14,14 +15,17 @@ import us.minecraftchest2.hdm_mod.item.ModItems;
|
|||
import us.minecraftchest2.hdm_mod.item.ModItemGroup;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
import java.util.function.ToIntFunction;
|
||||
|
||||
public class ModBlocks {
|
||||
// Dust Light Level
|
||||
public static ToIntFunction<BlockState> dustLightLevel = BlockState -> 10;
|
||||
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, Hdm_mod.MOD_ID);
|
||||
|
||||
|
||||
public static final RegistryObject<Block> DUST_BLOCK = registerBlock("block_of_dust",
|
||||
() -> new Block(AbstractBlock.Properties.create(Material.ROCK).doesNotBlockMovement().harvestLevel(0)
|
||||
.hardnessAndResistance(5f)));
|
||||
.hardnessAndResistance(500f, 100f).setLightLevel(dustLightLevel)));
|
||||
|
||||
|
||||
private static <T extends Block>RegistryObject<T> registerBlock(String name, Supplier<T> block) {
|
||||
|
|
|
@ -7,6 +7,9 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.ScoreTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
|
@ -23,9 +26,13 @@ public class SubtleKnife extends Item {
|
|||
// BlockPos pos =
|
||||
PlayerEntity player = context.getPlayer();
|
||||
|
||||
if(world.isRemote) {
|
||||
// world.setBlockState()
|
||||
}
|
||||
String message = "Item Used";
|
||||
ITextComponent msg = new StringTextComponent(message);
|
||||
assert player != null;
|
||||
player.sendMessage(msg, player.getUniqueID());
|
||||
// if(world.isRemote) {
|
||||
//
|
||||
// }
|
||||
return super.onItemUseFirst(stack, context);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue