crates save contents, more connected pain, fixed mercury dupe with drums
@ -1,5 +1,7 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
@ -24,6 +26,7 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@ -87,50 +90,31 @@ public class BlockStorageCrate extends BlockContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) {
|
||||
ISidedInventory tileentityfurnace = (ISidedInventory) p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_);
|
||||
|
||||
if(((TileEntityLockableBase) p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_)).isLocked()) {
|
||||
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
|
||||
return;
|
||||
}
|
||||
|
||||
if(tileentityfurnace != null) {
|
||||
for(int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) {
|
||||
ItemStack itemstack = tileentityfurnace.getStackInSlot(i1);
|
||||
|
||||
if(itemstack != null) {
|
||||
float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while(itemstack.stackSize > 0) {
|
||||
int j1 = this.field_149933_a.nextInt(21) + 10;
|
||||
|
||||
if(j1 > itemstack.stackSize) {
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
if(itemstack.hasTagCompound()) {
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) this.field_149933_a.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) this.field_149933_a.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) this.field_149933_a.nextGaussian() * f3;
|
||||
p_149749_1_.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ArrayList<ItemStack> drops = new ArrayList();
|
||||
|
||||
ItemStack drop = new ItemStack(this);
|
||||
ISidedInventory inv = (ISidedInventory)world.getTileEntity(x, y, z);
|
||||
|
||||
if(inv != null) {
|
||||
|
||||
drop.stackTagCompound = new NBTTagCompound();
|
||||
|
||||
for(int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
if(stack == null)
|
||||
continue;
|
||||
|
||||
NBTTagCompound slot = new NBTTagCompound();
|
||||
stack.writeToNBT(slot);
|
||||
drop.stackTagCompound.setTag("slot" + i, slot);
|
||||
}
|
||||
|
||||
p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_);
|
||||
}
|
||||
|
||||
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
|
||||
|
||||
drops.add(drop);
|
||||
|
||||
return drops;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -161,10 +145,19 @@ public class BlockStorageCrate extends BlockContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||
|
||||
ISidedInventory inv = (ISidedInventory)world.getTileEntity(x, y, z);
|
||||
|
||||
if(inv != null && stack.hasTagCompound()) {
|
||||
|
||||
for(int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
inv.setInventorySlotContents(i, ItemStack.loadItemStackFromNBT(stack.stackTagCompound.getCompoundTag("slot" + i)));
|
||||
}
|
||||
}
|
||||
|
||||
if(this != ModBlocks.safe)
|
||||
super.onBlockPlacedBy(world, x, y, z, player, itemStack);
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
|
||||
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
|
||||
@ -181,5 +174,4 @@ public class BlockStorageCrate extends BlockContainer {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -4,16 +4,26 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CT {
|
||||
|
||||
/* LEXICAL ORDER */
|
||||
// 1 2 3
|
||||
// 4 # 5
|
||||
// 6 7 8
|
||||
|
||||
/* ROTATIONAL ORDER */
|
||||
// 1 2 3
|
||||
// 8 # 4
|
||||
// 7 6 5
|
||||
|
||||
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 = 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 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 ftl = f | t | l;
|
||||
public static final int ftr = f | t | r;
|
||||
@ -36,58 +46,34 @@ public class CT {
|
||||
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 boolean isL(int i) {
|
||||
return (i & l) != 0;
|
||||
}
|
||||
public static boolean isR(int i) {
|
||||
return (i & r) != 0;
|
||||
}
|
||||
public static boolean isT(int i) {
|
||||
return (i & t) != 0;
|
||||
}
|
||||
public static boolean isB(int i) {
|
||||
return (i & b) != 0;
|
||||
}
|
||||
|
||||
public static int coordToIndex(int coord) {
|
||||
return indices[coord];
|
||||
public static boolean isF(int i) {
|
||||
return i >= f && i < f + 4;
|
||||
}
|
||||
public static boolean isC(int i) {
|
||||
return i >= c && i < c + 4;
|
||||
}
|
||||
public static boolean isJ(int i) {
|
||||
return i >= j && i < j + 4;
|
||||
}
|
||||
public static boolean isH(int i) {
|
||||
return i >= h && i < h + 4;
|
||||
}
|
||||
public static boolean isV(int i) {
|
||||
return i >= v && i < v + 4;
|
||||
}
|
||||
|
||||
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. \
|
||||
|
||||
@ -4,6 +4,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import static com.hbm.render.block.ct.CT.*;
|
||||
|
||||
@ -11,19 +12,53 @@ public class CTContext {
|
||||
|
||||
public static CTFace[] faces;
|
||||
|
||||
//dim 1: faces (forgeDir)
|
||||
//dim 2: neighbors (TL, TC, TR, CL, CR, BL, BC, BR)
|
||||
//dim 3: coord (x/y/z, [-1;1])
|
||||
//dim 1: 6x faces (forgeDir)
|
||||
//dim 2: 8x neighbors (TL, TC, TR, CL, CR, BL, BC, BR)
|
||||
//dim 3: 3x coord (x/y/z, [-1;1])
|
||||
public static int[][][] access = new int[][][] {
|
||||
{ {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0} },
|
||||
{ {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0} },
|
||||
{ {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0} },
|
||||
{ {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0} },
|
||||
{ {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0} },
|
||||
{ {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0} }
|
||||
//TODO
|
||||
lcfs(ForgeDirection.NORTH, ForgeDirection.EAST), //DOWN guess
|
||||
lcfs(ForgeDirection.SOUTH, ForgeDirection.EAST), //UP guess
|
||||
lcfs(ForgeDirection.UP, ForgeDirection.EAST), //NORTH
|
||||
lcfs(ForgeDirection.UP, ForgeDirection.WEST), //SOUTH
|
||||
lcfs(ForgeDirection.UP, ForgeDirection.NORTH), //WEST
|
||||
lcfs(ForgeDirection.UP, ForgeDirection.EAST) //EAST
|
||||
};
|
||||
|
||||
//lexical coordinates from side
|
||||
private static int[][] lcfs(ForgeDirection up, ForgeDirection left) {
|
||||
|
||||
ForgeDirection down = up.getOpposite();
|
||||
ForgeDirection right = left.getOpposite();
|
||||
|
||||
int[][] lexicalCoordinates = new int[][] {
|
||||
cfs(up, left),
|
||||
cfs(up),
|
||||
cfs(up, right),
|
||||
cfs(left),
|
||||
cfs(right),
|
||||
cfs(down, left),
|
||||
cfs(down),
|
||||
cfs(down, right),
|
||||
};
|
||||
|
||||
return lexicalCoordinates;
|
||||
}
|
||||
|
||||
//coordinates from sides
|
||||
private static int[] cfs(ForgeDirection... dirs) {
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int z = 0;
|
||||
|
||||
for(ForgeDirection dir : dirs) {
|
||||
x += dir.offsetX;
|
||||
y += dir.offsetY;
|
||||
z += dir.offsetZ;
|
||||
}
|
||||
|
||||
return new int[] {x, y, z};
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the six CTFaces and fills the faces array, the faces contain the information on what icon types should be used
|
||||
* @param world
|
||||
@ -68,12 +103,18 @@ public class CTContext {
|
||||
|
||||
/**
|
||||
* Returns the overarching texture type based on whether the horizontal, vertical and corner are connected
|
||||
* @param vert
|
||||
* @param hor
|
||||
* @param corner
|
||||
* @param vert
|
||||
* @return the bitmask for the full texture type that should be used (f/c/j/h/v)
|
||||
*/
|
||||
public static int cornerType(boolean vert, boolean hor, boolean corner) {
|
||||
public static int cornerType(boolean hor, boolean corner, boolean vert) {
|
||||
|
||||
/*
|
||||
* C - V
|
||||
* |
|
||||
* H
|
||||
*/
|
||||
|
||||
if(vert && hor && corner)
|
||||
return c;
|
||||
|
||||
@ -23,7 +23,7 @@ public class CTStitchReceiver {
|
||||
public void postStitch() {
|
||||
|
||||
for(int i = 0; i < 20; i++) {
|
||||
fragCache[i] = new IconCT(i < 4 ? parentFull : parentCT, CT.coords[i]);
|
||||
fragCache[i] = new IconCT(i < 4 ? parentFull : parentCT, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,18 +24,18 @@ public class IconCT implements IIcon {
|
||||
float dv = parent.getMinV();
|
||||
|
||||
//set pos to full block (coarse positioning)
|
||||
if((type & v) > 0 || (type & j) > 0) {
|
||||
if(CT.isV(type) || CT.isJ(type)) {
|
||||
du += lenU * 2;
|
||||
}
|
||||
if((type & h) > 0 || (type & j) > 0) {
|
||||
if(CT.isH(type) || CT.isJ(type)) {
|
||||
dv += lenV * 2;
|
||||
}
|
||||
|
||||
//set pos to sub-block (fine positioning)
|
||||
if((type & r) > 0) {
|
||||
if(CT.isR(type)) {
|
||||
du += lenU;
|
||||
}
|
||||
if((type & b) > 0) {
|
||||
if(CT.isB(type)) {
|
||||
dv += lenV;
|
||||
}
|
||||
|
||||
|
||||
@ -98,7 +98,7 @@ public class TileEntityStorageDrum extends TileEntityMachineBase implements IFlu
|
||||
slots[i] = new ItemStack(ModItems.nuclear_waste_short_depleted_tiny, 1, meta);
|
||||
}
|
||||
|
||||
if(item == ModItems.nugget_au198 && worldObj.rand.nextInt(VersatileConfig.getShortDecayChance() / 100) == 0) {
|
||||
if(item == ModItems.ingot_au198 && worldObj.rand.nextInt(VersatileConfig.getShortDecayChance() / 100) == 0) {
|
||||
slots[i] = new ItemStack(ModItems.nugget_mercury, 1, meta);
|
||||
}
|
||||
}
|
||||
@ -181,7 +181,7 @@ public class TileEntityStorageDrum extends TileEntityMachineBase implements IFlu
|
||||
item == ModItems.nuclear_waste_long_tiny ||
|
||||
item == ModItems.nuclear_waste_short ||
|
||||
item == ModItems.nuclear_waste_short_tiny ||
|
||||
item == ModItems.nugget_au198)
|
||||
item == ModItems.ingot_au198)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.hbm.world.feature;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
@ -17,7 +19,7 @@ public class SchistStratum {
|
||||
public void onDecorate(DecorateBiomeEvent.Pre event) {
|
||||
|
||||
if(this.noise == null) {
|
||||
this.noise = new NoiseGeneratorPerlin(event.rand, 4);
|
||||
this.noise = new NoiseGeneratorPerlin(new Random(event.world.getSeed()), 4);
|
||||
}
|
||||
|
||||
World world = event.world;
|
||||
@ -32,7 +34,6 @@ public class SchistStratum {
|
||||
int threshold = 5;
|
||||
|
||||
for(int x = cX; x < cX + 16; x++) {
|
||||
|
||||
for(int z = cZ; z < cZ + 16; z++) {
|
||||
|
||||
double n = noise.func_151601_a(x * scale, z * scale);
|
||||
|
||||
|
Before Width: | Height: | Size: 140 B After Width: | Height: | Size: 544 B |
|
After Width: | Height: | Size: 880 B |
|
Before Width: | Height: | Size: 179 B After Width: | Height: | Size: 597 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 545 B |
|
After Width: | Height: | Size: 884 B |
|
Before Width: | Height: | Size: 258 B After Width: | Height: | Size: 650 B |
|
After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 137 B After Width: | Height: | Size: 502 B |
|
After Width: | Height: | Size: 838 B |
|
Before Width: | Height: | Size: 135 B After Width: | Height: | Size: 581 B |
|
After Width: | Height: | Size: 941 B |
|
Before Width: | Height: | Size: 142 B After Width: | Height: | Size: 589 B |
|
After Width: | Height: | Size: 985 B |
|
Before Width: | Height: | Size: 130 B After Width: | Height: | Size: 501 B |
|
After Width: | Height: | Size: 808 B |
|
Before Width: | Height: | Size: 133 B After Width: | Height: | Size: 561 B |
|
After Width: | Height: | Size: 923 B |
|
Before Width: | Height: | Size: 122 B After Width: | Height: | Size: 122 B |
|
Before Width: | Height: | Size: 161 B After Width: | Height: | Size: 202 B |
@ -8,7 +8,7 @@
|
||||
"url": "",
|
||||
"updateUrl": "",
|
||||
"authorList": ["HbMinecraft"],
|
||||
"credits": "rodolphito (explosion algorithms), grangerave (explosion algorithms), Hoboy (textures, models), Doctor17 (russian localization), Drillgon200 (effects, models, porting), UFFR (fork with all sorts of features), Bismarck (chinese localization), FirzzleFrazzle (models), Minecreep (models), VT-6/24 (models, textures), PheodoreKaczynski (textures), Pashtet (russian localization), Sten89 (models), impbk2002 (project settings), OvermindDL1 (project settings)",
|
||||
"credits": "rodolphito (explosion algorithms), grangerave (explosion algorithms), Hoboy (textures, models), Doctor17 (russian localization), Drillgon200 (effects, models, porting), UFFR (fork with all sorts of features), Bismarck (chinese localization), FirzzleFrazzle (models), Minecreep (models), VT-6/24 (models, textures), PheodoreKaczynski (textures), Vær (fibrosis code), Pashtet (russian localization), Sten89 (models), impbk2002 (project settings), OvermindDL1 (project settings)",
|
||||
"logoFile": "",
|
||||
"screenshots": [],
|
||||
"dependencies": []
|
||||
|
||||