crates save contents, more connected pain, fixed mercury dupe with drums

This commit is contained in:
Boblet 2021-10-07 15:21:56 +02:00
parent 114e5e1c9a
commit a297bf0f4c
28 changed files with 141 additions and 121 deletions

View File

@ -1,5 +1,7 @@
package com.hbm.blocks.generic; package com.hbm.blocks.generic;
import java.util.ArrayList;
import java.util.List;
import java.util.Random; import java.util.Random;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
@ -24,6 +26,7 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory; import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -87,50 +90,31 @@ public class BlockStorageCrate extends BlockContainer {
} }
@Override @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_) { public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
ISidedInventory tileentityfurnace = (ISidedInventory) p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); ArrayList<ItemStack> drops = new ArrayList();
if(((TileEntityLockableBase) p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_)).isLocked()) { ItemStack drop = new ItemStack(this);
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); ISidedInventory inv = (ISidedInventory)world.getTileEntity(x, y, z);
return;
}
if(tileentityfurnace != null) { if(inv != null) {
for(int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) {
ItemStack itemstack = tileentityfurnace.getStackInSlot(i1);
if(itemstack != null) { drop.stackTagCompound = new NBTTagCompound();
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) { for(int i = 0; i < inv.getSizeInventory(); i++) {
int j1 = this.field_149933_a.nextInt(21) + 10;
if(j1 > itemstack.stackSize) { ItemStack stack = inv.getStackInSlot(i);
j1 = itemstack.stackSize; if(stack == null)
} continue;
itemstack.stackSize -= j1; NBTTagCompound slot = new NBTTagCompound();
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())); stack.writeToNBT(slot);
drop.stackTagCompound.setTag("slot" + i, slot);
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);
}
}
} }
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 @Override
@ -161,10 +145,19 @@ public class BlockStorageCrate extends BlockContainer {
} }
@Override @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) 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; 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); world.setBlockMetadataWithNotify(x, y, z, 4, 2);
} }
} }
} }

View File

