Skip to content

Commit

Permalink
🥚 Easter egg
Browse files Browse the repository at this point in the history
  • Loading branch information
ZiYueCommentary committed Dec 17, 2023
1 parent 489f489 commit 32b4f5f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import ziyue.tjmetro.BlockEntityTypes;
import ziyue.tjmetro.TianjinMetro;
import ziyue.tjmetro.blocks.base.BlockStationNameSignBase;

/**
Expand All @@ -36,9 +37,9 @@ public BlockStationNameSign2(Properties properties) {

@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult) {
if (player.getName().toString().equals("EnderkingIIII")) { //easter egg lol
if (player.getName().toString().equals("EnderkingIIII")) { // Easter egg #1 lol
world.explode(player, DamageSource.MAGIC, new ExplosionDamageCalculator(), player.getX(), player.getY(), player.getZ(), 5f, true, Explosion.BlockInteraction.DESTROY);
LOGGER.warn("EnderkingIIII found!");
TianjinMetro.LOGGER.warn("EnderkingIIII found!");
}
return super.use(state, world, pos, player, interactionHand, blockHitResult);
}
Expand Down
20 changes: 20 additions & 0 deletions common/src/main/java/ziyue/tjmetro/blocks/BlockTimeDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@
import mtr.mappings.BlockEntityClientSerializableMapper;
import mtr.mappings.BlockEntityMapper;
import mtr.mappings.EntityBlockMapper;
import mtr.mappings.Text;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
import net.minecraft.world.level.block.SimpleWaterloggedBlock;
Expand All @@ -17,10 +24,12 @@
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.Nullable;
import ziyue.tjmetro.BlockEntityTypes;
import ziyue.tjmetro.TianjinMetro;

import static net.minecraft.world.level.block.state.properties.BlockStateProperties.WATERLOGGED;

Expand All @@ -47,6 +56,17 @@ public BlockState getStateForPlacement(BlockPlaceContext blockPlaceContext) {
return defaultBlockState().setValue(FACING, blockPlaceContext.getHorizontalDirection()).setValue(WATERLOGGED, false);
}

@Override
public InteractionResult use(BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult) {
// Easter egg #2
return IBlock.checkHoldingItem(level, player, item -> {
if (player.getItemInHand(interactionHand).getDisplayName().getString().equals("[Lim22371]")) {
TianjinMetro.LOGGER.warn("Oh no capybara here");
((ServerPlayer) player).connection.disconnect(Text.literal("No capybara please"));
}
}, null, Items.NAME_TAG);
}

@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(FACING, WATERLOGGED);
Expand Down

0 comments on commit 32b4f5f

Please sign in to comment.