net.minecraft.block.MaterialColor Java Examples

The following examples show how to use net.minecraft.block.MaterialColor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Peek.java    From bleachhack-1.14 with GNU General Public License v3.0 6 votes vote down vote up
public void drawMapToolTip(Slot slot, int mX, int mY) {
	if (slot.getStack().getItem() != Items.FILLED_MAP) return;
	
	MapState data = FilledMapItem.getMapState(slot.getStack(), mc.world);
	byte[] colors = data.colors;
	
	double size = getSettings().get(3).toSlider().getValue();
	
	GL11.glPushMatrix();
	GL11.glScaled(size, size, 1.0);
	GL11.glTranslatef(0.0F, 0.0F, 300.0F);
	int x = (int) (mX*(1/size) + 12*(1/size));
	int y = (int) (mY*(1/size) - 12*(1/size) - 140);
	
	renderTooltipBox(x - 12, y + 12, 128, 128, false);
	for (byte c: colors) {
		int c1 = c & 255;
		
		if (c1 / 4 != 0) Screen.fill(x, y, x+1, y+1, getRenderColorFix(MaterialColor.COLORS[c1 / 4].color, c1 & 3));
		if (x - (int) (mX*(1/size)+12*(1/size)) == 127) { x = (int) (mX*(1/size)+12*(1/size)); y++; }
		else x++;
	}
	
	GL11.glPopMatrix();
}
 
Example #2
Source File: Peek.java    From bleachhack-1.14 with GNU General Public License v3.0 6 votes vote down vote up
public void drawMapToolTip(MatrixStack matrix, Slot slot, int mX, int mY) {
	if (slot.getStack().getItem() != Items.FILLED_MAP) return;
	
	MapState data = FilledMapItem.getMapState(slot.getStack(), mc.world);
	byte[] colors = data.colors;
	
	double size = getSettings().get(3).toSlider().getValue();
	
	GL11.glPushMatrix();
	GL11.glScaled(size, size, 1.0);
	GL11.glTranslatef(0.0F, 0.0F, 300.0F);
	int x = (int) (mX*(1/size) + 12*(1/size));
	int y = (int) (mY*(1/size) - 12*(1/size) - 140);
	
	renderTooltipBox(x - 12, y + 12, 128, 128, false);
	for (byte c: colors) {
		int c1 = c & 255;
		
		if (c1 / 4 != 0) Screen.fill(matrix, x, y, x+1, y+1, getRenderColorFix(MaterialColor.COLORS[c1 / 4].color, c1 & 3));
		if (x - (int) (mX*(1/size)+12*(1/size)) == 127) { x = (int) (mX*(1/size)+12*(1/size)); y++; }
		else x++;
	}
	
	GL11.glPopMatrix();
}
 
Example #3
Source File: Peek.java    From bleachhack-1.14 with GNU General Public License v3.0 6 votes vote down vote up
public void drawMapToolTip(Slot slot, int mX, int mY) {
	if (slot.getStack().getItem() != Items.FILLED_MAP) return;
	
	MapState data = FilledMapItem.getMapState(slot.getStack(), mc.world);
	byte[] colors = data.colors;
	
	double size = getSettings().get(3).toSlider().getValue();
	
	GL11.glPushMatrix();
	GL11.glScaled(size, size, 1.0);
	GL11.glTranslatef(0.0F, 0.0F, 300.0F);
	int x = (int) (mX*(1/size) + 12*(1/size));
	int y = (int) (mY*(1/size) - 12*(1/size) - 140);
	
	renderTooltipBox(x - 12, y + 12, 128, 128, false);
	for (byte c: colors) {
		int c1 = c & 255;
		
		if (c1 / 4 != 0) Screen.fill(x, y, x+1, y+1, getRenderColorFix(MaterialColor.COLORS[c1 / 4].color, c1 & 3));
		if (x - (int) (mX*(1/size)+12*(1/size)) == 127) { x = (int) (mX*(1/size)+12*(1/size)); y++; }
		else x++;
	}
	
	GL11.glPopMatrix();
}
 
Example #4
Source File: BlocksMixin.java    From carpet-extra with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Redirect(method = "<clinit>",
    slice = @Slice(from = @At(value = "CONSTANT", args = "stringValue=obsidian")),
    at = @At(value = "INVOKE",
        target = "Lnet/minecraft/block/Blocks;register(Ljava/lang/String;Lnet/minecraft/block/Block;)Lnet/minecraft/block/Block;",
        ordinal = 0))
private static Block registerObsidian(String id, Block obsidian)
{
    return register("obsidian", new ObsidianBlock(Block.Settings.of(Material.STONE, MaterialColor.BLACK).strength(50.0F, 1200.0F)));
}
 
Example #5
Source File: CoralBlockMixin.java    From fabric-carpet with MIT License 5 votes vote down vote up
public void grow(ServerWorld worldIn, Random random, BlockPos pos, BlockState blockUnder)
{

    CoralFeature coral;
    int variant = random.nextInt(3);
    if (variant == 0)
        coral = new CoralClawFeature(DefaultFeatureConfig::deserialize);
    else if (variant == 1)
        coral = new CoralTreeFeature(DefaultFeatureConfig::deserialize);
    else
        coral = new CoralMushroomFeature(DefaultFeatureConfig::deserialize);

    MaterialColor color = blockUnder.getTopMaterialColor(worldIn, pos);
    BlockState proper_block = blockUnder;
    for (Block block: BlockTags.CORAL_BLOCKS.values())
    {
        proper_block = block.getDefaultState();
        if (proper_block.getTopMaterialColor(worldIn,pos) == color)
        {
            break;
        }
    }
    worldIn.setBlockState(pos, Blocks.WATER.getDefaultState(), 4);

    if (!((CoralFeatureInterface)coral).growSpecific(worldIn, random, pos, proper_block))
    {
        worldIn.setBlockState(pos, blockUnder, 3);
    }
    else
    {
        if (worldIn.random.nextInt(10)==0)
        {
            BlockPos randomPos = pos.add(worldIn.random.nextInt(16)-8,worldIn.random.nextInt(8),worldIn.random.nextInt(16)-8  );
            if (BlockTags.CORAL_BLOCKS.contains(worldIn.getBlockState(randomPos).getBlock()))
            {
                worldIn.setBlockState(randomPos, Blocks.WET_SPONGE.getDefaultState(), 3);
            }
        }
    }
}
 
Example #6
Source File: HallowedLogBlock.java    From the-hallow with MIT License 4 votes vote down vote up
public HallowedLogBlock(MaterialColor topColor, Settings settings) {
	super(topColor, settings);
}