connected pain is slightly less dysfunctional now, somehow

This commit is contained in:
Bob 2021-10-06 23:57:45 +02:00
parent bfeb0cb737
commit 114e5e1c9a
15 changed files with 317 additions and 83 deletions

View File

@ -439,6 +439,8 @@ public class ModBlocks {
public static Block frozen_planks;
public static Block dirt_dead;
public static Block dirt_oily;
public static Block sand_dirty;
public static Block sand_dirty_red;
public static Block fallout;
public static Block foam_layer;
@ -1595,6 +1597,8 @@ public class ModBlocks {
dirt_dead = new BlockGeneric(Material.ground).setBlockName("dirt_dead").setStepSound(Block.soundTypeGravel).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setLightOpacity(0).setBlockTextureName(RefStrings.MODID + ":dirt_dead");
dirt_oily = new BlockGeneric(Material.ground).setBlockName("dirt_oily").setStepSound(Block.soundTypeGravel).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":dirt_oily");
sand_dirty = new BlockFalling(Material.sand).setBlockName("sand_dirty").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":sand_dirty");
sand_dirty_red = new BlockFalling(Material.sand).setBlockName("sand_dirty_red").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":sand_dirty_red");
sellafield_slaked = new BlockGeneric(Material.rock).setBlockName("sellafield_slaked").setStepSound(Block.soundTypeStone).setHardness(5.0F).setBlockTextureName(RefStrings.MODID + ":sellafield_slaked");
sellafield_0 = new BlockHazard(Material.rock).addRadiation(0.5F).toBlock().setBlockName("sellafield_0").setStepSound(Block.soundTypeStone).setHardness(5.0F).setBlockTextureName(RefStrings.MODID + ":sellafield_0");
@ -2554,6 +2558,8 @@ public class ModBlocks {
GameRegistry.registerBlock(frozen_planks, frozen_planks.getUnlocalizedName());
GameRegistry.registerBlock(dirt_dead, dirt_dead.getUnlocalizedName());
GameRegistry.registerBlock(dirt_oily, dirt_oily.getUnlocalizedName());
GameRegistry.registerBlock(sand_dirty, sand_dirty.getUnlocalizedName());
GameRegistry.registerBlock(sand_dirty_red, sand_dirty_red.getUnlocalizedName());
GameRegistry.registerBlock(fallout, ItemBlockHazard.class, fallout.getUnlocalizedName());
GameRegistry.registerBlock(foam_layer, foam_layer.getUnlocalizedName());
GameRegistry.registerBlock(sand_boron_layer, sand_boron_layer.getUnlocalizedName());

View File

@ -1,8 +1,7 @@
package com.hbm.blocks.test;
import com.hbm.render.block.ct.CTStitchReceiver;
import com.hbm.render.block.ct.IBlockCT;
import com.hbm.render.block.ct.IconCT;
import com.hbm.render.block.ct.IconGeneric;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side;
@ -10,8 +9,6 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.IIcon;
public class TestCT extends Block implements IBlockCT {
@ -36,17 +33,18 @@ public class TestCT extends Block implements IBlockCT {
public boolean isOpaqueCube() {
return true;
}
public IIcon[] frags = new IIcon[20];
@SideOnly(Side.CLIENT)
public CTStitchReceiver rec;
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister reg) {
this.blockIcon = reg.registerIcon(this.getTextureName());
this.frags = IBlockCT.registerIcons(reg, this.getTextureName(), this.blockIcon);
this.rec = IBlockCT.primeReceiver(reg, this.getTextureName(), this.blockIcon);
}
@Override
public IIcon[] getFragments() {
return frags;
return rec.fragCache;
}
}

View File

@ -0,0 +1,73 @@
package com.hbm.entity.qic;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public class EntitySPV extends Entity {
public EntitySPV(World p_i1582_1_) {
super(p_i1582_1_);
this.setSize(0.5F, 0.5F);
}
@Override
protected void entityInit() { }
@Override
protected void readEntityFromNBT(NBTTagCompound p_70037_1_) { }
@Override
protected void writeEntityToNBT(NBTTagCompound p_70014_1_) { }
@Override
public void onUpdate() {
if(this.riddenByEntity != null && this.riddenByEntity instanceof EntityLivingBase && ((EntityLivingBase)this.riddenByEntity).moveForward != 0) {
EntityLivingBase riding = (EntityLivingBase) this.riddenByEntity;
Vec3 vec = riding.getLookVec();
this.motionX = vec.xCoord * riding.moveForward * 0.25D;
this.motionY = vec.yCoord * riding.moveForward * 0.25D;
this.motionZ = vec.zCoord * riding.moveForward * 0.25D;
} else if(this.riddenByEntity == null) {
this.motionY -= 0.01D;
if(this.onGround) {
this.motionX = 0;
this.motionY = 0;
this.motionZ = 0;
}
} else {
this.motionX = 0;
this.motionY = 0;
this.motionZ = 0;
}
this.moveEntity(this.motionX, this.motionY, this.motionZ);
//this.setPositionAndRotation(this.posX + motionX, this.posY + motionY, this.posZ + motionZ, this.rotationYaw, this.rotationPitch);
super.onUpdate();
}
@Override
public boolean canBeCollidedWith() {
return true;
}
@Override
public boolean interactFirst(EntityPlayer player) {
if(super.interactFirst(player)) {
return true;
} else if(!this.worldObj.isRemote && (this.riddenByEntity == null || this.riddenByEntity == player)) {
player.mountEntity(this);
return true;
} else {
return false;
}
}
}

View File

@ -61,6 +61,7 @@ import com.hbm.entity.mob.siege.EntitySiegeZombie;
import com.hbm.entity.mob.siege.SiegeTier;
import com.hbm.entity.particle.*;
import com.hbm.entity.projectile.*;
import com.hbm.entity.qic.EntitySPV;
import com.hbm.handler.*;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.handler.imc.IMCCentrifuge;
@ -485,6 +486,8 @@ public class MainRegistry {
EntityRegistry.registerGlobalEntityID(EntityRADBeast.class, "entity_ntm_radiation_blaze", EntityRegistry.findGlobalUniqueEntityId(), 0x303030, 0x008000);
EntityRegistry.registerGlobalEntityID(EntitySiegeZombie.class, "entity_meme_zombie", EntityRegistry.findGlobalUniqueEntityId(), 0x303030, 0x008000);
EntityRegistry.registerModEntity(EntitySPV.class, "entity_self_propelled_vehicle_mark_1", 160, this, 1000, 1, true);
ForgeChunkManager.setForcedChunkLoadingCallback(this, new LoadingCallback() {
@Override

View File

@ -34,6 +34,7 @@ import com.hbm.packet.GunButtonPacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.render.anim.HbmAnimations;
import com.hbm.render.anim.HbmAnimations.Animation;
import com.hbm.render.block.ct.CTStitchReceiver;
import com.hbm.render.util.RenderAccessoryUtility;
import com.hbm.render.util.RenderOverhead;
import com.hbm.render.util.RenderScreenOverlay;
@ -847,6 +848,11 @@ public class ModEventHandlerClient {
particleBase = event.map.registerIcon(RefStrings.MODID + ":particle/particle_base");
}
@SubscribeEvent
public void postTextureStitch(TextureStitchEvent.Post event) {
CTStitchReceiver.receivers.forEach(x -> x.postStitch());
}
private static final ResourceLocation poster = new ResourceLocation(RefStrings.MODID + ":textures/models/misc/poster.png");
@SubscribeEvent

View File

@ -39,5 +39,4 @@ public class RenderBlockCT implements ISimpleBlockRenderingHandler {
public int getRenderId() {
return TestCT.renderID;
}
}

View File

@ -1,37 +1,93 @@
package com.hbm.render.block.ct;
import java.util.ArrayList;
import java.util.List;
public class CT {
public static final int l = 0; //left
public static final int r = 1; //right
public static final int t = 0; //top
public static final int b = 2; //bottom
public static final int f = 0; //full/unconnected
public static final int c = 4; //connected
public static final int j = 8; //junction
public static final int h = 12; //horizontal
public static final int v = 16; //vertical
public static final int f = 4; //full/unconnected
public static final int c = 8; //connected
public static final int j = 16; //junction
public static final int h = 32; //horizontal
public static final int v = 64; //vertical
public static final int ftl = 0;
public static final int ftr = 1;
public static final int fbl = 2;
public static final int fbr = 3;
public static final int ctl = 4;
public static final int ctr = 5;
public static final int cbl = 6;
public static final int cbr = 7;
public static final int jtl = 8;
public static final int jtr = 9;
public static final int jbl = 10;
public static final int jbr = 11;
public static final int htl = 12;
public static final int htr = 13;
public static final int hbl = 14;
public static final int hbr = 15;
public static final int vtl = 16;
public static final int vtr = 17;
public static final int vbl = 18;
public static final int vbr = 19;
public static final int ftl = f | t | l;
public static final int ftr = f | t | r;
public static final int fbl = f | b | l;
public static final int fbr = f | b | r;
public static final int ctl = c | t | l;
public static final int ctr = c | t | r;
public static final int cbl = c | b | l;
public static final int cbr = c | b | r;
public static final int jtl = j | t | l;
public static final int jtr = j | t | r;
public static final int jbl = j | b | l;
public static final int jbr = j | b | r;
public static final int htl = h | t | l;
public static final int htr = h | t | r;
public static final int hbl = h | b | l;
public static final int hbr = h | b | r;
public static final int vtl = v | t | l;
public static final int vtr = v | t | r;
public static final int vbl = v | b | l;
public static final int vbr = v | b | r;
/*private static int[] coords = new int[20];
private static int[] indices = new int[68];
static {
int[] dimX = new int[] {CT.t, CT.b};
int[] dimY = new int[] {CT.l, CT.r};
int[] dimZ = new int[] {CT.f, CT.c, CT.j, CT.h, CT.v};
int index = 0;
for(int i : dimX) {
for(int j : dimY) {
for(int k : dimZ) {
coords[index] = i | j | k;
indices[i | j | k] = index;
index++;
}
}
}
}
public static int coordToIndex(int coord) {
return indices[coord];
}
public static int indexToCoord(int index) {
return coords[index];
}*/
public static int[] coords = new int[] {
ftl,
ftr,
fbl,
fbr,
ctl,
ctr,
cbl,
cbr,
jtl,
jtr,
jbl,
jbr,
htl,
htr,
hbl,
hbr,
vtl,
vtr,
vbl,
vbr
};
/* _____________________
* / I am in great pain. \

View File

@ -0,0 +1,29 @@
package com.hbm.render.block.ct;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.util.IIcon;
import net.minecraftforge.client.event.TextureStitchEvent;
public class CTStitchReceiver {
public static final List<CTStitchReceiver> receivers = new ArrayList();
IIcon parentFull;
IIcon parentCT;
public IIcon[] fragCache = new IIcon[20];
public CTStitchReceiver(IIcon parentFull, IIcon parentCT) {
this.parentFull = parentFull;
this.parentCT = parentCT;
receivers.add(this);
}
public void postStitch() {
for(int i = 0; i < 20; i++) {
fragCache[i] = new IconCT(i < 4 ? parentFull : parentCT, CT.coords[i]);
}
}
}

View File

@ -13,16 +13,8 @@ public interface IBlockCT {
return this == block;
}
public static IIcon[] registerIcons(IIconRegister reg, String textureName, IIcon blockIcon) {
IIcon[] frags = new IIcon[20];
IIcon ct = new IconGeneric(textureName + "_ct");
reg.registerIcon(textureName + "_ct");
for(int i = 0; i < frags.length; i++) {
frags[i] = new IconCT(i < 4 ? blockIcon : ct, i);
}
return frags;
public static CTStitchReceiver primeReceiver(IIconRegister reg, String textureName, IIcon blockIcon) {
IIcon ct = reg.registerIcon(textureName + "_ct");
return new CTStitchReceiver(blockIcon, ct);
}
}

View File

@ -16,7 +16,7 @@ public class IconCT implements IIcon {
this.parent = parent;
this.type = type;
int sub = ((type & f) != 0) ? 2 : 4;
int sub = (type < 4) ? 2 : 4;
float lenU = (parent.getMaxU() - parent.getMinU()) / sub;
float lenV = (parent.getMaxV() - parent.getMinV()) / sub;

View File

@ -1,13 +0,0 @@
package com.hbm.render.block.ct;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
@SideOnly(Side.CLIENT)
public class IconGeneric extends TextureAtlasSprite {
public IconGeneric(String name) {
super(name);
}
}

View File

@ -11,6 +11,7 @@ import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
public class RenderBlocksCT extends RenderBlocks {
@ -63,31 +64,56 @@ public class RenderBlocksCT extends RenderBlocks {
return false;
}
CTContext.loadContext(blockAccess, x, y, z, block);
return super.renderStandardBlock(block, x, y, z);
}
@Override
public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) {
//super.renderFaceXPos(block, x, y, z, icon);
initSideInfo();
CTFace face = CTContext.faces[ForgeDirection.EAST.ordinal()];
/// ORDER: LEXICAL ///
drawFace(
new double[] {x + 1, y + 1, z + 1},
new double[] {x + 1, y + 1, z + 0},
new double[] {x + 1, y + 0, z + 1},
new double[] {x + 1, y + 0, z + 0},
face.getTopLeft(),
face.getTopRight(),
face.getBottomLeft(),
face.getBottomRight());
}
@Override
public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) {
//super.renderFaceXNeg(block, x, y, z, icon);
initSideInfo();
CTFace face = CTContext.faces[ForgeDirection.WEST.ordinal()];
/// ORDER: LEXICAL ///
drawFace(
new double[] {x + 0, y + 1, z + 0},
new double[] {x + 0, y + 1, z + 1},
new double[] {x + 0, y + 0, z + 0},
new double[] {x + 0, y + 0, z + 1},
face.getTopLeft(),
face.getTopRight(),
face.getBottomLeft(),
face.getBottomRight());
}
@Override
public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon) {
//super.renderFaceYPos(block, x, y, z, icon);
initSideInfo();
CTFace face = CTContext.faces[1];
CTFace face = CTContext.faces[ForgeDirection.UP.ordinal()];
/// ORDER: LEXICAL ///
drawFace(
new double[] {x + 0, y + 1, z + 0},
new double[] {x + 1, y + 1, z + 0},
new double[] {x + 1, y + 1, z + 1},
new double[] {x + 0, y + 1, z + 1},
new double[] {x + 1, y + 1, z + 1},
face.getTopLeft(),
face.getTopRight(),
face.getBottomLeft(),
@ -96,17 +122,53 @@ public class RenderBlocksCT extends RenderBlocks {
@Override
public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon) {
//super.renderFaceYNeg(block, x, y, z, icon);
initSideInfo();
CTFace face = CTContext.faces[ForgeDirection.DOWN.ordinal()];
/// ORDER: LEXICAL ///
drawFace(
new double[] {x + 0, y + 0, z + 1},
new double[] {x + 1, y + 0, z + 1},
new double[] {x + 0, y + 0, z + 0},
new double[] {x + 1, y + 0, z + 0},
face.getTopLeft(),
face.getTopRight(),
face.getBottomLeft(),
face.getBottomRight());
}
@Override
public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) {
//super.renderFaceZPos(block, x, y, z, icon);
initSideInfo();
CTFace face = CTContext.faces[ForgeDirection.SOUTH.ordinal()];
/// ORDER: LEXICAL ///
drawFace(
new double[] {x + 0, y + 1, z + 1},
new double[] {x + 1, y + 1, z + 1},
new double[] {x + 0, y + 0, z + 1},
new double[] {x + 1, y + 0, z + 1},
face.getTopLeft(),
face.getTopRight(),
face.getBottomLeft(),
face.getBottomRight());
}
@Override
public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) {
//super.renderFaceZNeg(block, x, y, z, icon);
initSideInfo();
CTFace face = CTContext.faces[ForgeDirection.NORTH.ordinal()];
/// ORDER: LEXICAL ///
drawFace(
new double[] {x + 1, y + 1, z + 0},
new double[] {x + 0, y + 1, z + 0},
new double[] {x + 1, y + 0, z + 0},
new double[] {x + 0, y + 0, z + 0},
face.getTopLeft(),
face.getTopRight(),
face.getBottomLeft(),
face.getBottomRight());
}
/// ORDER: LEXICAL ///
@ -118,22 +180,38 @@ public class RenderBlocksCT extends RenderBlocks {
double[] fcr = avgCoords(ftr, fbr);
double[] fcc = avgCoords(ftc, fbc);
IIcon steel = ModBlocks.block_steel.getIcon(0, 0);
drawSubFace(ftl, this.tl, ftr, this.tr, fbl, this.bl, fbr, this.br, steel);
/*drawSubFace(ftl, this.tl, ftc, this.tc, fcl, this.cl, fcc, this.cc, steel);
drawSubFace(ftc, this.tc, ftr, this.tr, fcc, this.cc, fcr, this.cr, steel);
drawSubFace(fcl, this.cl, fcc, this.cc, fbl, this.bl, fbc, this.bc, steel);
drawSubFace(fcc, this.cc, fcr, this.cr, fbc, this.bc, fbr, this.br, steel);*/
IIcon atl = ModBlocks.block_steel.getIcon(0, 0);
IIcon atr = ModBlocks.block_copper.getIcon(0, 0);
IIcon abl = ModBlocks.block_tungsten.getIcon(0, 0);
IIcon abr = ModBlocks.block_aluminium.getIcon(0, 0);
/*drawSubFace(ftl, this.tl, ftc, this.tc, fcl, this.cl, fcc, this.cc, atl);
drawSubFace(ftc, this.tc, ftr, this.tr, fcc, this.cc, fcr, this.cr, atr);
drawSubFace(fcl, this.cl, fcc, this.cc, fbl, this.bl, fbc, this.bc, abl);
drawSubFace(fcc, this.cc, fcr, this.cr, fbc, this.bc, fbr, this.br, abr);*/
drawSubFace(ftl, this.tl, ftc, this.tc, fcl, this.cl, fcc, this.cc, itl);
drawSubFace(ftc, this.tc, ftr, this.tr, fcc, this.cc, fcr, this.cr, itr);
drawSubFace(fcl, this.cl, fcc, this.cc, fbl, this.bl, fbc, this.bc, ibl);
drawSubFace(fcc, this.cc, fcr, this.cr, fbc, this.bc, fbr, this.br, ibr);
}
/// ORDER: LEXICAL ///
/// ORDER: GOD IS DEAD ///
private void drawSubFace(double[] ftl, VertInfo ntl, double[] ftr, VertInfo ntr, double[] fbl, VertInfo nbl, double[] fbr, VertInfo nbr, IIcon icon) {
/// ORDER: ROTATIONAL ///
drawVert(ftl, icon.getMinU(), icon.getMinV(), ntl);
boolean debugColor = false;
System.out.println(icon.getIconName());
/// ORDER: I DON'T FUCKING KNOW AT THIS POINT ///
if(debugColor) tess.setColorOpaque_F(1F, 1F, 0F);
drawVert(ftr, icon.getMaxU(), icon.getMinV(), ntr);
drawVert(fbr, icon.getMaxU(), icon.getMaxV(), nbr);
if(debugColor) tess.setColorOpaque_F(1F, 0F, 0F);
drawVert(ftl, icon.getMinU(), icon.getMinV(), ntl);
if(debugColor) tess.setColorOpaque_F(0F, 0F, 1F);
drawVert(fbl, icon.getMinU(), icon.getMaxV(), nbl);
if(debugColor) tess.setColorOpaque_F(0F, 1F, 0F);
drawVert(fbr, icon.getMaxU(), icon.getMaxV(), nbr);
}
private void drawVert(double[] coord, double u, double v, VertInfo info) {
@ -152,9 +230,9 @@ public class RenderBlocksCT extends RenderBlocks {
private double[] avgCoords(double[] first, double[] second) {
return new double[] {
(first[0] + second[0]) / 2,
(first[1] + second[1]) / 2,
(first[2] + second[2]) / 2
(first[0] + second[0]) / 2D,
(first[1] + second[1]) / 2D,
(first[2] + second[2]) / 2D
};
}

View File

@ -93,7 +93,7 @@ public class TileEntityMachineFrackingTower extends TileEntityOilDrillBase imple
this.tanks[2].setFill(tanks[2].getFill() - 10);
for(int i = 0; i < 10; i++) {
for(int i = 0; i < 100; i++) {
int rX = xCoord + (int)(worldObj.rand.nextGaussian() * 75);
int rZ = zCoord + (int)(worldObj.rand.nextGaussian() * 75);
int rY = worldObj.getHeightValue(rX, rZ) - 1;
@ -103,6 +103,13 @@ public class TileEntityMachineFrackingTower extends TileEntityOilDrillBase imple
if(ground == Blocks.grass || ground == Blocks.dirt) {
worldObj.setBlock(rX, rY, rZ, worldObj.rand.nextInt(10) == 0 ? ModBlocks.dirt_oily : ModBlocks.dirt_dead);
} else if(ground == Blocks.sand || ground == ModBlocks.ore_oil_sand) {
if(worldObj.getBlockMetadata(rX, rY, rZ) == 1)
worldObj.setBlock(rX, rY, rZ, ModBlocks.sand_dirty_red);
else
worldObj.setBlock(rX, rY, rZ, ModBlocks.sand_dirty);
} else if(ground.getMaterial() == Material.leaves) {
worldObj.setBlockToAir(rX, rY, rZ);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 836 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 752 B