Search in sources :

Example 1 with IMultipartWorld

use of mcmultipart.api.world.IMultipartWorld in project Charset by CharsetMC.

the class BlockWire method requestNeighborUpdate.

public void requestNeighborUpdate(World world, BlockPos pos, WireFace location, int connectionMask) {
    if ((connectionMask & 0xFF) != 0 && world instanceof IMultipartWorld) {
        IPartInfo info = ((IMultipartWorld) world).getPartInfo();
        info.getContainer().notifyChange(info);
    }
    for (EnumFacing facing : EnumFacing.VALUES) {
        if (world.isRemote) {
            if ((connectionMask & (1 << (facing.ordinal() + 8))) != 0) {
                WireUtils.getAllWires(world, pos.offset(facing)).forEach((wire) -> wire.onChanged(true));
            } else if (location != WireFace.CENTER && location.facing.getAxis() != facing.getAxis()) {
                WireUtils.getAllWires(world, pos.offset(facing).offset(location.facing)).forEach((wire) -> wire.onChanged(true));
            }
        } else {
            if ((connectionMask & (1 << (facing.ordinal() + 8))) != 0) {
                world.neighborChanged(pos.offset(facing), this, pos);
            } else if (location != WireFace.CENTER && location.facing.getAxis() != facing.getAxis()) {
                world.neighborChanged(pos.offset(facing).offset(location.facing), this, pos);
            }
        }
    }
}
Also used : IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) BlockStateContainer(net.minecraft.block.state.BlockStateContainer) IPartInfo(mcmultipart.api.container.IPartInfo) ExtendedBlockState(net.minecraftforge.common.property.ExtendedBlockState) BlockBase(pl.asie.charset.lib.block.BlockBase) IPartSlot(mcmultipart.api.slot.IPartSlot) ItemStack(net.minecraft.item.ItemStack) RayTraceResult(net.minecraft.util.math.RayTraceResult) IProperty(net.minecraft.block.properties.IProperty) Block(net.minecraft.block.Block) Vec3d(net.minecraft.util.math.Vec3d) Side(net.minecraftforge.fml.relauncher.Side) IMultipartWorld(mcmultipart.api.world.IMultipartWorld) IUnlistedProperty(net.minecraftforge.common.property.IUnlistedProperty) CreativeTabs(net.minecraft.creativetab.CreativeTabs) NonNullList(net.minecraft.util.NonNullList) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) EnumCenterSlot(mcmultipart.api.slot.EnumCenterSlot) IBlockAccess(net.minecraft.world.IBlockAccess) Nullable(javax.annotation.Nullable) SoundType(net.minecraft.block.SoundType) World(net.minecraft.world.World) PropertyBool(net.minecraft.block.properties.PropertyBool) EnumFacing(net.minecraft.util.EnumFacing) ITileEntityProvider(net.minecraft.block.ITileEntityProvider) BlockPos(net.minecraft.util.math.BlockPos) BlockRenderLayer(net.minecraft.util.BlockRenderLayer) IBlockState(net.minecraft.block.state.IBlockState) IMultipart(mcmultipart.api.multipart.IMultipart) List(java.util.List) Material(net.minecraft.block.material.Material) EntityLivingBase(net.minecraft.entity.EntityLivingBase) IMultipartBase(pl.asie.charset.lib.modcompat.mcmultipart.IMultipartBase) TileEntity(net.minecraft.tileentity.TileEntity) EnumFaceSlot(mcmultipart.api.slot.EnumFaceSlot) WireFace(pl.asie.charset.api.wires.WireFace) Collections(java.util.Collections) IPartInfo(mcmultipart.api.container.IPartInfo) EnumFacing(net.minecraft.util.EnumFacing) IMultipartWorld(mcmultipart.api.world.IMultipartWorld)

Aggregations

Collections (java.util.Collections)1 List (java.util.List)1 Nullable (javax.annotation.Nullable)1 IPartInfo (mcmultipart.api.container.IPartInfo)1 IMultipart (mcmultipart.api.multipart.IMultipart)1 EnumCenterSlot (mcmultipart.api.slot.EnumCenterSlot)1 EnumFaceSlot (mcmultipart.api.slot.EnumFaceSlot)1 IPartSlot (mcmultipart.api.slot.IPartSlot)1 IMultipartWorld (mcmultipart.api.world.IMultipartWorld)1 Block (net.minecraft.block.Block)1 ITileEntityProvider (net.minecraft.block.ITileEntityProvider)1 SoundType (net.minecraft.block.SoundType)1 Material (net.minecraft.block.material.Material)1 IProperty (net.minecraft.block.properties.IProperty)1 PropertyBool (net.minecraft.block.properties.PropertyBool)1 BlockStateContainer (net.minecraft.block.state.BlockStateContainer)1 IBlockState (net.minecraft.block.state.IBlockState)1 CreativeTabs (net.minecraft.creativetab.CreativeTabs)1 EntityLivingBase (net.minecraft.entity.EntityLivingBase)1 ItemStack (net.minecraft.item.ItemStack)1