Skip to content

Commit

Permalink
small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadiboo committed Nov 25, 2018
1 parent 83b3146 commit 98662dc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
17 changes: 10 additions & 7 deletions src/main/java/cadiboo/nocubes/EventSubscriber.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import cadiboo.renderchunkrebuildchunkhooks.event.RebuildChunkBlockEvent;
import cadiboo.renderchunkrebuildchunkhooks.event.RebuildChunkBlockRenderInLayerEvent;
import cadiboo.renderchunkrebuildchunkhooks.event.RebuildChunkBlockRenderInTypeEvent;
import net.minecraft.block.material.Material;
import net.minecraft.util.BlockRenderLayer;
import cadiboo.renderchunkrebuildchunkhooks.event.RebuildChunkPostEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
Expand Down Expand Up @@ -38,15 +37,19 @@ public static void onRebuildChunkBlockRenderInLayerEvent(final RebuildChunkBlock
@SubscribeEvent(priority = EventPriority.HIGH, receiveCanceled = false)
public static void onRebuildChunkBlockRenderInTypeEvent(final RebuildChunkBlockRenderInTypeEvent event) {

// if(event.getBlockState().getMaterial()== Material.AIR) {
event.setResult(Event.Result.DENY);
// }
// if(event.getBlockState().getMaterial()== Material.AIR) {
event.setResult(Event.Result.DENY);
// }

}

private static BlockRenderLayer airRenderLayerHook() {
@SubscribeEvent(priority = EventPriority.HIGH, receiveCanceled = false)
public static void onRebuildChunkPostEventEvent(final RebuildChunkPostEvent event) {

return BlockRenderLayer.CUTOUT;
// No. not a good idea
// if (new Random().nextInt(16 + 1) == 0) {
// new Thread(System::gc, "NoCubes Garbage Collecter").start();
// }

}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/cadiboo/nocubes/renderer/MarchingCubes.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.ChunkCache;
import net.minecraft.world.IBlockAccess;
import org.apache.logging.log4j.LogManager;

public class MarchingCubes {

Expand Down Expand Up @@ -399,11 +398,10 @@ public static boolean renderBlock(IBlockState state, final BlockPos pos, final C
final IBlockState textureColorState = state;
final BlockPos textureColorPos = new BlockPos(fastx, fasty, fastz);


//TODO it should _never_ be air
if (state.getBlock() == Blocks.AIR) {
return false;
// LogManager.getLogger().info(state);
// LogManager.getLogger().info(state);
}

final TextureAtlasSprite sprite = ModUtil.getSprite(textureColorState, textureColorPos, blockRendererDispatcher);
Expand Down Expand Up @@ -541,6 +539,8 @@ public static boolean renderBlock(IBlockState state, final BlockPos pos, final C
vertexList[11] = vertexInterpolation(isolevel, pointList[3], pointList[7], pointValue[3], pointValue[7]);
}

//TODO don't render triangle if it is completely horzontal or vetical

for (int triangleIndex = 0; TRIANGLE_TABLE[cubeIndex][triangleIndex] != - 1; triangleIndex += 3) {

// tessellator.setBrightness(state.getMixedBrightnessForBlock(cache, x, y + 1, z));
Expand Down

0 comments on commit 98662dc

Please sign in to comment.