mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-18 19:39:37 +00:00
Adding flower blockstate and blockstatemapper
This commit is contained in:
1 parent
5a64454906
commit
2a23e60cdb
60 files changed
+405
-201
No files matched your search
@@ -0,0 +1,31 @@
|
||||
package binnie.botany.flower;
|
||||
|
||||
import java.util.Map;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import binnie.Constants;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class StateMapperFlower extends StateMapperBase {
|
||||
|
||||
@Override
|
||||
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
|
||||
final Map<IProperty<?>, Comparable<?>> properties = Maps.newLinkedHashMap(state.getProperties());
|
||||
IFlowerType flowerType = (IFlowerType) state.getValue(BlockFlower.FLOWER);
|
||||
if (flowerType.getSections() < 2) {
|
||||
properties.remove(BlockFlower.SECTION);
|
||||
}else if(flowerType.getSections() <= state.getValue(BlockFlower.SECTION)){
|
||||
properties.put(BlockFlower.SECTION, flowerType.getSections()-1);
|
||||
}
|
||||
|
||||
return new ModelResourceLocation(Constants.BOTANY_MOD_ID + ":flower", getPropertyString(properties));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user