use of net.minecraft.util.text.TextComponentString in project VanillaTeleporter by dyeo.
the class CommandTeleporters method execute.
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
TeleporterNetwork network = TeleporterNetwork.get(sender.getEntityWorld());
TextComponentString chat = new TextComponentString("--- There are currently " + network.getSubnets().size() + " teleporter networks ---");
chat.getStyle().setColor(TextFormatting.DARK_GREEN);
sender.sendMessage(chat);
Iterator<String> it = network.getSubnets().iterator();
while (it.hasNext()) {
String s = it.next();
chat = new TextComponentString("(" + network.getSubnetSize(s) + ") " + s);
sender.sendMessage(chat);
}
}
use of net.minecraft.util.text.TextComponentString in project Geolosys by oitsjustjose.
the class BlockSample method registerEvent.
@SubscribeEvent
public void registerEvent(BlockEvent.HarvestDropsEvent event) {
if (!Config.getInstance().boringSamples || event.getHarvester() == null || event.getState() == null || event.getState().getBlock() != this) {
return;
}
String resource = Types.Modded.byMetadata(event.getState().getBlock().getMetaFromState(event.getState())).getResource();
event.getHarvester().sendStatusMessage(new TextComponentString("You break the sample to find " + resource), true);
event.getDrops().clear();
}
use of net.minecraft.util.text.TextComponentString in project Geolosys by oitsjustjose.
the class BlockSample method onBlockActivated.
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (Config.getInstance().boringSamples) {
String resource = Types.Modded.byMetadata(state.getBlock().getMetaFromState(state)).getResource();
playerIn.sendStatusMessage(new TextComponentString("You break the sample to find " + resource), true);
} else {
this.dropBlockAsItem(worldIn, pos, state, 0);
}
worldIn.setBlockToAir(pos);
playerIn.swingArm(EnumHand.MAIN_HAND);
return true;
}
use of net.minecraft.util.text.TextComponentString in project Geolosys by oitsjustjose.
the class ItemProPick method onItemUse.
@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (worldIn.isRemote) {
player.swingArm(hand);
return EnumActionResult.PASS;
}
int xStart;
int xEnd;
int yStart;
int yEnd;
int zStart;
int zEnd;
int confAmt = Config.getInstance().proPickRange;
boolean found = false;
switch(facing) {
case UP:
xStart = -(confAmt / 2);
xEnd = confAmt / 2;
yStart = -confAmt;
yEnd = 0;
zStart = -(confAmt / 2);
zEnd = (confAmt / 2);
for (int x = xStart; x <= xEnd; x++) {
for (int y = yStart; y <= yEnd; y++) {
for (int z = zStart; z <= zEnd; z++) {
IBlockState state = worldIn.getBlockState(pos.add(x, y, z));
if (state.getBlock() instanceof BlockOre || state.getBlock() instanceof BlockOreVanilla || Geolosys.getInstance().userStates.contains(state)) {
foundMessage(player, state, facing);
found = true;
break;
}
}
}
}
break;
case DOWN:
xStart = -(confAmt / 2);
xEnd = confAmt / 2;
yStart = 0;
yEnd = confAmt;
zStart = -(confAmt / 2);
zEnd = confAmt / 2;
for (int x = xStart; x <= xEnd; x++) {
for (int y = yStart; y <= yEnd; y++) {
for (int z = zStart; z <= zEnd; z++) {
IBlockState state = worldIn.getBlockState(pos.add(x, y, z));
if (state.getBlock() instanceof BlockOre || state.getBlock() instanceof BlockOreVanilla || Geolosys.getInstance().userStates.contains(state)) {
foundMessage(player, state, facing);
found = true;
break;
}
}
}
}
break;
case NORTH:
xStart = -(confAmt / 2);
xEnd = confAmt / 2;
yStart = -(confAmt / 2);
yEnd = confAmt / 2;
zStart = 0;
zEnd = confAmt;
for (int x = xStart; x <= xEnd; x++) {
for (int y = yStart; y <= yEnd; y++) {
for (int z = zStart; z <= zEnd; z++) {
IBlockState state = worldIn.getBlockState(pos.add(x, y, z));
if (state.getBlock() instanceof BlockOre || state.getBlock() instanceof BlockOreVanilla || Geolosys.getInstance().userStates.contains(state)) {
foundMessage(player, state, facing);
found = true;
break;
}
}
}
}
break;
case SOUTH:
xStart = -(confAmt / 2);
xEnd = confAmt / 2;
yStart = -(confAmt / 2);
yEnd = confAmt / 2;
zStart = -confAmt;
zEnd = 0;
for (int x = xStart; x <= xEnd; x++) {
for (int y = yStart; y <= yEnd; y++) {
for (int z = zStart; z <= zEnd; z++) {
IBlockState state = worldIn.getBlockState(pos.add(x, y, z));
if (state.getBlock() instanceof BlockOre || state.getBlock() instanceof BlockOreVanilla || Geolosys.getInstance().userStates.contains(state)) {
foundMessage(player, state, facing);
found = true;
break;
}
}
}
}
break;
case EAST:
xStart = -(confAmt);
xEnd = 0;
yStart = -(confAmt / 2);
yEnd = confAmt / 2;
zStart = -(confAmt / 2);
zEnd = confAmt / 2;
for (int x = xStart; x <= xEnd; x++) {
for (int y = yStart; y <= yEnd; y++) {
for (int z = zStart; z <= zEnd; z++) {
IBlockState state = worldIn.getBlockState(pos.add(x, y, z));
if (state.getBlock() instanceof BlockOre || state.getBlock() instanceof BlockOreVanilla || Geolosys.getInstance().userStates.contains(state)) {
foundMessage(player, state, facing);
found = true;
break;
}
}
}
}
break;
case WEST:
xStart = 0;
xEnd = confAmt;
yStart = -(confAmt / 2);
yEnd = confAmt / 2;
zStart = -(confAmt / 2);
zEnd = confAmt / 2;
for (int x = xStart; x <= xEnd; x++) {
for (int y = yStart; y <= yEnd; y++) {
for (int z = zStart; z <= zEnd; z++) {
IBlockState state = worldIn.getBlockState(pos.add(x, y, z));
if (state.getBlock() instanceof BlockOre || state.getBlock() instanceof BlockOreVanilla || Geolosys.getInstance().userStates.contains(state)) {
foundMessage(player, state, facing);
found = true;
break;
}
}
}
}
break;
}
if (!found) {
player.sendStatusMessage(new TextComponentString("No deposits found"), true);
}
player.swingArm(hand);
return EnumActionResult.SUCCESS;
}
use of net.minecraft.util.text.TextComponentString in project SpongeCommon by SpongePowered.
the class MixinServerStatusResponse method setServerDescription.
/**
* @author minecrell - January 18th, 2015
* @reason Use our Text API
*
* @param motd The message of the day to set
*/
@Overwrite
public void setServerDescription(@Nullable ITextComponent motd) {
if (motd != null) {
this.description = motd;
this.descriptionText = SpongeTexts.toText(motd);
} else {
this.description = new TextComponentString("");
this.descriptionText = Text.of();
}
}
Aggregations