mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-22 04:52:25 +00:00
Loads of work on CTM, work on fixing multi blocks
This commit is contained in:
1 parent
07a7391dfc
commit
3b75d9ff1e
111 files changed
+526
-312
No files matched your search
@@ -0,0 +1,60 @@
|
||||
package mekanism.client.render.ctm;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class CTMData
|
||||
{
|
||||
public List<String> acceptableBlockStates = new ArrayList<String>();
|
||||
|
||||
public boolean renderConvexConnections = false;
|
||||
|
||||
public String facingOverride;
|
||||
|
||||
public CTMData(IStringSerializable... states)
|
||||
{
|
||||
for(IStringSerializable state : states)
|
||||
{
|
||||
acceptableBlockStates.add(state.getName());
|
||||
}
|
||||
}
|
||||
|
||||
public CTMData setRenderConvexConnections()
|
||||
{
|
||||
renderConvexConnections = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CTMData setFacingOverride(String s)
|
||||
{
|
||||
facingOverride= s;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean hasFacingOverride()
|
||||
{
|
||||
return facingOverride != null;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldRenderSide(IBlockAccess world, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
|
||||
if(state.getBlock() instanceof ICTMBlock)
|
||||
{
|
||||
IStringSerializable serializable = (IStringSerializable)state.getValue(((ICTMBlock)state.getBlock()).getTypeProperty());
|
||||
return acceptableBlockStates.contains(serializable.getName());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user