@ -5,15 +5,25 @@ import java.util.List;
public class CT { 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 l = 0; //left
public static final int r = 1; //right public static final int r = 1; //right
public static final int t = 0; //top public static final int t = 0; //top
public static final int b = 2; //bottom public static final int b = 2; //bottom
public static final int f = 4; //full/unconnected public static final int f = 0; //full/unconnected
public static final int c = 8; //connected public static final int c = 4; //connected
public static final int j = 16; //junction public static final int j = 8; //junction
public static final int h = 32; //horizontal public static final int h = 12; //horizontal
public static final int v = 64; //vertical public static final int v = 16; //vertical
public static final int ftl = f | t | l; public static final int ftl = f | t | l;
public static final int ftr = f | t | r; 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 vbl = v | b | l;
public static final int vbr = v | b | r; public static final int vbr = v | b | r;
/*private static int[] coords = new int[20]; public static boolean isL(int i) {
private static int[] indices = new int[68]; return (i & l) != 0;
}
static { public static boolean isR(int i) {
return (i & r) != 0;
int[] dimX = new int[] {CT.t, CT.b}; }
int[] dimY = new int[] {CT.l, CT.r}; public static boolean isT(int i) {
int[] dimZ = new int[] {CT.f, CT.c, CT.j, CT.h, CT.v}; return (i & t) != 0;
}
int index = 0; public static boolean isB(int i) {
return (i & b) != 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) { public static boolean isF(int i) {
return indices[coord]; 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. \ * / I am in great pain. \

View File

@ -4,6 +4,7 @@ import net.minecraft.block.Block;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import static com.hbm.render.block.ct.CT.*; import static com.hbm.render.block.ct.CT.*;
@ -11,19 +12,53 @@ public class CTContext {
public static CTFace[] faces; public static CTFace[] faces;
//dim 1: faces (forgeDir) //dim 1: 6x faces (forgeDir)
//dim 2: neighbors (TL, TC, TR, CL, CR, BL, BC, BR) //dim 2: 8x neighbors (TL, TC, TR, CL, CR, BL, BC, BR)
//dim 3: coord (x/y/z, [-1;1]) //dim 3: 3x coord (x/y/z, [-1;1])
public static int[][][] access = new int[][][] { 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} }, lcfs(ForgeDirection.NORTH, ForgeDirection.EAST), //DOWN guess
{ {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0} }, lcfs(ForgeDirection.SOUTH, ForgeDirection.EAST), //UP guess
{ {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0} }, lcfs(ForgeDirection.UP, ForgeDirection.EAST), //NORTH
{ {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0} }, lcfs(ForgeDirection.UP, ForgeDirection.WEST), //SOUTH
{ {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0} }, lcfs(ForgeDirection.UP, ForgeDirection.NORTH), //WEST
{ {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0} } lcfs(ForgeDirection.UP, ForgeDirection.EAST) //EAST
//TODO
}; };
//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 * Generates the six CTFaces and fills the faces array, the faces contain the information on what icon types should be used
* @param world * @param world
@ -68,12 +103,18 @@ public class CTContext {
/** /**
* Returns the overarching texture type based on whether the horizontal, vertical and corner are connected * Returns the overarching texture type based on whether the horizontal, vertical and corner are connected
* @param vert
* @param hor * @param hor
* @param corner * @param corner
* @param vert
* @return the bitmask for the full texture type that should be used (f/c/j/h/v) * @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) if(vert && hor && corner)
return c; return c;

View File

@ -23,7 +23,7 @@ public class CTStitchReceiver {
public void postStitch() { public void postStitch() {
for(int i = 0; i < 20; i++) { 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);
} }
} }
} }

View File

@ -24,18 +24,18 @@ public class IconCT implements IIcon {
float dv = parent.getMinV(); float dv = parent.getMinV();
//set pos to full block (coarse positioning) //set pos to full block (coarse positioning)
if((type & v) > 0 || (type & j) > 0) { if(CT.isV(type) || CT.isJ(type)) {
du += lenU * 2; du += lenU * 2;
} }
if((type & h) > 0 || (type & j) > 0) { if(CT.isH(type) || CT.isJ(type)) {
dv += lenV * 2; dv += lenV * 2;
} }
//set pos to sub-block (fine positioning) //set pos to sub-block (fine positioning)
if((type & r) > 0) { if(CT.isR(type)) {
du += lenU; du += lenU;
} }
if((type & b) > 0) { if(CT.isB(type)) {
dv += lenV; dv += lenV;
} }

View File

@ -98,7 +98,7 @@ public class TileEntityStorageDrum extends TileEntityMachineBase implements IFlu
slots[i] = new ItemStack(ModItems.nuclear_waste_short_depleted_tiny, 1, meta); 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); 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_long_tiny ||
item == ModItems.nuclear_waste_short || item == ModItems.nuclear_waste_short ||
item == ModItems.nuclear_waste_short_tiny || item == ModItems.nuclear_waste_short_tiny ||
item == ModItems.nugget_au198) item == ModItems.ingot_au198)
return true; return true;
return false; return false;

View File

@ -1,5 +1,7 @@
package com.hbm.world.feature; package com.hbm.world.feature;
import java.util.Random;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@ -17,7 +19,7 @@ public class SchistStratum {
public void onDecorate(DecorateBiomeEvent.Pre event) { public void onDecorate(DecorateBiomeEvent.Pre event) {
if(this.noise == null) { 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; World world = event.world;
@ -32,7 +34,6 @@ public class SchistStratum {
int threshold = 5; int threshold = 5;
for(int x = cX; x < cX + 16; x++) { for(int x = cX; x < cX + 16; x++) {
for(int z = cZ; z < cZ + 16; z++) { for(int z = cZ; z < cZ + 16; z++) {
double n = noise.func_151601_a(x * scale, z * scale); double n = noise.func_151601_a(x * scale, z * scale);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 B

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 880 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 B

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 884 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 B

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 B

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 838 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 B

After

Width:  |  Height:  |  Size: 581 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 941 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 B

After

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 985 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 B

After

Width:  |  Height:  |  Size: 501 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 808 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 B

After

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 B

After

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 161 B

After

Width:  |  Height:  |  Size: 202 B

View File

@ -8,7 +8,7 @@
"url": "", "url": "",
"updateUrl": "", "updateUrl": "",
"authorList": ["HbMinecraft"], "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": "", "logoFile": "",
"screenshots": [], "screenshots": [],
"dependencies": [] "dependencies": []