2018-09-16 00:45:44 +02:00
|
|
|
package com.minelittlepony.unicopia;
|
|
|
|
|
2018-09-25 23:30:21 +02:00
|
|
|
import com.minelittlepony.unicopia.block.BlockAlfalfa;
|
2019-01-25 16:22:41 +01:00
|
|
|
import com.minelittlepony.unicopia.block.BlockFruitLeaves;
|
2018-09-16 00:45:44 +02:00
|
|
|
import com.minelittlepony.unicopia.block.BlockCloud;
|
2018-09-19 09:07:39 +02:00
|
|
|
import com.minelittlepony.unicopia.block.BlockCloudAnvil;
|
2019-02-04 17:16:17 +01:00
|
|
|
import com.minelittlepony.unicopia.block.BlockCloudBanister;
|
2018-09-16 00:45:44 +02:00
|
|
|
import com.minelittlepony.unicopia.block.BlockCloudSlab;
|
|
|
|
import com.minelittlepony.unicopia.block.BlockCloudStairs;
|
2019-01-10 08:44:31 +01:00
|
|
|
import com.minelittlepony.unicopia.block.BlockSugar;
|
2019-01-08 21:23:22 +01:00
|
|
|
import com.minelittlepony.unicopia.block.BlockTomatoPlant;
|
2019-01-25 16:22:41 +01:00
|
|
|
import com.minelittlepony.unicopia.block.IColourful;
|
|
|
|
import com.minelittlepony.unicopia.block.USapling;
|
2018-09-19 09:07:39 +02:00
|
|
|
import com.minelittlepony.unicopia.block.BlockCloudDoor;
|
2019-01-06 22:31:34 +01:00
|
|
|
import com.minelittlepony.unicopia.block.BlockCloudFarm;
|
2019-02-04 17:16:17 +01:00
|
|
|
import com.minelittlepony.unicopia.block.BlockCloudFence;
|
2018-09-16 00:45:44 +02:00
|
|
|
|
|
|
|
import net.minecraft.block.Block;
|
2019-01-25 16:22:41 +01:00
|
|
|
import net.minecraft.block.state.IBlockState;
|
|
|
|
import net.minecraft.client.renderer.color.BlockColors;
|
|
|
|
import net.minecraft.client.renderer.color.ItemColors;
|
|
|
|
import net.minecraft.init.Blocks;
|
|
|
|
import net.minecraft.item.ItemBlock;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.world.ColorizerFoliage;
|
|
|
|
import net.minecraft.world.biome.BiomeColorHelper;
|
|
|
|
import net.minecraft.world.gen.feature.WorldGenTrees;
|
2019-01-30 11:26:00 +01:00
|
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
2018-09-16 00:45:44 +02:00
|
|
|
import net.minecraftforge.registries.IForgeRegistry;
|
|
|
|
|
|
|
|
public class UBlocks {
|
|
|
|
public static final BlockCloud cloud = new BlockCloud(UMaterials.cloud, Unicopia.MODID, "cloud_block");
|
|
|
|
|
2019-01-06 22:31:34 +01:00
|
|
|
public static final BlockCloudStairs cloud_stairs = new BlockCloudStairs(UBlocks.cloud.getDefaultState(), Unicopia.MODID, "cloud_stairs");
|
2018-09-16 00:45:44 +02:00
|
|
|
|
2019-01-27 16:35:01 +01:00
|
|
|
public static final BlockCloudSlab cloud_double_slab = new BlockCloudSlab(true, UMaterials.cloud, Unicopia.MODID, "cloud_double_slab");
|
2018-09-16 00:45:44 +02:00
|
|
|
public static final BlockCloudSlab cloud_slab = new BlockCloudSlab(false, UMaterials.cloud, Unicopia.MODID, "cloud_slab");
|
|
|
|
|
2018-09-19 09:07:39 +02:00
|
|
|
public static final BlockCloudDoor mist_door = new BlockCloudDoor(UMaterials.cloud, Unicopia.MODID, "mist_door");
|
|
|
|
|
|
|
|
public static final BlockCloudAnvil anvil = new BlockCloudAnvil(Unicopia.MODID, "anvil");
|
|
|
|
|
2019-02-04 17:16:17 +01:00
|
|
|
public static final BlockCloudFence cloud_fence = new BlockCloudFence(Unicopia.MODID, "cloud_fence");
|
|
|
|
public static final BlockCloudBanister cloud_banister = new BlockCloudBanister(Unicopia.MODID, "cloud_banister");
|
|
|
|
|
2018-09-25 23:30:21 +02:00
|
|
|
public static final BlockAlfalfa alfalfa = new BlockAlfalfa(Unicopia.MODID, "alfalfa");
|
|
|
|
|
2019-01-08 21:23:22 +01:00
|
|
|
public static final BlockTomatoPlant tomato_plant = new BlockTomatoPlant(Unicopia.MODID, "tomato_plant");
|
|
|
|
|
2019-01-06 22:31:34 +01:00
|
|
|
public static final BlockCloudFarm cloud_farmland = new BlockCloudFarm(Unicopia.MODID, "cloud_farmland");
|
|
|
|
|
2019-01-10 08:44:31 +01:00
|
|
|
public static final Block sugar_block = new BlockSugar(Unicopia.MODID, "sugar_block");
|
|
|
|
|
2019-01-25 16:22:41 +01:00
|
|
|
public static final USapling apple_tree = new USapling(Unicopia.MODID, "apple_sapling")
|
|
|
|
.setTreeGen((w, s, m) -> new WorldGenTrees(true, 5, Blocks.LOG.getDefaultState(), UBlocks.apple_leaves.getDefaultState(), false));
|
|
|
|
public static final Block apple_leaves = new BlockFruitLeaves(Unicopia.MODID, "apple_leaves", apple_tree)
|
|
|
|
.setBaseGrowthChance(1200)
|
|
|
|
.setTint(0xFFEE81)
|
|
|
|
.setHarvestFruit(w -> UItems.apple.getRandomApple(w.rand, null))
|
|
|
|
.setUnharvestFruit(w -> new ItemStack(UItems.rotten_apple));
|
|
|
|
|
2019-01-31 14:57:50 +01:00
|
|
|
static void init(IForgeRegistry<Block> registry) {
|
2019-02-04 17:16:17 +01:00
|
|
|
registry.registerAll(cloud, cloud_stairs, cloud_double_slab, cloud_slab, cloud_fence, cloud_banister,
|
|
|
|
mist_door, anvil, cloud_farmland,
|
2019-01-10 08:44:31 +01:00
|
|
|
sugar_block,
|
2019-01-08 21:23:22 +01:00
|
|
|
alfalfa,
|
2019-01-25 16:22:41 +01:00
|
|
|
tomato_plant,
|
|
|
|
apple_tree, apple_leaves);
|
|
|
|
}
|
|
|
|
|
2019-01-30 11:26:00 +01:00
|
|
|
@SideOnly(Side.CLIENT)
|
2019-01-25 16:22:41 +01:00
|
|
|
static void registerColors(ItemColors items, BlockColors blocks) {
|
|
|
|
items.registerItemColorHandler((stack, tint) -> {
|
|
|
|
@SuppressWarnings("deprecation")
|
|
|
|
IBlockState state = ((ItemBlock)stack.getItem()).getBlock().getStateFromMeta(stack.getMetadata());
|
|
|
|
|
|
|
|
return blocks.colorMultiplier(state, null, null, tint);
|
|
|
|
}, apple_leaves);
|
|
|
|
blocks.registerBlockColorHandler((state, world, pos, tint) -> {
|
|
|
|
Block block = state.getBlock();
|
|
|
|
|
|
|
|
if (block instanceof IColourful) {
|
|
|
|
return ((IColourful)block).getCustomTint(state, tint);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (world != null && pos != null) {
|
|
|
|
return BiomeColorHelper.getFoliageColorAtPos(world, pos);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ColorizerFoliage.getFoliageColorBasic();
|
|
|
|
}, apple_leaves);
|
2018-09-16 00:45:44 +02:00
|
|
|
}
|
|
|
|
}
|