mirror of
https://github.com/chylex/Hardcore-Ender-Expansion.git
synced 2025-04-14 05:15:42 +02:00
Address some warnings (generics, unused fields) and remove old island OreGenerator
This commit is contained in:
parent
1cf3c5ca94
commit
664e3bfcaa
src/main/java/chylex/hee
gui
mechanics/energy
system/collections
tileentity
world/structure/island/gen
@ -7,19 +7,17 @@ import chylex.hee.tileentity.TileEntityLootChest;
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
public class InventoryLootChest extends InventoryBasic{
|
||||
private final String playerID;
|
||||
private final TileEntityLootChest chest;
|
||||
|
||||
public InventoryLootChest(String playerID, TileEntityLootChest chest){
|
||||
public InventoryLootChest(TileEntityLootChest chest){
|
||||
super("container.lootChest",false,27);
|
||||
this.playerID = playerID;
|
||||
this.chest = chest;
|
||||
|
||||
Optional.ofNullable(chest.getInventoryNameIfPresent()).ifPresent(name -> func_110133_a(name)); // OBFUSCATED setInventoryName
|
||||
}
|
||||
|
||||
public InventoryLootChest(String playerID, TileEntityLootChest chest, InventoryLootChest sourceInventory){
|
||||
this(playerID,chest);
|
||||
public InventoryLootChest(TileEntityLootChest chest, InventoryLootChest sourceInventory){
|
||||
this(chest);
|
||||
|
||||
for(int slot = 0; slot < sourceInventory.getSizeInventory(); slot++){
|
||||
ItemStack is = sourceInventory.getStackInSlot(slot);
|
||||
@ -27,10 +25,6 @@ public class InventoryLootChest extends InventoryBasic{
|
||||
}
|
||||
}
|
||||
|
||||
public InventoryLootChest(TileEntityLootChest chest){
|
||||
this(null,chest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player){
|
||||
return chest != null && !chest.canPlayerUse(player) ? false : super.isUseableByPlayer(player);
|
||||
|
@ -1,7 +1,6 @@
|
||||
package chylex.hee.mechanics.energy;
|
||||
import gnu.trove.map.hash.TObjectFloatHashMap;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import chylex.hee.system.util.ItemDamagePair;
|
||||
@ -12,7 +11,6 @@ public final class EnergyValues{
|
||||
public static final float min = 0.00001F;
|
||||
|
||||
private static final TObjectFloatHashMap<ItemDamagePair> items = new TObjectFloatHashMap<>();
|
||||
private static final TObjectFloatHashMap<Class<? extends EntityLivingBase>> mobs = new TObjectFloatHashMap<>();
|
||||
|
||||
static{
|
||||
/* TODO setItemEnergy(Blocks.end_stone, 0.40F);
|
||||
|
@ -1,6 +1,6 @@
|
||||
package chylex.hee.system.collections;
|
||||
import java.util.*;
|
||||
import java.util.AbstractMap.SimpleEntry;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public final class CollectionUtil{
|
||||
@ -14,7 +14,7 @@ public final class CollectionUtil{
|
||||
}
|
||||
);
|
||||
|
||||
for(Entry<K,V> entry:map.entrySet())sorted.add(new SimpleEntry(entry));
|
||||
for(Entry<K,V> entry:map.entrySet())sorted.add(new SimpleEntry<>(entry));
|
||||
return sorted;
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ public final class CollectionUtil{
|
||||
}
|
||||
);
|
||||
|
||||
for(Entry<K,V> entry:map.entrySet())sorted.add(new SimpleEntry(entry));
|
||||
for(Entry<K,V> entry:map.entrySet())sorted.add(new SimpleEntry<>(entry));
|
||||
return sorted;
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ public final class CollectionUtil{
|
||||
}
|
||||
|
||||
public static <T> RandomList<T> shuffled(List<T> list, Random rand){
|
||||
return new RandomList(list,rand);
|
||||
return new RandomList<>(list,rand);
|
||||
}
|
||||
|
||||
public static <T> Optional<T> random(List<T> list, Random rand){
|
||||
|
@ -69,7 +69,7 @@ public class TileEntityLootChest extends TileEntity{
|
||||
}
|
||||
|
||||
public InventoryLootChest getInventoryFor(EntityPlayer player){
|
||||
return player.capabilities.isCreativeMode ? sourceInventory : inventories.computeIfAbsent(PlayerDataHandler.getID(player),id -> new InventoryLootChest(id,this,sourceInventory));
|
||||
return player.capabilities.isCreativeMode ? sourceInventory : inventories.computeIfAbsent(PlayerDataHandler.getID(player),id -> new InventoryLootChest(this,sourceInventory));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -105,7 +105,7 @@ public class TileEntityLootChest extends TileEntity{
|
||||
NBTTagCompound playerTag = nbt.getCompoundTag("playerInv");
|
||||
|
||||
for(String id:(Set<String>)playerTag.func_150296_c()){
|
||||
InventoryLootChest inv = new InventoryLootChest(id,this);
|
||||
InventoryLootChest inv = new InventoryLootChest(this);
|
||||
|
||||
NBTUtil.readInventory(playerTag.getTagList(id,NBT.TAG_COMPOUND),inv);
|
||||
inventories.put(id,inv);
|
||||
|
@ -1,94 +0,0 @@
|
||||
package chylex.hee.world.structure.island.gen;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import chylex.hee.system.util.BlockPosM;
|
||||
|
||||
public class OreGenerator{
|
||||
private static final byte attemptMp = 3;
|
||||
|
||||
private final int minX,minY,minZ,maxX,maxY,maxZ;
|
||||
|
||||
private final List<OreLocationList> oreListStardust = new ArrayList<>();
|
||||
private final List<OreLocationList> oreListInstabilityOrb = new ArrayList<>();
|
||||
|
||||
public OreGenerator(int minX, int minY, int minZ, int maxX, int maxY, int maxZ){
|
||||
this.minX = minX;
|
||||
this.minY = minY;
|
||||
this.minZ = minZ;
|
||||
this.maxX = maxX;
|
||||
this.maxY = maxY;
|
||||
this.maxZ = maxZ;
|
||||
}
|
||||
|
||||
/*public void setup(Random rand, IslandBiomeBase biome){
|
||||
int amount = (int)(495F*biome.getOreAmountMultiplier());
|
||||
for(int a = 0; a < amount; a++){
|
||||
generateOreCluster(oreListStardust,rand,3+rand.nextInt(7));
|
||||
}
|
||||
|
||||
amount = (int)(260F*biome.getOreAmountMultiplier());
|
||||
for(int a = 0; a < amount; a++){
|
||||
generateOreCluster(oreListInstabilityOrb,rand,1+rand.nextInt(3));
|
||||
}
|
||||
}
|
||||
|
||||
public void generate(LargeStructureWorld world, Random rand){
|
||||
int attempt = 0, placed = 0, attemptAm;
|
||||
BlockPosM loc;
|
||||
|
||||
for(OreLocationList list:oreListStardust){
|
||||
attemptAm = list.placeAmount*attemptMp;
|
||||
|
||||
for(attempt = 0, placed = 0; attempt < attemptAm && placed < list.placeAmount; ++attempt){
|
||||
loc = list.blockList.get(attempt);
|
||||
|
||||
if (loc.y >= 0 && world.getBlock(loc.x,loc.y,loc.z) == Blocks.end_stone){
|
||||
world.setBlock(loc.x,loc.y,loc.z,BlockList.stardust_ore,rand.nextInt(15)+1);
|
||||
++placed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(OreLocationList list:oreListInstabilityOrb){
|
||||
attemptAm = list.placeAmount*attemptMp;
|
||||
|
||||
for(attempt = 0, placed = 0; attempt < attemptAm && placed < list.placeAmount; ++attempt){
|
||||
loc = list.blockList.get(attempt);
|
||||
|
||||
if (loc.y >= 0 && world.getBlock(loc.x,loc.y,loc.z) == Blocks.end_stone){
|
||||
world.setBlock(loc.x,loc.y,loc.z,BlockList.instability_orb_ore);
|
||||
++placed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void generateOreCluster(List<OreLocationList> locList, Random rand, int amount){
|
||||
int xx = rand.nextInt(maxX-minX+1)+minX, yy = rand.nextInt(maxY-minY+1)+minY, zz = rand.nextInt(maxZ-minZ+1)+minZ;
|
||||
double sqrtAmount = Math.sqrt(amount*1.75D);
|
||||
|
||||
OreLocationList list = new OreLocationList(amount);
|
||||
|
||||
if (yy < minY+14)yy = rand.nextInt(maxY-minY+1)+minY; // try again!
|
||||
|
||||
for(int a = 0, n = amount*attemptMp; a < n; ++a){
|
||||
list.blockList.add(new BlockPosM(
|
||||
xx+MathHelper.cos((float)(rand.nextDouble()*2D*Math.PI))*sqrtAmount*rand.nextDouble(),
|
||||
yy+MathHelper.cos((float)(rand.nextDouble()*2D*Math.PI))*sqrtAmount*rand.nextDouble(),
|
||||
zz+MathHelper.cos((float)(rand.nextDouble()*2D*Math.PI))*sqrtAmount*rand.nextDouble()
|
||||
));
|
||||
}
|
||||
|
||||
locList.add(list);
|
||||
}*/
|
||||
|
||||
private class OreLocationList{
|
||||
private final List<BlockPosM> blockList;
|
||||
private final byte placeAmount;
|
||||
|
||||
public OreLocationList(int amount){
|
||||
this.blockList = new ArrayList<>(amount*attemptMp);
|
||||
this.placeAmount = (byte)amount;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user