mirror of
https://github.com/GTNewHorizons/ThaumicTinkerer.git
synced 2026-11-28 16:06:07 +00:00
* BS + SA * Intellij Cleanups * Add missing overrides * Cleanup fire code * Less allocations * Get rid of BlockTuple -> Far fewer allocations (It was only used for Ordo Fire which isn't very useful for NH) Neuter Ordo fire (will be reworked once we figure out what it should do) Mixin to fix fire rendering on water -- call the subclass's canCatchFire instead of the base class Properly tether the fire spread to 15 blocks from the source, which never burns out. * rm * Spotless
149 lines
4.3 KiB
Java
149 lines
4.3 KiB
Java
package thaumic.tinkerer.common.block;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.Random;
|
|
|
|
import net.minecraft.block.BlockSlab;
|
|
import net.minecraft.block.material.Material;
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
import net.minecraft.entity.Entity;
|
|
import net.minecraft.entity.EntityLivingBase;
|
|
import net.minecraft.item.Item;
|
|
import net.minecraft.item.ItemBlock;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.potion.Potion;
|
|
import net.minecraft.potion.PotionEffect;
|
|
import net.minecraft.tileentity.TileEntity;
|
|
import net.minecraft.util.IIcon;
|
|
import net.minecraft.world.World;
|
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
import thaumcraft.common.Thaumcraft;
|
|
import thaumcraft.common.config.ConfigBlocks;
|
|
import thaumic.tinkerer.common.ThaumicTinkerer;
|
|
import thaumic.tinkerer.common.core.handler.ModCreativeTab;
|
|
import thaumic.tinkerer.common.item.ItemTravelSlab;
|
|
import thaumic.tinkerer.common.lib.LibBlockNames;
|
|
import thaumic.tinkerer.common.registry.ITTinkererBlock;
|
|
import thaumic.tinkerer.common.registry.ThaumicTinkererCraftingBenchRecipe;
|
|
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
|
|
import thaumic.tinkerer.common.research.IRegisterableResearch;
|
|
|
|
/**
|
|
* Created by Katrina on 13/04/2015.
|
|
*/
|
|
public class BlockTravelSlab extends BlockSlab implements ITTinkererBlock {
|
|
|
|
public BlockTravelSlab(boolean par2) {
|
|
super(par2, Material.rock);
|
|
setHardness(0.8F);
|
|
setResistance(10F);
|
|
if (!par2) {
|
|
setLightOpacity(0);
|
|
setCreativeTab(ModCreativeTab.INSTANCE);
|
|
}
|
|
}
|
|
|
|
public BlockTravelSlab(Boolean par2) {
|
|
this(par2.booleanValue());
|
|
}
|
|
|
|
public BlockTravelSlab() {
|
|
this(false);
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public IIcon getIcon(int par1, int par2) {
|
|
return ConfigBlocks.blockCosmeticSolid.getIcon(par1, 2);
|
|
}
|
|
|
|
@Override
|
|
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
|
|
return Item.getItemFromBlock(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockTravelSlab.class));
|
|
}
|
|
|
|
@Override
|
|
public ItemStack createStackedBlock(int par1) {
|
|
return new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockTravelSlab.class));
|
|
}
|
|
|
|
@Override
|
|
public String func_150002_b(int i) {
|
|
return "tile." + LibBlockNames.TRAVEL_SLAB;
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
|
// NO-OP
|
|
}
|
|
|
|
@Override
|
|
public ArrayList<Object> getSpecialParameters() {
|
|
ArrayList result = new ArrayList();
|
|
result.add(true);
|
|
return result;
|
|
}
|
|
|
|
@Override
|
|
public String getBlockName() {
|
|
return field_150004_a ? LibBlockNames.TRAVEL_SLAB_FULL : LibBlockNames.TRAVEL_SLAB;
|
|
}
|
|
|
|
@Override
|
|
public boolean shouldRegister() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean shouldDisplayInTab() {
|
|
return !field_150004_a;
|
|
}
|
|
|
|
@Override
|
|
public Class<? extends ItemBlock> getItemBlock() {
|
|
return ItemTravelSlab.class;
|
|
}
|
|
|
|
@Override
|
|
public Class<? extends TileEntity> getTileEntity() {
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
public IRegisterableResearch getResearchItem() {
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
public ThaumicTinkererRecipe getRecipeItem() {
|
|
if (isOpaqueCube()) {
|
|
return null;
|
|
}
|
|
return new ThaumicTinkererCraftingBenchRecipe(
|
|
"PAVETRAVEL",
|
|
new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockTravelSlab.class), 6),
|
|
"QQQ",
|
|
'Q',
|
|
new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 2));
|
|
}
|
|
|
|
@Override
|
|
public void onEntityWalking(World world, int x, int y, int z, Entity e) {
|
|
if (world.getBlock(x, y, z) == this) {
|
|
if (e instanceof EntityLivingBase) {
|
|
if (world.isRemote) {
|
|
Thaumcraft.proxy.blockSparkle(world, x, y, z, '?', 5);
|
|
}
|
|
|
|
((EntityLivingBase) e).addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 40, 1));
|
|
((EntityLivingBase) e).addPotionEffect(new PotionEffect(Potion.jump.id, 40, 0));
|
|
}
|
|
|
|
super.onEntityWalking(world, x, y, z, e);
|
|
}
|
|
}
|
|
}
|