more world gen configs, classic cable renderer half done

This commit is contained in:
Boblet 2022-04-01 15:26:13 +02:00
parent 1478664109
commit 115cc07af8
7 changed files with 120 additions and 10 deletions

View File

@ -47,6 +47,8 @@ public class WorldConfig {
public static int endTikiteSpawn = 8;
public static int randomSpawn = 16;
public static int radioStructure = 500;
public static int antennaStructure = 250;
public static int atomStructure = 500;
@ -124,6 +126,8 @@ public class WorldConfig {
endTikiteSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.E00_tikiteSpawnrate", "Amount of end trixite per chunk", 8);
randomSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.R00_randomOreSpawnrate", "Amount of random ore per chunk", 16);
final String CATEGORY_DUNGEON = "04_dungeons";
radioStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.00_radioSpawn", "Spawn radio station on every nTH chunk", 500);
antennaStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.01_antennaSpawn", "Spawn antenna on every nTH chunk", 250);

View File

@ -118,7 +118,7 @@ public class HbmWorldGen implements IWorldGenerator {
DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.aluminiumClusterSpawn, 6, 15, 35, ModBlocks.cluster_aluminium);
DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.copperClusterSpawn, 6, 15, 20, ModBlocks.cluster_copper);
for(int k = 0; k < 16; k++) {
for(int k = 0; k < WorldConfig.randomSpawn; k++) {
BlockMotherOfAllOres.shuffleOverride(rand);
DungeonToolbox.generateOre(world, rand, i, j, 1, 10, 4, 30, ModBlocks.ore_random);
}

View File

@ -678,7 +678,7 @@ public class ClientProxy extends ServerProxy {
RenderingRegistry.registerBlockHandler(new RenderBattery());
RenderingRegistry.registerBlockHandler(new RenderAnvil());
RenderingRegistry.registerBlockHandler(new RenderCrystal());
RenderingRegistry.registerBlockHandler(new RenderTestCable());
RenderingRegistry.registerBlockHandler(new RenderCable());
RenderingRegistry.registerBlockHandler(new RenderCableClassic());
RenderingRegistry.registerBlockHandler(new RenderTestPipe());
RenderingRegistry.registerBlockHandler(new RenderBlockCT());

View File

@ -67,6 +67,7 @@ public class RenderBlockMultipass implements ISimpleBlockRenderingHandler {
renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 5, metadata));
tessellator.draw();
/** terrible hack to make this shit work */
if(block == ModBlocks.ore_random) {
this.currentPass = 1;

View File

@ -7,19 +7,15 @@ import com.hbm.lib.Library;
import com.hbm.main.ResourceManager;
import com.hbm.render.util.ObjUtil;
import api.hbm.energy.IEnergyConnector;
import api.hbm.energy.IEnergyConnectorBlock;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.model.obj.WavefrontObject;
import net.minecraftforge.common.util.ForgeDirection;
public class RenderTestCable implements ISimpleBlockRenderingHandler {
public class RenderCable implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {

View File

@ -41,15 +41,124 @@ public class RenderCableClassic implements ISimpleBlockRenderingHandler {
double px = 0.0625D;
double uv_cL = iicon.getMinU();
double uv_cR = iicon.getMinU() + spanU * 5 / px;
double uv_cT = iicon.getMaxV();
double uv_cB = iicon.getMaxV() - spanV * 5 / px;
double uv_cR = iicon.getInterpolatedU(5);
double uv_cT = iicon.getMinV();
double uv_cB = iicon.getInterpolatedV(5);
double uv_sL = iicon.getInterpolatedU(5);
double uv_sR = iicon.getInterpolatedU(10);
double uv_sT = iicon.getMinV();
double uv_sB = iicon.getInterpolatedV(5);
double pos_nil = 0D;
double pos_one = 1D;
double pos_min = px * 5.5D;
double pos_max = px * 10.5D;
float topColor = 1.0F;
float brightColor = 0.8F;
float darkColor = 0.6F;
float bottomColor = 0.5F;
//TODO: all that manual tessellator crap
//this is a lot less tedious than it looks when you draw a 3D cube to take the vertex positions from
if(!pY) {
tessellator.setColorOpaque_F(topColor, topColor, topColor);
tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_min, uv_cR, uv_cT);
tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_min, uv_cL, uv_cT);
tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_max, uv_cL, uv_cB);
tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_max, uv_cR, uv_cB);
} else {
tessellator.setColorOpaque_F(brightColor, brightColor, brightColor);
tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_min, uv_sL, uv_sT);
tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_min, uv_sL, uv_sB);
tessellator.addVertexWithUV(x + pos_min, y + pos_one, z + pos_min, uv_sR, uv_sB);
tessellator.addVertexWithUV(x + pos_max, y + pos_one, z + pos_min, uv_sR, uv_sT);
tessellator.setColorOpaque_F(darkColor, darkColor, darkColor);
tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_max, uv_sL, uv_sT);
tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_min, uv_sL, uv_sB);
tessellator.addVertexWithUV(x + pos_max, y + pos_one, z + pos_min, uv_sR, uv_sB);
tessellator.addVertexWithUV(x + pos_max, y + pos_one, z + pos_max, uv_sR, uv_sT);
tessellator.setColorOpaque_F(brightColor, brightColor, brightColor);
tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_max, uv_sL, uv_sT);
tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_max, uv_sL, uv_sB);
tessellator.addVertexWithUV(x + pos_max, y + pos_one, z + pos_max, uv_sR, uv_sB);
tessellator.addVertexWithUV(x + pos_min, y + pos_one, z + pos_max, uv_sR, uv_sT);
tessellator.setColorOpaque_F(darkColor, darkColor, darkColor);
tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_min, uv_sL, uv_sT);
tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_max, uv_sL, uv_sB);
tessellator.addVertexWithUV(x + pos_min, y + pos_one, z + pos_max, uv_sR, uv_sB);
tessellator.addVertexWithUV(x + pos_min, y + pos_one, z + pos_min, uv_sR, uv_sT);
}
if(!nY) {
tessellator.setColorOpaque_F(bottomColor, bottomColor, bottomColor);
tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_min, uv_cL, uv_cT);
tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_min, uv_cR, uv_cT);
tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_max, uv_cR, uv_cB);
tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_max, uv_cL, uv_cB);
} else {
tessellator.setColorOpaque_F(brightColor, brightColor, brightColor);
tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_min, uv_sL, uv_sT);
tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_min, uv_sL, uv_sB);
tessellator.addVertexWithUV(x + pos_max, y + pos_nil, z + pos_min, uv_sR, uv_sB);
tessellator.addVertexWithUV(x + pos_min, y + pos_nil, z + pos_min, uv_sR, uv_sT);
tessellator.setColorOpaque_F(darkColor, darkColor, darkColor);
tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_min, uv_sL, uv_sT);
tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_max, uv_sL, uv_sB);
tessellator.addVertexWithUV(x + pos_max, y + pos_nil, z + pos_max, uv_sR, uv_sB);
tessellator.addVertexWithUV(x + pos_max, y + pos_nil, z + pos_min, uv_sR, uv_sT);
tessellator.setColorOpaque_F(brightColor, brightColor, brightColor);
tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_max, uv_sL, uv_sT);
tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_max, uv_sL, uv_sB);
tessellator.addVertexWithUV(x + pos_min, y + pos_nil, z + pos_max, uv_sR, uv_sB);
tessellator.addVertexWithUV(x + pos_max, y + pos_nil, z + pos_max, uv_sR, uv_sT);
tessellator.setColorOpaque_F(darkColor, darkColor, darkColor);
tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_max, uv_sL, uv_sT);
tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_min, uv_sL, uv_sB);
tessellator.addVertexWithUV(x + pos_min, y + pos_nil, z + pos_min, uv_sR, uv_sB);
tessellator.addVertexWithUV(x + pos_min, y + pos_nil, z + pos_max, uv_sR, uv_sT);
}
if(!pX) {
tessellator.setColorOpaque_F(darkColor, darkColor, darkColor);
tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_min, uv_cR, uv_cT);
tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_max, uv_cL, uv_cT);
tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_max, uv_cL, uv_cB);
tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_min, uv_cR, uv_cB);
}
if(!nX) {
tessellator.setColorOpaque_F(darkColor, darkColor, darkColor);
tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_max, uv_cL, uv_cT);
tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_min, uv_cR, uv_cT);
tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_min, uv_cR, uv_cB);
tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_max, uv_cL, uv_cB);
}
if(!pZ) {
tessellator.setColorOpaque_F(brightColor, brightColor, brightColor);
tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_max, uv_cL, uv_cT);
tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_max, uv_cR, uv_cT);
tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_max, uv_cR, uv_cB);
tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_max, uv_cL, uv_cB);
}
if(!nZ) {
tessellator.setColorOpaque_F(brightColor, brightColor, brightColor);
tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_min, uv_cR, uv_cT);
tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_min, uv_cL, uv_cT);
tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_min, uv_cL, uv_cB);
tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_min, uv_cR, uv_cB);
}
return true;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 229 B

After

Width:  |  Height:  |  Size: 297 B