本文整理匯總了Java中net.minecraft.block.BlockColored類的典型用法代碼示例。如果您正苦於以下問題:Java BlockColored類的具體用法?Java BlockColored怎麽用?Java BlockColored使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BlockColored類屬於net.minecraft.block包,在下文中一共展示了BlockColored類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: generate
import net.minecraft.block.BlockColored; //導入依賴的package包/類
@Override
public boolean generate(World worldIn, Random rand, BlockPos position) {
BlockPos cur = NeoHellGenerators.findSurface(worldIn, position);
if (cur==null) return false;
IBlockState norfairite = TWBlocks.NORFAIRITE_CLEAR.getDefaultState().withProperty(BlockColored.COLOR, EnumDyeColor.GREEN);
ArrayList<BlockPos> bushArea = new ArrayList<BlockPos>();
NeoHellGenerators.sphereAround(cur.up(), 1.5f + rand.nextFloat(), bushArea);
for(BlockPos leaf : bushArea) {
IBlockState state = worldIn.getBlockState(leaf);
if (state.getBlock().canBeReplacedByLeaves(state, worldIn, leaf)) {
worldIn.setBlockState(leaf, norfairite);
}
}
return true;
}
示例2: itemInteractionForEntity
import net.minecraft.block.BlockColored; //導入依賴的package包/類
/**
* Returns true if the item can be used on the given entity, e.g. shears on sheep.
*/
public boolean itemInteractionForEntity(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, EntityLivingBase par3EntityLivingBase)
{
if (par3EntityLivingBase instanceof EntitySheep)
{
EntitySheep var4 = (EntitySheep)par3EntityLivingBase;
int var5 = BlockColored.func_150032_b(par1ItemStack.getItemDamage());
if (!var4.getSheared() && var4.getFleeceColor() != var5)
{
var4.setFleeceColor(var5);
--par1ItemStack.stackSize;
}
return true;
}
else
{
return false;
}
}
示例3: interact
import net.minecraft.block.BlockColored; //導入依賴的package包/類
@Override
public boolean interact(EntityPlayer player) {
ItemStack stack = player.inventory.getCurrentItem();
if (stack != null) {
if (InventoryHelper.isDye(stack)) {
int i = BlockColored.func_150032_b(InventoryHelper.getDyeMetaFromOreDict(stack));
if (!this.getSheared() && this.getFleeceColor() != i) {
this.setFleeceColor(i);
--stack.stackSize;
return true;
} else {
return super.interact(player);
}
} else {
return super.interact(player);
}
} else {
return super.interact(player);
}
}
示例4: addInformation
import net.minecraft.block.BlockColored; //導入依賴的package包/類
@SideOnly(Side.CLIENT)
@Override
public void addInformation (ItemStack itemStack, EntityPlayer player, List list, boolean par4) {
if (ModBlocks.lantern.isGlass(itemStack)) {
String glassName = Blocks.stained_glass.getUnlocalizedName() + "." + ItemDye.field_150923_a[BlockColored.func_150032_b(itemStack.getItemDamage())];
list.add(StatCollector.translateToLocal(glassName + ".name"));
}
String contents = StatCollector.translateToLocal(ModBlocks.makeName("lanternSource")) + ": " + EnumChatFormatting.YELLOW;
String source = ModBlocks.lantern.getLightSource(itemStack);
ILanternSource lanternSource = (source != null) ? Api.instance.registries().lanternSources().getLanternSource(source) : null;
if (lanternSource != null)
contents += StatCollector.translateToLocal(lanternSource.getLanguageKey(itemStack.getItemDamage()));
else
contents += StatCollector.translateToLocal(ModBlocks.makeName("lanternSource.none"));
list.add(contents);
}
示例5: itemInteractionForEntity
import net.minecraft.block.BlockColored; //導入依賴的package包/類
public boolean itemInteractionForEntity(ItemStack p_111207_1_, EntityPlayer p_111207_2_, EntityLivingBase p_111207_3_)
{
if (p_111207_3_ instanceof EntitySheep)
{
EntitySheep entitysheep = (EntitySheep)p_111207_3_;
int i = BlockColored.func_150032_b(p_111207_1_.getItemDamage());
if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != i)
{
entitysheep.setFleeceColor(i);
--p_111207_1_.stackSize;
}
return true;
}
else
{
return false;
}
}
示例6: itemInteractionForEntity
import net.minecraft.block.BlockColored; //導入依賴的package包/類
/**
* Returns true if the item can be used on the given entity, e.g. shears on sheep.
*/
public boolean itemInteractionForEntity(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, EntityLivingBase par3EntityLivingBase)
{
if (par3EntityLivingBase instanceof EntitySheep)
{
EntitySheep entitysheep = (EntitySheep)par3EntityLivingBase;
int i = BlockColored.getBlockFromDye(par1ItemStack.getItemDamage());
if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != i)
{
entitysheep.setFleeceColor(i);
--par1ItemStack.stackSize;
}
return true;
}
else
{
return false;
}
}
示例7: onBlockActivated
import net.minecraft.block.BlockColored; //導入依賴的package包/類
@Override
public boolean onBlockActivated(EntityPlayer player, ItemStack stack, TileEntity tileEntity)
{
if(stack != null && stack.getItem() == Items.dye && tileEntity instanceof TileEntityProducer)
{
TileEntityProducer producer = (TileEntityProducer)tileEntity;
int[] modi = producer.getModifiers();
if(modi[2] != BlockColored.func_150032_b(stack.getItemDamage()))
{
modi[2] = BlockColored.func_150032_b(stack.getItemDamage());
if(!player.capabilities.isCreativeMode)
{
stack.stackSize--;
if(stack.stackSize == 0)
stack = null;
}
producer.getWorldObj().markBlockForUpdate(producer.xCoord, producer.yCoord, producer.zCoord);
producer.setModifiers(modi);;
return true;
}
}
return false;
}
示例8: shouldSideBeRendered
import net.minecraft.block.BlockColored; //導入依賴的package包/類
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(@Nonnull IBlockState blockStateIn, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing side) {
IBlockState otherState = world.getBlockState(pos.offset(side)).getActualState(world, pos.offset(side));
if (FacadeUtil.instance.isFacaded(otherState)) {
IBlockState facade = FacadeUtil.instance.getFacade(otherState, world, pos.offset(side), side);
if (facade != null) {
otherState = facade;
}
}
if (otherState.getBlock() instanceof BlockFusedQuartz) {
IBlockState ourState = blockStateIn.getActualState(world, pos);
return !ourState.getValue(FusedQuartzType.KIND).connectTo(otherState.getValue(FusedQuartzType.KIND))
|| (!glassConnectToTheirColorVariants && ourState.getValue(BlockColored.COLOR) != otherState.getValue(BlockColored.COLOR));
}
return true;
}
示例9: addDyeRecipes
import net.minecraft.block.BlockColored; //導入依賴的package包/類
public static void addDyeRecipes(IForgeRegistry<IRecipe> registry, BlockColored block) {
ResourceLocation group = new ResourceLocation("thermionics_world", "dye");
for(EnumDyeColor dye : EnumDyeColor.values()) {
ShapelessOreRecipe recipe =
new ShapelessOreRecipe(group, new ItemStack(TWBlocks.NORFAIRITE_CLEAR,1,dye.getMetadata()),
new ItemStack(Items.DYE,1,dye.getDyeDamage()),
new ItemStack(TWBlocks.NORFAIRITE_CLEAR,1,OreDictionary.WILDCARD_VALUE));
recipe.setRegistryName(new ResourceLocation("thermionics_world", block.getRegistryName().getResourcePath()+"_DyeTo_"+dye.getUnlocalizedName()) );
registry.register(recipe);
}
}
示例10: getLocalizedName
import net.minecraft.block.BlockColored; //導入依賴的package包/類
@SuppressWarnings("deprecation")
@Override
public String getLocalizedName(ItemStack stack) {
EnumDyeColor color = this.getStateFromMeta(stack.getItemDamage()).getValue(BlockColored.COLOR);
String localColor = I18n.translateToLocal("color."+color.getUnlocalizedName());
return I18n.translateToLocalFormatted(getUnlocalizedName()+".name", localColor);
}
示例11: HobbitPipeRecipeHandler
import net.minecraft.block.BlockColored; //導入依賴的package包/類
public HobbitPipeRecipeHandler() {
super();
if (pipes.isEmpty()) {
for (int i = 0; i < 17; i++) {
pipes.add(new ItemStack(LOTRMod.hobbitPipe));
LOTRItemHobbitPipe.setSmokeColor((ItemStack) pipes.get(i), i);
}
}
if (dyes.isEmpty()) {
NeiLotrUtil.getDyes().forEach(stack -> {
dyes.put(BlockColored.func_150031_c(LOTRItemDye.isItemDye(stack)), stack);
});
dyes.put(16, new ItemStack(LOTRMod.mithrilNugget));
}
}
示例12: BlockCableSignal
import net.minecraft.block.BlockColored; //導入依賴的package包/類
public BlockCableSignal(String subId) {
super(subId);
this.setDefaultState(blockState.getBaseState()
.withProperty(NORTH, false)
.withProperty(SOUTH, false)
.withProperty(EAST, false)
.withProperty(WEST, false)
.withProperty(UP, false)
.withProperty(DOWN, false)
.withProperty(BlockColored.COLOR, EnumDyeColor.WHITE)
);
}
示例13: generateCoralCluster
import net.minecraft.block.BlockColored; //導入依賴的package包/類
/**
* This method will generate a cluster of Coral that will randomly choose a color for each piece of Coral.
* @param world
* @param pos
* @param size
* @param ignoreSpread if this is enabled the search will not avoid duplicate directions (Forms a tighter clump)
* @param notifyBlocks
*/
public static void generateCoralCluster(World world, BlockPos pos, int size, boolean ignoreSpread, boolean notifyBlocks){
BlockPos nodePos = pos;
EnumFacing lastFace = null;
for(int i = 0; i < size; i++){
EnumDyeColor color = EnumDyeColor.byMetadata(MathHelper.getInt(Util.rand, 0, 15));
if(ModBlocks.coral.canPlaceBlockAt(world, nodePos)){
world.setBlockState(nodePos, ModBlocks.coral.getDefaultState().withProperty(BlockColored.COLOR, color), notifyBlocks ? 3 : 2);
boolean found = false;
search: for(int t = 0; t < 6; t++){
EnumFacing face = EnumFacing.VALUES[MathHelper.getInt(Util.rand, 0, 5)];
if(!ignoreSpread && lastFace !=null && face == lastFace){
continue search;
}
if(ModBlocks.coral.canPlaceBlockAt(world, nodePos.offset(face))){
nodePos = nodePos.offset(face);
lastFace = face;
found = true;
break search;
}
}
if(!found){
break;
}
}
}
}
示例14: entityInit
import net.minecraft.block.BlockColored; //導入依賴的package包/類
protected void entityInit()
{
super.entityInit();
this.dataWatcher.addObject(18, new Float(this.getHealth()));
this.dataWatcher.addObject(19, new Byte((byte)0));
this.dataWatcher.addObject(20, new Byte((byte)BlockColored.func_150032_b(1)));
}
示例15: buildHut
import net.minecraft.block.BlockColored; //導入依賴的package包/類
private void buildHut(QuestData data, BlockPos pos) {
World world = data.getPlayer().getEntityWorld();
if (pos == null) {
return;
}
int w = hutHalfWidth;
BlockPos pointer;
IBlockState block;
for (int x = -w; x <= w; x++) {
for (int y = 0; y <= w; y++) {
for (int z = -w; z <= w; z++) {
pointer = pos.add(x, y, z);
block = world.getBlockState(pointer);
if (cantBuildOver(block)) {
continue;
}
if (y + Math.abs(z) == w) {
if (x % 2 == 0) {
world.setBlockState(pointer, Blocks.WOOL.getDefaultState().withProperty(BlockColored.COLOR, EnumDyeColor.RED));
} else {
world.setBlockState(pointer, Blocks.WOOL.getDefaultState().withProperty(BlockColored.COLOR, EnumDyeColor.BLACK));
}
} else if (z == 0 && (x == w || x == -w)) {
world.setBlockState(pointer, Blocks.DARK_OAK_FENCE.getDefaultState());
}
}
}
}
}