use of net.minecraft.util.text.ITextComponent in project BloodMagic by WayofTime.
the class ModRecipes method addLivingArmourDowngradeRecipes.
public static void addLivingArmourDowngradeRecipes() {
String messageBase = "ritual.bloodmagic.downgradeRitual.dialogue.";
ItemStack bowStack = new ItemStack(Items.BOW);
ItemStack bottleStack = new ItemStack(Items.POTIONITEM, 1, 0);
ItemStack swordStack = new ItemStack(Items.STONE_SWORD);
ItemStack goldenAppleStack = new ItemStack(Items.GOLDEN_APPLE);
ItemStack fleshStack = new ItemStack(Items.ROTTEN_FLESH);
ItemStack shieldStack = new ItemStack(Items.SHIELD);
ItemStack pickStack = new ItemStack(Items.STONE_PICKAXE);
ItemStack minecartStack = new ItemStack(Items.MINECART);
ItemStack stringStack = new ItemStack(Items.STRING);
Map<ItemStack, Pair<String, int[]>> dialogueMap = new HashMap<>();
dialogueMap.put(bowStack, Pair.of("bow", new int[] { 1, 100, 300, 500 }));
dialogueMap.put(bottleStack, Pair.of("quenched", new int[] { 1, 100, 300, 500 }));
dialogueMap.put(swordStack, Pair.of("dulledBlade", new int[] { 1, 100, 300, 500, 700 }));
dialogueMap.put(goldenAppleStack, Pair.of("slowHeal", new int[] { 1, 100, 300, 500, 700 }));
for (Entry<ItemStack, Pair<String, int[]>> entry : dialogueMap.entrySet()) {
ItemStack keyStack = entry.getKey();
String str = entry.getValue().getKey();
Map<Integer, List<ITextComponent>> textMap = new HashMap<>();
for (int tick : entry.getValue().getValue()) {
List<ITextComponent> textList = new ArrayList<>();
textList.add(new TextComponentTranslation("\u00A74%s", new TextComponentTranslation(messageBase + str + "." + tick)));
textMap.put(tick, textList);
}
LivingArmourDowngradeRecipeRegistry.registerDialog(keyStack, textMap);
}
LivingArmourDowngradeRecipeRegistry.registerRecipe(new LivingArmourUpgradeStormTrooper(0), bowStack, Items.ARROW, "string", "ingotIron", "ingotIron");
LivingArmourDowngradeRecipeRegistry.registerRecipe(new LivingArmourUpgradeStormTrooper(1), bowStack, Items.SPECTRAL_ARROW, "ingotGold", "dustRedstone", "dustGlowstone", "gemLapis");
LivingArmourDowngradeRecipeRegistry.registerRecipe(new LivingArmourUpgradeStormTrooper(2), bowStack, "gemDiamond", Items.FIRE_CHARGE, Items.BLAZE_ROD, "feather");
LivingArmourDowngradeRecipeRegistry.registerRecipe(new LivingArmourUpgradeStormTrooper(3), bowStack, Items.PRISMARINE_SHARD, Items.BLAZE_ROD, "feather", "feather");
LivingArmourDowngradeRecipeRegistry.registerRecipe(new LivingArmourUpgradeStormTrooper(4), bowStack, new ItemStack(Items.TIPPED_ARROW, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Items.TIPPED_ARROW, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Items.TIPPED_ARROW, 1, OreDictionary.WILDCARD_VALUE));
// LivingArmourDowngradeRecipeRegistry.registerDialog(bowStack, bowMap);
LivingArmourDowngradeRecipeRegistry.registerRecipe(new LivingArmourUpgradeQuenched(0), bottleStack, Items.DRAGON_BREATH);
LivingArmourDowngradeRecipeRegistry.registerRecipe(new LivingArmourUpgradeCrippledArm(0), shieldStack, "gemDiamond");
for (int i = 0; i < 10; i++) {
addRecipeForTieredDowngrade(new LivingArmourUpgradeMeleeDecrease(i), swordStack, i);
addRecipeForTieredDowngrade(new LivingArmourUpgradeSlowHeal(i), goldenAppleStack, i);
addRecipeForTieredDowngrade(new LivingArmourUpgradeBattleHungry(i), fleshStack, i);
addRecipeForTieredDowngrade(new LivingArmourUpgradeDigSlowdown(i), pickStack, i);
addRecipeForTieredDowngrade(new LivingArmourUpgradeDisoriented(i), minecartStack, i);
addRecipeForTieredDowngrade(new LivingArmourUpgradeSlowness(i), stringStack, i);
}
}
use of net.minecraft.util.text.ITextComponent in project pnc-repressurized by TeamPneumatic.
the class EntityDrone method onDeath.
@Override
public void onDeath(DamageSource par1DamageSource) {
for (int i = 0; i < inventory.getSlots(); i++) {
if (!inventory.getStackInSlot(i).isEmpty()) {
entityDropItem(inventory.getStackInSlot(i), 0);
inventory.setStackInSlot(i, ItemStack.EMPTY);
}
}
if (!naturallySpawned) {
ItemStack drone = getDroppedStack();
if (hasCustomName())
drone.setStackDisplayName(getCustomNameTag());
entityDropItem(drone, 0);
if (!world.isRemote) {
EntityPlayer owner = getOwner();
if (owner != null) {
int x = (int) Math.floor(posX);
int y = (int) Math.floor(posY);
int z = (int) Math.floor(posZ);
ITextComponent msg = hasCustomName() ? new TextComponentTranslation("death.drone.named", getCustomNameTag(), x, y, z) : new TextComponentTranslation("death.drone", x, y, z);
msg = msg.appendSibling(new TextComponentString(" - ")).appendSibling(par1DamageSource.getDeathMessage(this));
owner.sendStatusMessage(msg, false);
}
}
}
if (!world.isRemote)
getFakePlayer().interactionManager.cancelDestroyingBlock();
super.onDeath(par1DamageSource);
}
use of net.minecraft.util.text.ITextComponent in project LogisticsPipes by RS485.
the class LPChatListener method clientChat.
@SubscribeEvent
public void clientChat(ClientChatReceivedEvent event) {
ITextComponent message = event.getMessage();
if (message != null) {
String realMessage = null;
try {
realMessage = message.getFormattedText();
} catch (ClassCastException e) {
// Ignore that
} catch (Exception e) {
e.printStackTrace();
}
if (realMessage != null) {
if (realMessage.equals("%LPCLEARCHAT%")) {
clearChat();
event.setCanceled(true);
}
if (realMessage.equals("%LPSTORESENDMESSAGE%")) {
storeSendMessages();
event.setCanceled(true);
}
if (realMessage.equals("%LPRESTORESENDMESSAGE%")) {
restoreSendMessages();
event.setCanceled(true);
}
if (realMessage.startsWith("%LPADDTOSENDMESSAGE%")) {
addSendMessages(realMessage.substring(20));
event.setCanceled(true);
}
if (realMessage.contains("LPDISPLAYMISSING") && LogisticsPipes.isDEBUG()) {
System.out.println("LIST:");
StringUtils.UNTRANSLATED_STRINGS.forEach(System.out::println);
}
}
}
}
use of net.minecraft.util.text.ITextComponent in project RecurrentComplex by Ivorforce.
the class GuiHider method hideGUI.
public static boolean hideGUI(Visualizer visualizer) {
if (!canHide())
return false;
Minecraft mc = Minecraft.getMinecraft();
hiddenGUI = mc.currentScreen;
GuiHider.visualizer = visualizer;
if (hiddenGUI == null)
return false;
mc.displayGuiScreen(null);
ITextComponent reopen = new TextComponentString("/" + RCCommands.reopen.getName());
reopen.getStyle().setColor(TextFormatting.GREEN);
reopen.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/" + RCCommands.reopen.getName()));
reopen.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, RecurrentComplex.translations.get("commands.rcreopen.run")));
mc.player.sendMessage(RecurrentComplex.translations.format("commands.rc.didhide", reopen));
return true;
}
use of net.minecraft.util.text.ITextComponent in project RecurrentComplex by Ivorforce.
the class CommandSightInfo method execute.
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
Parameters parameters = Parameters.of(args, expect()::declare);
WorldStructureGenerationData generationData = WorldStructureGenerationData.get(sender.getEntityWorld());
WorldStructureGenerationData.Entry entry = generationData.getEntry(UUID.fromString(parameters.get(0).require()));
if (entry == null)
throw RecurrentComplex.translations.commandException("commands.rcsightinfo.unknown");
else {
ITextComponent area = RCTextStyle.area(RCBlockAreas.from(entry.getBoundingBox()));
ITextComponent sight = RCTextStyle.sight(entry, true);
if (entry instanceof WorldStructureGenerationData.StructureEntry) {
WorldStructureGenerationData.StructureEntry structureEntry = (WorldStructureGenerationData.StructureEntry) entry;
sender.sendMessage(new TextComponentTranslation("commands.rcsightinfo.structure", RCTextStyle.structure(structureEntry.getStructureID()), area, RCTextStyle.copy(String.valueOf(structureEntry.getSeed())), sight));
Structure structure = StructureRegistry.INSTANCE.get(structureEntry.getStructureID());
if (structure != null) {
// TODO generateAsSource not accurate
NBTStorable instanceData = structure.loadInstanceData(new StructureLoadContext(structureEntry.getTransform(), entry.getBoundingBox(), false), structureEntry.getInstanceData(), RCConfig.getUniversalTransformer());
List<TextComponentBase> list = structure.instanceDataInfo(instanceData);
for (TextComponentBase s : list) sender.sendMessage(s);
}
} else
sender.sendMessage(new TextComponentTranslation("commands.rcsightinfo.get", entry.description(), area, sight));
}
}
Aggregations