本文整理汇总了Java中com.austinv11.collectiveframework.minecraft.utils.Colors类的典型用法代码示例。如果您正苦于以下问题:Java Colors类的具体用法?Java Colors怎么用?Java Colors使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Colors类属于com.austinv11.collectiveframework.minecraft.utils包,在下文中一共展示了Colors类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRenderString
import com.austinv11.collectiveframework.minecraft.utils.Colors; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onRenderString(RenderStringEvent event) {
if (Config.applyColorPatch)
event.stringToRender = Colors.replaceAlternateColorChar(event.stringToRender);
if (Config.enableCloudToButt) {
String string = event.stringToRender;
if (string.toLowerCase().contains("cloud")) {
string = StringUtils.replaceAllPreservingCase(string, "the cloud", "my butt");
string = StringUtils.replaceAllPreservingCase(string, "cloud", "butt");
event.stringToRender = string;
}
}
if (event.stringToRender.toLowerCase().contains("konga")) {
kongaTime = true;
kongaTick = START_KONGA_TIME;
}
}
示例2: onBlockActivated
import com.austinv11.collectiveframework.minecraft.utils.Colors; //导入依赖的package包/类
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int meta, float hitX, float hitY, float hitZ) {
if (player.getCurrentEquippedItem() == null || !((player.getCurrentEquippedItem().getItem() instanceof ItemSmartHelmet)
|| (player.getCurrentEquippedItem().getItem() instanceof ItemNanoSwarm)))
return false;
if (!world.isRemote) {
TileEntityAntenna antenna = (TileEntityAntenna) world.getTileEntity(x,y,z);
UUID id = antenna.identifier;
NBTHelper.setString(player.getCurrentEquippedItem(), "identifier", id.toString());
List<String> info = new ArrayList<String>();
if (antenna.getLabel() == null) {
info.add(Colors.RESET.toString() + Colors.GRAY + id.toString());
}
else {
String label = antenna.getLabel();
info.add(Colors.RESET.toString() + Colors.GRAY + label);
NBTHelper.setString(player.getCurrentEquippedItem(), "label", label);
}
NBTHelper.setInfo(player.getCurrentEquippedItem(), info);
}
return true;
}
示例3: invalidate
import com.austinv11.collectiveframework.minecraft.utils.Colors; //导入依赖的package包/类
@Override
public void invalidate() {
super.invalidate();
if (!worldObj.isRemote) {
ItemStack drop = new ItemStack(ModBlocks.peripheralContainer);
if (peripheralsContained.size() > 0) {
NBTTagCompound tag = new NBTTagCompound();
this.writeToNBT(tag);
drop.stackTagCompound = tag;
List<String> text = new ArrayList<String>();
text.add(Colors.RESET.toString()+Colors.UNDERLINE+"Contained Peripherals:");
for (int id : NBTHelper.getIntArray(drop, "ids")) {
Block peripheral = Block.getBlockById(id);
IPeripheral iPeripheral = (IPeripheral) peripheral.createTileEntity(null, 0);
text.add(Colors.RESET+iPeripheral.getType());
}
NBTHelper.setInfo(drop, text);
}
worldObj.spawnEntityInWorld(new EntityItem(worldObj, xCoord, yCoord+1, zCoord, drop.copy()));
}
}
示例4: getNBTTooltip
import com.austinv11.collectiveframework.minecraft.utils.Colors; //导入依赖的package包/类
private List<String> getNBTTooltip(ItemStack stack) {
List<String> tooltip = new ArrayList<String>();
if (stack.hasTagCompound()) {
tooltip.add(Colors.UNDERLINE+"NBT Tags:");
tooltip.add(stack.getTagCompound().toString());
}
return tooltip;
}
示例5: getOreDictTooltip
import com.austinv11.collectiveframework.minecraft.utils.Colors; //导入依赖的package包/类
private List<String> getOreDictTooltip(ItemStack stack) {
List<String> tooltip = new ArrayList<String>();
if (OreDictionary.getOreIDs(stack).length > 0) {
tooltip.add(Colors.UNDERLINE+"Ore Dictionary Entries:");
for (int id : OreDictionary.getOreIDs(stack)) {
tooltip.add("-"+OreDictionary.getOreName(id)+" (id: "+id+")");
}
}
return tooltip;
}
示例6: getUnlocalisedName
import com.austinv11.collectiveframework.minecraft.utils.Colors; //导入依赖的package包/类
private List<String> getUnlocalisedName(ItemStack stack) {
List<String> tooltip = new ArrayList<String>();
tooltip.add(Colors.UNDERLINE+"String Item ID:");
Item item = stack.getItem();
if (item instanceof ItemBlock) {
Block block = Block.getBlockFromItem(item);
tooltip.add(Block.blockRegistry.getNameForObject(block));
} else {
tooltip.add(Item.itemRegistry.getNameForObject(item));
}
return tooltip;
}
示例7: addInformation
import com.austinv11.collectiveframework.minecraft.utils.Colors; //导入依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemStack, EntityPlayer player, List information, boolean isAdvanced) {
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
information.add(Colors.AQUA+StatCollector.translateToLocal("lore.upgradeTome.tier")+": "+Colors.YELLOW+NBTHelper.getInt(itemStack, "tier"));
information.add(Colors.AQUA+StatCollector.translateToLocal("lore.upgradeTome.xp")+": "+Colors.YELLOW+NBTHelper.getInt(itemStack, "xp"));
int xpNeeded = getXpNeededForNextTier(itemStack);
if (xpNeeded >= 0)
information.add(Colors.AQUA+StatCollector.translateToLocal("lore.upgradeTome.xpToNextTier")+": "+Colors.YELLOW+xpNeeded);
} else
information.add(Colors.GRAY+StatCollector.translateToLocal("lore.shiftMessage"));
}
示例8: getBookFromInt
import com.austinv11.collectiveframework.minecraft.utils.Colors; //导入依赖的package包/类
public static ItemStack getBookFromInt(int type) {
ItemStack stack = new ItemStack(Items.written_book);
switch (type) {
case 0:
stack.stackTagCompound = Util.writeToBookNBT("peripheralsplusplus.lore.1.title", Colors.MAGIC+"dan200", getTextFromInt(type));
break;
case 1:
stack.stackTagCompound = Util.writeToBookNBT("peripheralsplusplus.lore.2.title", Colors.MAGIC+"dan200", getTextFromInt(type));
break;
case 2:
stack.stackTagCompound = Util.writeToBookNBT("peripheralsplusplus.lore.3.title", Colors.MAGIC+"dan200", getTextFromInt(type));
break;
}
return stack;
}
示例9: onImpact
import com.austinv11.collectiveframework.minecraft.utils.Colors; //导入依赖的package包/类
@Override
protected void onImpact(MovingObjectPosition mop) {
if (!worldObj.isRemote) {
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) {
mop.entityHit.attackEntityFrom(new DamageSource(Reference.MOD_ID.toLowerCase()+".nanobots"), 0);
ItemNanoSwarm.addSwarmForEntity(this, mop.entityHit);
} else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
ItemStack stack = new ItemStack(ModItems.nanoSwarm);
NBTHelper.setString(stack, "identifier", antennaIdentifier.toString());
List<String> info = new ArrayList<String>();
if (label == null) {
info.add(Colors.RESET.toString()+Colors.GRAY+antennaIdentifier.toString());
} else {
info.add(Colors.RESET.toString()+Colors.GRAY+label);
NBTHelper.setString(stack, "label", label);
}
NBTHelper.setInfo(stack, info);
ForgeDirection direction = ForgeDirection.getOrientation(mop.sideHit);
EntityItem entityItem = new EntityItem(this.worldObj, this.posX+direction.offsetX, this.posY+direction.offsetY,
this.posZ+direction.offsetZ, stack);
worldObj.spawnEntityInWorld(entityItem);
}
this.setDead();
}
}
示例10: getCraftingResult
import com.austinv11.collectiveframework.minecraft.utils.Colors; //导入依赖的package包/类
@Override
public ItemStack getCraftingResult(InventoryCrafting craftingInventory) {
HashMap<Integer,IPeripheral> map = new HashMap<Integer,IPeripheral>();
ItemStack base = new ItemStack(ModBlocks.peripheralContainer);
for (int i = 0; i < craftingInventory.getSizeInventory(); i++)
if (craftingInventory.getStackInSlot(i) != null)
if (Block.getBlockFromItem(craftingInventory.getStackInSlot(i).getItem()) instanceof IPeripheralProvider && !(Block.getBlockFromItem(craftingInventory.getStackInSlot(i).getItem()) instanceof BlockPeripheralContainer)) {
TileEntity ent = Block.getBlockFromItem(craftingInventory.getStackInSlot(i).getItem()).createTileEntity(null, 0);
if (ent != null && ent instanceof IPeripheral)
map.put(Block.getIdFromBlock(Block.getBlockFromItem(craftingInventory.getStackInSlot(i).getItem())), (IPeripheral)ent);
}else if (Block.getBlockFromItem(craftingInventory.getStackInSlot(i).getItem()) instanceof BlockPeripheralContainer)
base.stackTagCompound = craftingInventory.getStackInSlot(i).stackTagCompound == null ? null : (NBTTagCompound) craftingInventory.getStackInSlot(i).stackTagCompound.copy();
List<String> text = new ArrayList<String>();
if (base.stackTagCompound == null || base.stackTagCompound.hasNoTags() || !base.stackTagCompound.hasKey("ids")) {
NBTHelper.setIntArray(base, "ids", setToArray(map.keySet()));
text.add(Colors.RESET.toString()+Colors.UNDERLINE+"Contained Peripherals:");
for (IPeripheral p : map.values())
text.add(Colors.RESET+p.getType());
NBTHelper.addInfo(base, text);
} else {
text.add(Colors.RESET.toString()+Colors.UNDERLINE+"Contained Peripherals:");
int[] ids = NBTHelper.getIntArray(base, "ids");
int[] newIds = new int[ids.length+map.size()];
for (int j = 0; j < ids.length+map.size(); j++)
newIds[j] = j >= ids.length ? (Integer)map.keySet().toArray()[j-ids.length] : ids[j];
NBTHelper.setIntArray(base, "ids", newIds);
for (int id : newIds) {
Block peripheral = Block.getBlockById(id);
IPeripheral iPeripheral = (IPeripheral)peripheral.createTileEntity(null, 0);
text.add(Colors.RESET+iPeripheral.getType());
}
NBTHelper.setInfo(base, text);
}
return base;
}
示例11: onInteract
import com.austinv11.collectiveframework.minecraft.utils.Colors; //导入依赖的package包/类
@SubscribeEvent
public void onInteract(PlayerInteractEvent event) {
if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_AIR)
if (event.entityPlayer.getCurrentEquippedItem() != null && event.entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemBlockPeripheralContainer) {
InventoryPlayer inv = event.entityPlayer.inventory;
List<String> text = new ArrayList<String>();
ItemStack stack = event.entityPlayer.getCurrentEquippedItem();
NBTHelper.removeInfo(stack);
text.add(Colors.RESET.toString()+Colors.UNDERLINE+"Contained Peripherals:");
int[] ids = NBTHelper.getIntArray(stack, "ids");
if (ids.length > 0) {
if (ids.length > 1) {
int[] newIds = new int[ids.length-1];
for (int j = 0; j < ids.length-1; j++)
newIds[j] = ids[j+1];
NBTHelper.setIntArray(stack, "ids", newIds);
for (int id : newIds) {
Block peripheral = Block.getBlockById(id);
IPeripheral iPeripheral = (IPeripheral) peripheral.createTileEntity(null, 0);
text.add(Colors.RESET+iPeripheral.getType());
}
if (text.size() > 1)
NBTHelper.setInfo(stack, text);
} else {
NBTHelper.removeTag(stack, "ids");
}
inv.addItemStackToInventory(new ItemStack(Block.getBlockById(ids[0])));
}
}
}