@Override public Map<String, ? extends Property<?>> getProperties(BlockType blockType) { Map<String, Property<?>> map = new TreeMap<>(); Collection<IProperty<?>> propertyKeys = Block.getBlockFromName(blockType.getId()) .getDefaultState() .getPropertyKeys(); for (IProperty<?> key : propertyKeys) { map.put(key.getName(), ForgeAdapter.adaptProperty(key)); } return map; }
@Override public BlockMaterial getMaterial(BlockType blockType) { return materialMap.computeIfAbsent(Block.getBlockFromName(blockType.getId()).getDefaultState().getMaterial(), m -> new ForgeBlockMaterial(m, super.getMaterial(blockType))); }
BlockPos pos = new BlockPos(x, y, z); IBlockState old = chunk.getBlockState(pos); Block mcBlock = Block.getBlockFromName(block.getBlockType().getId()); IBlockState newState = mcBlock.getDefaultState(); Map<Property<?>, Object> states = block.getStates();
public static Block getBlock(ItemStack stack) { Block block = Block.getBlockFromName(getBlockName(stack)); if(block == null) return Blocks.AIR; return block; }
@Nullable public static Block getBlock(ItemStack stack) { return Block.getBlockFromName(getBlockName(stack)); }
public static Block getTargetBlock(ItemStack stack) { Block block = Block.getBlockFromName(getTargetBlockName(stack)); return block; }
public static Block getBlock(ItemStack stack) { Block block = Block.getBlockFromName(getBlockName(stack)); return block; }
@Override public void readPacketNBT(NBTTagCompound cmp) { Block b = Block.getBlockFromName(cmp.getString(TAG_CAMO)); if (b != null) { camoState = b.getStateFromMeta(cmp.getInteger(TAG_CAMO_META)); } }
@Override public boolean doParticles(IManaBurst burst, ItemStack stack) { EntityThrowable entity = (EntityThrowable) burst; ItemStack lens = burst.getSourceLens(); String id = ItemNBTHelper.getString(lens, TAG_BLOCK_NAME, "minecraft:air"); Block b = Block.getBlockFromName(id); int meta = ItemNBTHelper.getInt(lens, TAG_META, 0); entity.world.spawnParticle(EnumParticleTypes.BLOCK_CRACK, entity.posX, entity.posY, entity.posZ, entity.motionX, entity.motionY, entity.motionZ, Block.getStateId(b.getStateFromMeta(meta))); return true; }
/** * (abstract) Protected helper method to read subclass entity data from NBT. */ public void readEntityFromNBT(NBTTagCompound compound) { this.xTile = compound.getInteger("xTile"); this.yTile = compound.getInteger("yTile"); this.zTile = compound.getInteger("zTile"); if (compound.hasKey("inTile", 8)) { this.inTile = Block.getBlockFromName(compound.getString("inTile")); } else { this.inTile = Block.getBlockById(compound.getByte("inTile") & 255); } this.throwableShake = compound.getByte("shake") & 255; this.inGround = compound.getByte("inGround") == 1; this.thrower = null; this.throwerName = compound.getString("ownerName"); if (this.throwerName != null && this.throwerName.isEmpty()) { this.throwerName = null; } this.thrower = this.getThrower(); }
public static void init() { redstoneRecipe = BotaniaAPI.registerManaConjurationRecipe(new ItemStack(Items.REDSTONE, 2), new ItemStack(Items.REDSTONE), 5000); glowstoneRecipe = BotaniaAPI.registerManaConjurationRecipe(new ItemStack(Items.GLOWSTONE_DUST, 2), new ItemStack(Items.GLOWSTONE_DUST), 5000); quartzRecipe = BotaniaAPI.registerManaConjurationRecipe(new ItemStack(Items.QUARTZ, 2), new ItemStack(Items.QUARTZ), 2500); coalRecipe = BotaniaAPI.registerManaConjurationRecipe(new ItemStack(Items.COAL, 2), new ItemStack(Items.COAL), 2100); snowballRecipe = BotaniaAPI.registerManaConjurationRecipe(new ItemStack(Items.SNOWBALL, 2), new ItemStack(Items.SNOWBALL), 200); netherrackRecipe = BotaniaAPI.registerManaConjurationRecipe(new ItemStack(Blocks.NETHERRACK, 2), new ItemStack(Blocks.NETHERRACK), 200); soulSandRecipe = BotaniaAPI.registerManaConjurationRecipe(new ItemStack(Blocks.SOUL_SAND, 2), new ItemStack(Blocks.SOUL_SAND), 1500); gravelRecipe = BotaniaAPI.registerManaConjurationRecipe(new ItemStack(Block.getBlockFromName("gravel"), 2), new ItemStack(Block.getBlockFromName("gravel")), 720); leavesRecipes = new ArrayList<>(); for(int i = 0; i < 4; i++) leavesRecipes.add(BotaniaAPI.registerManaConjurationRecipe(new ItemStack(Blocks.LEAVES, 2, i), new ItemStack(Blocks.LEAVES, 1, i), 2000)); for(int i = 0; i < 2; i++) leavesRecipes.add(BotaniaAPI.registerManaConjurationRecipe(new ItemStack(Blocks.LEAVES2, 2, i), new ItemStack(Blocks.LEAVES2, 1, i), 2000)); grassRecipe = BotaniaAPI.registerManaConjurationRecipe(new ItemStack(Blocks.TALLGRASS, 2, 1), new ItemStack(Blocks.TALLGRASS, 1, 1), 800); }
redstoneToGlowstoneRecipes.add(BotaniaAPI.registerManaAlchemyRecipe(new ItemStack(Items.GLOWSTONE_DUST), new ItemStack(Items.REDSTONE), 300)); sandRecipe = BotaniaAPI.registerManaAlchemyRecipe(new ItemStack(Block.getBlockFromName("sand")), new ItemStack(Blocks.COBBLESTONE), 50); redSandRecipe = BotaniaAPI.registerManaAlchemyRecipe(new ItemStack(Block.getBlockFromName("sand"), 1, 1), new ItemStack(Blocks.HARDENED_CLAY), 50);
private void init() { if (baked == null) baked = Block.getBlockFromName(Const.MODRES + "peat_baked"); if (unbaked == null) unbaked = Block.getBlockFromName(Const.MODRES + "peat_unbaked"); if (outer == null) { outer = getShape(); List<BlockPos> waterShape = UtilShape.squareHorizontalHollow(this.pos, 6); outer.addAll(waterShape); } }
public IBlockState getBlockState() { if (isModded() || block == null) { if (hasMeta) { return Block.getBlockFromName(blockName).getStateFromMeta(blockMeta); } return Block.getBlockFromName(blockName).getDefaultState(); } else { return block; } }
@Override public void fromBytes(@NotNull final ByteBuf buf) { colonyId = buf.readInt(); block = Block.getBlockFromName(ByteBufUtils.readUTF8String(buf)); pos = BlockPosUtil.readFromByteBuf(buf); type = MessageType.values()[buf.readInt()]; mode = MessageMode.values()[buf.readInt()]; dimension = buf.readInt(); }
/** * Get the inner blockState. * @return The inner blockState. */ public IBlockState getInnerBlockState() { if(blockName == null || blockName.isEmpty()) return Blocks.STONE.getDefaultState(); Block block = Block.getBlockFromName(blockName); if (block == null) return Blocks.STONE.getDefaultState(); return block.getStateFromMeta(this.meta); }
public static IBlockQuery of(String blockName, boolean negated) throws BlockQueryParseException { Block block = Block.getBlockFromName(blockName); if (block == null) { throw new BlockQueryParseException("No block called " + blockName); } else { IBlockQuery bm = new BlockQueryBlock(block); return negated ? new BlockQueryNot(bm) : bm; } } }
if (lens.hasTagCompound()) { if (lens.getTagCompound().hasKey(TAG_BLOCK_NAME)) { block = Block.getBlockFromName(ItemNBTHelper.getString(lens, TAG_BLOCK_NAME, "")); } else if (lens.getTagCompound().hasKey(TAG_BLOCK)) {
@SuppressWarnings ("deprecation") @Override public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); Block block = Block.getBlockFromName(tag.getString("block")); if (block == null) { state = Blocks.AIR.getDefaultState(); } else { state = block.getStateFromMeta(tag.getByte("meta")); } }
@Override public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); tuneData.readFromNBT(tag.getCompoundTag("tuneData")); tuneIndex = tag.getInteger("tuneIndex"); playerRange = tag.getInteger("range"); String id = tag.getString("block"); if (!id.isEmpty()) { disguiseState = Block.getBlockFromName(id).getStateFromMeta(tag.getInteger("meta")); } }