use of micdoodle8.mods.galacticraft.core.tile.TileEntityPanelLight in project Galacticraft by micdoodle8.
the class BlockPanelLighting method onUseWrench.
@Override
public boolean onUseWrench(World world, BlockPos pos, EntityPlayer entityPlayer, EnumFacing side, float hitX, float hitY, float hitZ) {
TileEntity tile = world.getTileEntity(pos);
if (!(tile instanceof TileEntityPanelLight)) {
return false;
}
IBlockState bs = world.getBlockState(pos);
if (!(bs.getBlock() instanceof BlockPanelLighting)) {
return false;
}
PanelType type = (PanelType) bs.getValue(BlockPanelLighting.TYPE);
TileEntityPanelLight tilegood = (TileEntityPanelLight) tile;
int metadata = tilegood.meta;
if (metadata < 8 && (type == PanelType.LINEAR || type == PanelType.SF) || metadata < 24 && type == PanelType.SFDIAG) {
tilegood.meta += 8;
return true;
}
int metaDir = ((metadata & 7) + 1) % 6;
// 0->1 1->2 2->5 3->4 4->0 5->3
if (// after north
metaDir == 3) {
metaDir = 5;
} else if (metaDir == 0) {
metaDir = 3;
} else if (metaDir == 5) {
metaDir = 0;
}
tilegood.meta = metaDir;
return true;
}
use of micdoodle8.mods.galacticraft.core.tile.TileEntityPanelLight in project Galacticraft by micdoodle8.
the class BlockPanelLighting method onUseWrench.
@Override
public boolean onUseWrench(World world, BlockPos pos, EntityPlayer entityPlayer, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
TileEntity tile = world.getTileEntity(pos);
if (!(tile instanceof TileEntityPanelLight)) {
return false;
}
IBlockState bs = world.getBlockState(pos);
if (!(bs.getBlock() instanceof BlockPanelLighting)) {
return false;
}
PanelType type = (PanelType) bs.getValue(BlockPanelLighting.TYPE);
TileEntityPanelLight tilegood = (TileEntityPanelLight) tile;
int metadata = tilegood.meta;
if (metadata < 8 && (type == PanelType.LINEAR || type == PanelType.SF) || metadata < 24 && type == PanelType.SFDIAG) {
tilegood.meta += 8;
return true;
}
int metaDir = ((metadata & 7) + 1) % 6;
// 0->1 1->2 2->5 3->4 4->0 5->3
if (// after north
metaDir == 3) {
metaDir = 5;
} else if (metaDir == 0) {
metaDir = 3;
} else if (metaDir == 5) {
metaDir = 0;
}
tilegood.meta = metaDir;
return true;
}
use of micdoodle8.mods.galacticraft.core.tile.TileEntityPanelLight in project Galacticraft by micdoodle8.
the class BlockPanelLighting method onBlockPlacedBy.
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
int damage = stack.getItemDamage();
if (damage >= PANELTYPES_LENGTH)
damage = 0;
TileEntity tile = worldIn.getTileEntity(pos);
if (tile instanceof TileEntityPanelLight && placer instanceof EntityPlayer) {
((TileEntityPanelLight) tile).initialise(damage, EnumFacing.getDirectionFromEntityLiving(pos, placer), (EntityPlayer) placer, worldIn.isRemote, ((BlockPanelLighting) state.getBlock()).superState[damage]);
}
}
use of micdoodle8.mods.galacticraft.core.tile.TileEntityPanelLight in project Galacticraft by micdoodle8.
the class ClientProxyCore method init.
@Override
public void init(FMLInitializationEvent event) {
MUSIC_TYPE_MARS = EnumHelper.addEnum(MusicTicker.MusicType.class, "MARS_JC", new Class[] { SoundEvent.class, Integer.TYPE, Integer.TYPE }, GCSounds.music, 12000, 24000);
ClientProxyCore.registerTileEntityRenderers();
ClientProxyCore.updateCapeList();
ClientProxyCore.registerInventoryJsons();
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler((state, world, pos, tintIndex) -> {
return BlockFallenMeteor.colorMultiplier(world, pos);
}, GCBlocks.fallenMeteor);
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler((state, world, pos, tintIndex) -> {
Block b = state.getBlock();
return (b instanceof BlockSpaceGlass) ? ((BlockSpaceGlass) b).color : 0xFFFFFF;
}, new Block[] { GCBlocks.spaceGlassVanilla, GCBlocks.spaceGlassClear, GCBlocks.spaceGlassStrong });
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler((state, world, pos, tintIndex) -> {
if (world != null && pos != null) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileEntityPanelLight) {
IBlockState baseState = ((TileEntityPanelLight) tile).getBaseBlock();
return Minecraft.getMinecraft().getBlockColors().colorMultiplier(baseState, world, pos, tintIndex);
}
}
return 0xFFFFFF;
}, GCBlocks.panelLighting);
}
Aggregations