mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
well that was a massive waste of time
This commit is contained in:
parent
34fbf2ecbe
commit
2eb341ee33
@ -9,4 +9,8 @@
|
|||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
* The mandatory washing step for bedrock ore byproducts now needs 4 items for sulfuric, 12 for dissolved and 24 for cleaned byproducts (isntead of just one)
|
* The mandatory washing step for bedrock ore byproducts now needs 4 items for sulfuric, 12 for dissolved and 24 for cleaned byproducts (isntead of just one)
|
||||||
* This should offset the exponentially increasing amount of byproduct created from processing bedrock ore which ends up being far greater than the primary product
|
* This should offset the exponentially increasing amount of byproduct created from processing bedrock ore which ends up being far greater than the primary product
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
* Added a write lock o cellular dungeons while generating, fixing a crash caused by dungeons that generate next to each other due to cascading worldgen
|
||||||
|
* Added recipe caching to the arc furnace, fixing an issue where recipe detection and item IO are horribly inefficient
|
||||||
@ -1913,7 +1913,7 @@ public class ModBlocks {
|
|||||||
crane_boxer = new CraneBoxer().setBlockName("crane_boxer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
crane_boxer = new CraneBoxer().setBlockName("crane_boxer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||||
crane_unboxer = new CraneUnboxer().setBlockName("crane_unboxer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
crane_unboxer = new CraneUnboxer().setBlockName("crane_unboxer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||||
crane_splitter = new CraneSplitter().setBlockName("crane_splitter").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":crane_side");
|
crane_splitter = new CraneSplitter().setBlockName("crane_splitter").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":crane_side");
|
||||||
crane_partitioner = new CranePartitioner().setBlockName("crane_partitioner").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":crane_side");
|
crane_partitioner = new CranePartitioner().setBlockName("crane_partitioner").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":crane_partitioner_side");
|
||||||
fan = new MachineFan().setBlockName("fan").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
fan = new MachineFan().setBlockName("fan").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||||
piston_inserter = new PistonInserter().setBlockName("piston_inserter").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
piston_inserter = new PistonInserter().setBlockName("piston_inserter").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,6 @@ public class EntityCreeperNuclear extends EntityCreeper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) {
|
protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) {
|
||||||
|
|
||||||
super.dropFewItems(p_70628_1_, p_70628_2_);
|
super.dropFewItems(p_70628_1_, p_70628_2_);
|
||||||
|
|
||||||
if(rand.nextInt(3) == 0)
|
if(rand.nextInt(3) == 0)
|
||||||
|
|||||||
@ -354,7 +354,7 @@ public class GUIAnvil extends GuiContainer {
|
|||||||
for(AStack stack : recipe.input) {
|
for(AStack stack : recipe.input) {
|
||||||
if(stack instanceof ComparableStack) {
|
if(stack instanceof ComparableStack) {
|
||||||
ItemStack input = ((ComparableStack) stack).toStack();
|
ItemStack input = ((ComparableStack) stack).toStack();
|
||||||
list.add(input.getDisplayName().toLowerCase(Locale.US));
|
try { list.add(input.getDisplayName().toLowerCase(Locale.US)); } catch(Exception ex) { list.add("I AM ERROR"); }
|
||||||
|
|
||||||
} else if(stack instanceof OreDictStack) {
|
} else if(stack instanceof OreDictStack) {
|
||||||
OreDictStack input = (OreDictStack) stack;
|
OreDictStack input = (OreDictStack) stack;
|
||||||
@ -362,9 +362,8 @@ public class GUIAnvil extends GuiContainer {
|
|||||||
|
|
||||||
if(ores.size() > 0) {
|
if(ores.size() > 0) {
|
||||||
for(ItemStack ore : ores) {
|
for(ItemStack ore : ores) {
|
||||||
list.add(ore.getDisplayName().toLowerCase(Locale.US));
|
try { list.add(ore.getDisplayName().toLowerCase(Locale.US)); } catch(Exception ex) { list.add("I AM ERROR"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,8 +35,10 @@ import net.minecraft.item.crafting.FurnaceRecipes;
|
|||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
public class ArcFurnaceRecipes extends SerializableRecipe {
|
public class ArcFurnaceRecipes extends SerializableRecipe {
|
||||||
|
|
||||||
public static HashMap<AStack, ArcFurnaceRecipe> recipes = new HashMap();
|
public static HashMap<AStack, ArcFurnaceRecipe> recipes = new HashMap();
|
||||||
|
public static HashMap<ComparableStack, ArcFurnaceRecipe> fastCacheSolid = new HashMap();
|
||||||
|
public static HashMap<ComparableStack, ArcFurnaceRecipe> fastCacheLiquid = new HashMap();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerDefaults() {
|
public void registerDefaults() {
|
||||||
@ -149,15 +151,24 @@ public class ArcFurnaceRecipes extends SerializableRecipe {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ComparableStack cacheKey = new ComparableStack(stack).makeSingular();
|
||||||
|
if(!liquid && fastCacheSolid.containsKey(cacheKey)) return fastCacheSolid.get(cacheKey);
|
||||||
|
if(liquid && fastCacheLiquid.containsKey(cacheKey)) return fastCacheLiquid.get(cacheKey);
|
||||||
|
|
||||||
for(Entry<AStack, ArcFurnaceRecipe> entry : recipes.entrySet()) {
|
for(Entry<AStack, ArcFurnaceRecipe> entry : recipes.entrySet()) {
|
||||||
if(entry.getKey().matchesRecipe(stack, true)) {
|
if(entry.getKey().matchesRecipe(stack, true)) {
|
||||||
ArcFurnaceRecipe rec = entry.getValue();
|
ArcFurnaceRecipe rec = entry.getValue();
|
||||||
if((liquid && rec.fluidOutput != null) || (!liquid && rec.solidOutput != null)) {
|
if((liquid && rec.fluidOutput != null) || (!liquid && rec.solidOutput != null)) {
|
||||||
|
if(!liquid) fastCacheSolid.put(cacheKey, rec);
|
||||||
|
if(liquid) fastCacheLiquid.put(cacheKey, rec);
|
||||||
return rec;
|
return rec;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!liquid) fastCacheSolid.put(cacheKey, null);
|
||||||
|
if(liquid) fastCacheLiquid.put(cacheKey, null);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,6 +210,8 @@ public class ArcFurnaceRecipes extends SerializableRecipe {
|
|||||||
@Override
|
@Override
|
||||||
public void deleteRecipes() {
|
public void deleteRecipes() {
|
||||||
recipes.clear();
|
recipes.clear();
|
||||||
|
fastCacheSolid.clear();
|
||||||
|
fastCacheLiquid.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -87,6 +87,7 @@ import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
|||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.common.config.Configuration;
|
import net.minecraftforge.common.config.Configuration;
|
||||||
import net.minecraftforge.common.util.EnumHelper;
|
import net.minecraftforge.common.util.EnumHelper;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
@ -353,6 +354,7 @@ public class MainRegistry {
|
|||||||
ChestGenHooks.addItem(ChestGenHooks.BONUS_CHEST, new WeightedRandomChestContent(new ItemStack(ModItems.no9), 1, 1, 7));
|
ChestGenHooks.addItem(ChestGenHooks.BONUS_CHEST, new WeightedRandomChestContent(new ItemStack(ModItems.no9), 1, 1, 7));
|
||||||
|
|
||||||
EntityMappings.writeMappings();
|
EntityMappings.writeMappings();
|
||||||
|
//CompatNER.init();
|
||||||
|
|
||||||
ForgeChunkManager.setForcedChunkLoadingCallback(this, new LoadingCallback() {
|
ForgeChunkManager.setForcedChunkLoadingCallback(this, new LoadingCallback() {
|
||||||
|
|
||||||
|
|||||||
@ -18,6 +18,8 @@ public class TileEntityProxyBase extends TileEntityLoadedBase {
|
|||||||
|
|
||||||
public TileEntity getTE() {
|
public TileEntity getTE() {
|
||||||
|
|
||||||
|
if(worldObj == null) return null;
|
||||||
|
|
||||||
if(cachedPosition != null) {
|
if(cachedPosition != null) {
|
||||||
TileEntity te = Compat.getTileStandard(worldObj, cachedPosition.getX(), cachedPosition.getY(), cachedPosition.getZ());
|
TileEntity te = Compat.getTileStandard(worldObj, cachedPosition.getX(), cachedPosition.getY(), cachedPosition.getZ());
|
||||||
if(te != null && !(te instanceof TileEntityProxyBase)) return te;
|
if(te != null && !(te instanceof TileEntityProxyBase)) return te;
|
||||||
|
|||||||
169
src/main/java/com/hbm/util/CompatNER.java
Normal file
169
src/main/java/com/hbm/util/CompatNER.java
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
package com.hbm.util;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.hbm.blocks.ModBlocks;
|
||||||
|
import com.hbm.entity.mob.EntityCreeperNuclear;
|
||||||
|
import com.hbm.items.ModItems;
|
||||||
|
import com.hbm.main.MainRegistry;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import net.minecraft.nbt.NBTTagString;
|
||||||
|
|
||||||
|
public class CompatNER {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static void init() {
|
||||||
|
sendRegisterOre(new ItemStack(ModBlocks.ore_alexandrite), false, 0xff00ff, new ItemStack(ModItems.gem_alexandrite));
|
||||||
|
sendRegisterMob(EntityCreeperNuclear.class, "-1", encodeDrops(
|
||||||
|
new DropItem(new ItemStack(Blocks.tnt), 0, 2),
|
||||||
|
new DropItem(new ItemStack(ModItems.coin_creeper), 1, 1, 0.33F)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* REGISTERS
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static void sendRegisterOre(ItemStack ore, boolean silk, int color, ItemStack... drops) {
|
||||||
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
|
data.setTag(stack, ore.writeToNBT(new NBTTagCompound()));
|
||||||
|
data.setBoolean(silkTouch, silk);
|
||||||
|
data.setInteger(colour, color);
|
||||||
|
data.setTag(addDrops, encodeStacks(drops));
|
||||||
|
int[] distribution = new int[256];
|
||||||
|
for(int i = 0; i < 256; i++) distribution[i] = 100;
|
||||||
|
data.setIntArray("distribution", distribution);
|
||||||
|
|
||||||
|
NBTTagCompound res = new NBTTagCompound();
|
||||||
|
NBTTagCompound block = new NBTTagCompound();
|
||||||
|
block.setTag("stack", new ItemStack(Blocks.stone).writeToNBT(new NBTTagCompound()));
|
||||||
|
res.setTag("block", block);
|
||||||
|
data.setTag(restriction, res);
|
||||||
|
|
||||||
|
FMLInterModComms.sendMessage(notEnoughResources, registerOre, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void sendRegisterMob(Class clazz, String light, NBTTagList drops) {
|
||||||
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
|
data.setString(name, clazz.getName());
|
||||||
|
data.setString(lightLevel, light);
|
||||||
|
data.setTag(addDrops, drops);
|
||||||
|
MainRegistry.logger.info("Sending " + registerMob + " to " + notEnoughResources);
|
||||||
|
FMLInterModComms.sendMessage(notEnoughResources, registerMob, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ENCODERS
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static String encodeLightLevel(int level, boolean below) {
|
||||||
|
return level + ":" + (below ? "b" : "a");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static NBTTagList encodeDrops(DropItem... stacks) {
|
||||||
|
NBTTagList list = new NBTTagList();
|
||||||
|
for(DropItem stack : stacks) list.appendTag(stack.writeToNBT());
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static NBTTagList encodeStacks(ItemStack... stacks) {
|
||||||
|
NBTTagList list = new NBTTagList();
|
||||||
|
for(ItemStack stack : stacks) list.appendTag(stack.writeToNBT(new NBTTagCompound()));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DROP SYSTEM
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static class DropItem {
|
||||||
|
public ItemStack drop;
|
||||||
|
public int min = 1;
|
||||||
|
public int max = 1;
|
||||||
|
public float chance = 1F;
|
||||||
|
List<String> conditionals = new ArrayList();
|
||||||
|
|
||||||
|
public DropItem(ItemStack stack) { this(stack, 1, 1, 1F); }
|
||||||
|
public DropItem(ItemStack stack, int min, int max) { this(stack, min, max, 1F); }
|
||||||
|
public DropItem(ItemStack stack, int min, int max, float chance) {
|
||||||
|
this.drop = stack;
|
||||||
|
this.min = min;
|
||||||
|
this.max = max;
|
||||||
|
this.chance = chance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NBTTagCompound writeToNBT() {
|
||||||
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
|
compound.setTag("stack", this.drop.writeToNBT(new NBTTagCompound()));
|
||||||
|
compound.setInteger("min", this.min);
|
||||||
|
compound.setInteger("max", this.max);
|
||||||
|
compound.setFloat("chance", this.chance);
|
||||||
|
NBTTagList conditionals = new NBTTagList();
|
||||||
|
for(String condition : this.conditionals) conditionals.appendTag(new NBTTagString(condition));
|
||||||
|
compound.setTag("conditionals", conditionals);
|
||||||
|
return compound;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CONSTANTS
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static final String notEnoughResources = "neresources";
|
||||||
|
public static final String registerDungeon = "registerDungeon";
|
||||||
|
public static final String registerMob = "registerMob";
|
||||||
|
public static final String registerOre = "registerOre";
|
||||||
|
public static final String registerPlant = "registerPlant";
|
||||||
|
public static final String addToRegistry = "add";
|
||||||
|
public static final String modifyMob = "modifyMob";
|
||||||
|
public static final String modifyOre = "modifyOre";
|
||||||
|
public static final String modifyPlant = "modifyPlant";
|
||||||
|
public static final String removeMob = "removeMob";
|
||||||
|
public static final String removeOre = "removeOre";
|
||||||
|
public static final String removePlant = "removePlant";
|
||||||
|
public static final String distribution = "distribution";
|
||||||
|
public static final String bestHeight = "bestHeight";
|
||||||
|
public static final String stack = "stack";
|
||||||
|
public static final String name = "name";
|
||||||
|
public static final String lightLevel = "lightLevel";
|
||||||
|
public static final String conditionals = "conditionals";
|
||||||
|
public static final String colour = "colour";
|
||||||
|
public static final String itemList = "itemList";
|
||||||
|
public static final String chance = "chance";
|
||||||
|
public static final String min = "min";
|
||||||
|
public static final String max = "max";
|
||||||
|
public static final String priority = "priority";
|
||||||
|
public static final String addPriority = "addPriority";
|
||||||
|
public static final String removePriority = "removePriority";
|
||||||
|
public static final String addDrops = "addDrops";
|
||||||
|
public static final String removeDrops = "removeDrops";
|
||||||
|
public static final String silkTouch = "silkTouch";
|
||||||
|
public static final String wither = "wither";
|
||||||
|
public static final String strict = "strict";
|
||||||
|
public static final String biomeArray = "biomeArray";
|
||||||
|
public static final String type = "type";
|
||||||
|
public static final String restriction = "restriction";
|
||||||
|
public static final String blockRestriction = "block";
|
||||||
|
public static final String dimensionRestriction = "dimension";
|
||||||
|
public static final String biomeRestriction = "biome";
|
||||||
|
|
||||||
|
public static final String conditional_rareDrop = "ner.rareDrop.text";
|
||||||
|
public static final String conditional_silkTouch = "ner.ore.silkTouch";
|
||||||
|
public static final String conditional_equipmentDrop = "ner.equipmentDrop.text";
|
||||||
|
public static final String conditional_burning = "ner.burning.text";
|
||||||
|
public static final String conditional_notBurning = "ner.notBurning.text";
|
||||||
|
public static final String conditional_playerKill = "ner.playerKill.text";
|
||||||
|
public static final String conditional_notPlayerKill = "ner.notPlayerKill.text";
|
||||||
|
public static final String conditional_aboveLooting = "ner.aboveLooting.text";
|
||||||
|
public static final String conditional_belowLooting = "ner.belowLooting.text";
|
||||||
|
public static final String conditional_killedBy = "ner.killedBy.text";
|
||||||
|
public static final String conditional_notKilledBy = "ner.notKilledBy.text";
|
||||||
|
}
|
||||||
@ -35,6 +35,7 @@ public class CellularDungeon {
|
|||||||
public List<CellularDungeonRoom> rooms = new ArrayList();
|
public List<CellularDungeonRoom> rooms = new ArrayList();
|
||||||
int tries;
|
int tries;
|
||||||
int branches;
|
int branches;
|
||||||
|
boolean isGenerating;
|
||||||
|
|
||||||
public CellularDungeon(int width, int height, int dimX, int dimZ, int tries, int branches) {
|
public CellularDungeon(int width, int height, int dimX, int dimZ, int tries, int branches) {
|
||||||
|
|
||||||
@ -60,7 +61,11 @@ public class CellularDungeon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void generate(World world, int x, int y, int z, Random rand) {
|
public void generate(World world, int x, int y, int z, Random rand) {
|
||||||
|
|
||||||
|
if(isGenerating) return;
|
||||||
|
|
||||||
|
isGenerating = true;
|
||||||
|
|
||||||
x -= dimX * width / 2;
|
x -= dimX * width / 2;
|
||||||
z -= dimZ * width / 2;
|
z -= dimZ * width / 2;
|
||||||
|
|
||||||
@ -82,6 +87,8 @@ public class CellularDungeon {
|
|||||||
cells[dx][dz].generate(world, x + dx * (width - 1), y, z + dz * (width - 1), doors[dx][dz]);
|
cells[dx][dz].generate(world, x + dx * (width - 1), y, z + dz * (width - 1), doors[dx][dz]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isGenerating = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rec = 0;
|
int rec = 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user