public abstract class MixinBlock extends Object implements org.spongepowered.api.block.BlockType, IMixinBlock
Constructor and Description |
---|
MixinBlock() |
Modifier and Type | Method and Description |
---|---|
void |
callRandomTickEvent(net.minecraft.world.World world,
net.minecraft.util.BlockPos pos,
net.minecraft.block.state.IBlockState state,
Random rand,
org.spongepowered.asm.mixin.injection.callback.CallbackInfo ci) |
org.spongepowered.api.block.BlockState |
getDefaultBlockState()
Gets the default
BlockState as an api representation. |
org.spongepowered.api.block.BlockState |
getDefaultState() |
abstract boolean |
getEnableStats() |
String |
getId() |
Optional<org.spongepowered.api.item.ItemType> |
getItem() |
abstract int |
getLightValue() |
List<org.spongepowered.api.data.manipulator.ImmutableDataManipulator<?,?>> |
getManipulators(net.minecraft.block.state.IBlockState blockState)
Gets all the
ImmutableDataManipulator s for the provided
IBlockState . |
abstract net.minecraft.block.material.Material |
getMaterial() |
String |
getName() |
abstract net.minecraft.block.state.IBlockState |
getStateFromMeta(int meta) |
Optional<org.spongepowered.api.block.BlockState> |
getStateWithData(net.minecraft.block.state.IBlockState blockState,
org.spongepowered.api.data.manipulator.ImmutableDataManipulator<?,?> manipulator)
Again, another delegate method directly to the block, usually not all
required, but it does help if the block does support the manipulator
in the first place.
|
<E> Optional<org.spongepowered.api.block.BlockState> |
getStateWithValue(net.minecraft.block.state.IBlockState blockState,
org.spongepowered.api.data.key.Key<? extends org.spongepowered.api.data.value.BaseValue<E>> key,
E value)
Instead of delegating to a block processor, we can delegate to the block
to retrieve the correct
BlockState if supported. |
boolean |
getTickRandomly() |
Optional<org.spongepowered.api.block.trait.BlockTrait<?>> |
getTrait(String blockTrait) |
Collection<org.spongepowered.api.block.trait.BlockTrait<?>> |
getTraits() |
org.spongepowered.api.text.translation.Translation |
getTranslation() |
abstract String |
getUnlocalizedName() |
abstract boolean |
isBlockNormalCube() |
void |
onDropBlockAsItemWithChance(net.minecraft.world.World worldIn,
net.minecraft.util.BlockPos pos,
net.minecraft.block.state.IBlockState state,
float chance,
int fortune,
org.spongepowered.asm.mixin.injection.callback.CallbackInfo ci) |
void |
setTickRandomly(boolean tickRandomly) |
abstract net.minecraft.block.state.IBlockState |
shadow$getDefaultState() |
boolean |
supports(Class<? extends org.spongepowered.api.data.manipulator.ImmutableDataManipulator<?,?>> immutable)
A simple check whether the class is supported by the block or not.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getApplicableProperties, getProperty
isFlammable
public abstract boolean isBlockNormalCube()
public abstract boolean getEnableStats()
public abstract int getLightValue()
public abstract String getUnlocalizedName()
public abstract net.minecraft.block.state.IBlockState getStateFromMeta(int meta)
public abstract net.minecraft.block.material.Material getMaterial()
public abstract net.minecraft.block.state.IBlockState shadow$getDefaultState()
public String getId()
getId
in interface org.spongepowered.api.CatalogType
public String getName()
getName
in interface org.spongepowered.api.block.BlockType
getName
in interface org.spongepowered.api.CatalogType
public org.spongepowered.api.block.BlockState getDefaultState()
getDefaultState
in interface org.spongepowered.api.block.BlockType
public Optional<org.spongepowered.api.item.ItemType> getItem()
getItem
in interface org.spongepowered.api.block.BlockType
public org.spongepowered.api.text.translation.Translation getTranslation()
getTranslation
in interface org.spongepowered.api.text.translation.Translatable
public boolean getTickRandomly()
getTickRandomly
in interface org.spongepowered.api.block.BlockType
public void setTickRandomly(boolean tickRandomly)
setTickRandomly
in interface org.spongepowered.api.block.BlockType
public void callRandomTickEvent(net.minecraft.world.World world, net.minecraft.util.BlockPos pos, net.minecraft.block.state.IBlockState state, Random rand, org.spongepowered.asm.mixin.injection.callback.CallbackInfo ci)
public boolean supports(Class<? extends org.spongepowered.api.data.manipulator.ImmutableDataManipulator<?,?>> immutable)
IMixinBlock
supports
in interface IMixinBlock
immutable
- The immutable classpublic Optional<org.spongepowered.api.block.BlockState> getStateWithData(net.minecraft.block.state.IBlockState blockState, org.spongepowered.api.data.manipulator.ImmutableDataManipulator<?,?> manipulator)
IMixinBlock
getStateWithData
in interface IMixinBlock
blockState
- The block state to base off ofmanipulator
- The manipulator being offeredpublic <E> Optional<org.spongepowered.api.block.BlockState> getStateWithValue(net.minecraft.block.state.IBlockState blockState, org.spongepowered.api.data.key.Key<? extends org.spongepowered.api.data.value.BaseValue<E>> key, E value)
IMixinBlock
BlockState
if supported. Considering
block processors would require to know of the blocks themselves, it is
easier to use the block to understand what data is being offered,
and the current block state being used. Since all of the data is already
relatively kept in the block state instance, it is therefor very well
possible to cycle according to the block instance.getStateWithValue
in interface IMixinBlock
E
- The type of value, for type checkingblockState
- The block state to use as a basekey
- The key to the datavalue
- The valuepublic List<org.spongepowered.api.data.manipulator.ImmutableDataManipulator<?,?>> getManipulators(net.minecraft.block.state.IBlockState blockState)
IMixinBlock
ImmutableDataManipulator
s for the provided
IBlockState
.getManipulators
in interface IMixinBlock
blockState
- The block state being passed inpublic org.spongepowered.api.block.BlockState getDefaultBlockState()
IMixinBlock
BlockState
as an api representation.getDefaultBlockState
in interface IMixinBlock
public Collection<org.spongepowered.api.block.trait.BlockTrait<?>> getTraits()
getTraits
in interface org.spongepowered.api.block.BlockType
public Optional<org.spongepowered.api.block.trait.BlockTrait<?>> getTrait(String blockTrait)
getTrait
in interface org.spongepowered.api.block.BlockType
public void onDropBlockAsItemWithChance(net.minecraft.world.World worldIn, net.minecraft.util.BlockPos pos, net.minecraft.block.state.IBlockState state, float chance, int fortune, org.spongepowered.asm.mixin.injection.callback.CallbackInfo ci)