forgot you could add in creative mode, add when placed
This commit is contained in:
parent
1bd736dca8
commit
a997f309c5
|
@ -1,9 +1,13 @@
|
|||
package com.futhark.block;
|
||||
|
||||
import com.futhark.RuneData;
|
||||
import com.futhark.RuneType;
|
||||
import com.futhark.StateSaverAndLoader;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
|
@ -13,6 +17,7 @@ import net.minecraft.util.Hand;
|
|||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class RuneBlock extends Block {
|
||||
|
||||
|
@ -32,6 +37,21 @@ public class RuneBlock extends Block {
|
|||
return ActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) {
|
||||
super.onPlaced(world, pos, state, placer, itemStack);
|
||||
|
||||
MinecraftServer server = world.getServer();
|
||||
if (server != null) {
|
||||
StateSaverAndLoader serverState = StateSaverAndLoader.getServerState(server);
|
||||
serverState.totalNumberOfRunes += 1;
|
||||
RuneData runeData = new RuneData();
|
||||
runeData.type = RuneType.UNKNOWN;
|
||||
runeData.pos = pos;
|
||||
serverState.runes.put(pos, runeData);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) {
|
||||
super.onBreak(world, pos, state, player);
|
||||
|
|
Loading…
Reference in New Issue