mirror of
https://github.com/GTNewHorizons/Hardcore-Ender-Expansion.git
synced 2026-10-25 20:22:31 +00:00
Fixed some critical issues with savefiles and Scorching Pickaxe
This commit is contained in:
1 parent
be8da6352b
commit
82e1f49d96
3 files changed
+21
-11
No files matched your search
+1
-1
@@ -25,7 +25,7 @@ sourceCompatibility = 1.7
|
||||
targetCompatibility = 1.7
|
||||
|
||||
minecraft {
|
||||
version = "1.7.10-10.13.0.1194"
|
||||
version = "1.7.10-10.13.0.1199"
|
||||
assetDir = "eclipse/assets"
|
||||
}
|
||||
|
||||
|
||||
@@ -113,6 +113,7 @@ public class ItemScorchingPickaxe extends Item{
|
||||
}
|
||||
|
||||
e.drops.clear();
|
||||
Random rand = e.world.rand;
|
||||
|
||||
if (drop.getItem() instanceof ItemBlock){
|
||||
ItemStack result = null;
|
||||
@@ -124,9 +125,8 @@ public class ItemScorchingPickaxe extends Item{
|
||||
result = smelted.copy();
|
||||
|
||||
int fortune = 0;
|
||||
for(int a = 0; a < 5; a++)fortune += 1+e.world.rand.nextInt(3+e.world.rand.nextInt(3));
|
||||
fortune = 1+(int)Math.floor(fortune*((3D*e.world.rand.nextDouble()+e.world.rand.nextDouble()+0.2D)*Math.pow(FurnaceRecipes.smelting().func_151398_b(drop),1.8D)+(fortune*0.06D))/5.5D); // OBFUSCATED getExperience
|
||||
|
||||
for(int a = 0; a < 5; a++)fortune += 1+rand.nextInt(3+rand.nextInt(3));
|
||||
fortune = 1+(int)Math.floor(fortune*(0.35D*rand.nextDouble()*rand.nextDouble()*Math.pow(FurnaceRecipes.smelting().func_151398_b(result),2.6D)+(fortune*0.06D))/6.4D); // OBFUSCATED getExperience
|
||||
result.stackSize = fortune;
|
||||
}
|
||||
|
||||
@@ -134,9 +134,9 @@ public class ItemScorchingPickaxe extends Item{
|
||||
}
|
||||
else{
|
||||
int fortune = 0;
|
||||
for(int a = 0; a < 4; a++)fortune += e.block.quantityDropped(e.blockMetadata,3+e.world.rand.nextInt(3)-e.world.rand.nextInt(2),e.world.rand);
|
||||
for(int a = 0; a < 4; a++)fortune += e.block.quantityDropped(e.blockMetadata,0,e.world.rand);
|
||||
fortune = 1+(int)Math.floor((fortune+e.block.getExpDrop(e.world,e.blockMetadata,0)/2D)*(e.world.rand.nextDouble()+(e.world.rand.nextDouble()*0.5D)+0.35D)/6D);
|
||||
for(int a = 0; a < 4; a++)fortune += e.block.quantityDropped(e.blockMetadata,3+rand.nextInt(3)-rand.nextInt(2),rand);
|
||||
for(int a = 0; a < 4; a++)fortune += e.block.quantityDropped(e.blockMetadata,0,rand);
|
||||
fortune = 1+(int)Math.floor((fortune+e.block.getExpDrop(e.world,e.blockMetadata,0)/2D)*(rand.nextDouble()+(rand.nextDouble()*0.5D)+0.35D)/6D);
|
||||
|
||||
drop.stackSize = fortune;
|
||||
e.drops.add(drop);
|
||||
|
||||
@@ -5,13 +5,13 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Map;
|
||||
import chylex.hee.system.logging.Log;
|
||||
import chylex.hee.system.logging.Stopwatch;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import chylex.hee.system.logging.Log;
|
||||
import chylex.hee.system.logging.Stopwatch;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public final class WorldDataHandler{
|
||||
@@ -29,8 +29,18 @@ public final class WorldDataHandler{
|
||||
if (savefile == null){
|
||||
try{
|
||||
instance.cache.put(cls,savefile = cls.newInstance());
|
||||
savefile.loadFromNBT(CompressedStreamTools.readCompressed(new FileInputStream(new File(instance.worldSaveDir,savefile.filename))));
|
||||
}catch(InstantiationException | IllegalAccessException | IOException e){
|
||||
|
||||
File file = new File(instance.worldSaveDir,savefile.filename);
|
||||
|
||||
if (file.exists()){
|
||||
try{
|
||||
savefile.loadFromNBT(CompressedStreamTools.readCompressed(new FileInputStream(file)));
|
||||
}catch(IOException ioe){
|
||||
Log.throwable(ioe,"Could not load NBT file - $0",cls.getName());
|
||||
}
|
||||
}
|
||||
else savefile.loadFromNBT(new NBTTagCompound());
|
||||
}catch(InstantiationException | IllegalAccessException e){
|
||||
throw new RuntimeException("Could not construct a new instance of WorldSavefile - "+cls.getName(),e);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user