mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-22 21:09:51 +00:00
Fix "upper half" wood slabs having the wrong wood type
This commit is contained in:
1 parent
dcf7776cc1
commit
ff9942d0bc
3 files changed
+7
-3
No files matched your search
@@ -50,6 +50,7 @@ public abstract class BlockArbSlab extends BlockForestrySlab<EnumForestryWoodTyp
|
||||
@Nonnull
|
||||
@Override
|
||||
public EnumForestryWoodType getWoodType(int meta) {
|
||||
meta &= ~8; // unset the top/bottom slab bit
|
||||
int variantCount = getVariant().getAllowedValues().size();
|
||||
int variantMeta = (meta % variantCount) + getBlockNumber() * VARIANTS_PER_BLOCK;
|
||||
return EnumForestryWoodType.byMetadata(variantMeta);
|
||||
|
||||
@@ -50,6 +50,7 @@ public abstract class BlockFireproofVanillaSlab extends BlockForestrySlab<EnumVa
|
||||
@Nonnull
|
||||
@Override
|
||||
public EnumVanillaWoodType getWoodType(int meta) {
|
||||
meta &= ~8; // unset the top/bottom slab bit
|
||||
int variantCount = getVariant().getAllowedValues().size();
|
||||
int variantMeta = (meta % variantCount) + getBlockNumber() * VARIANTS_PER_BLOCK;
|
||||
return EnumVanillaWoodType.byMetadata(variantMeta);
|
||||
|
||||
@@ -76,11 +76,13 @@ public abstract class BlockForestrySlab<T extends Enum<T> & IWoodType> extends B
|
||||
return blockNumber;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return this.isDouble() ? new BlockStateContainer(this, getVariant()) : new BlockStateContainer(this, HALF, getVariant());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
T woodType = getWoodType(meta);
|
||||
@@ -99,8 +101,7 @@ public abstract class BlockForestrySlab<T extends Enum<T> & IWoodType> extends B
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
T woodType = state.getValue(getVariant());
|
||||
int meta = woodType.getMetadata() - blockNumber * VARIANTS_PER_BLOCK;
|
||||
int meta = damageDropped(state);
|
||||
|
||||
if (!this.isDouble() && state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP) {
|
||||
meta |= 8;
|
||||
@@ -111,7 +112,8 @@ public abstract class BlockForestrySlab<T extends Enum<T> & IWoodType> extends B
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return state.getValue(getVariant()).getMetadata() - blockNumber * VARIANTS_PER_BLOCK;
|
||||
T woodType = state.getValue(getVariant());
|
||||
return woodType.getMetadata() - blockNumber * VARIANTS_PER_BLOCK;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user