diff options
author | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2019-09-19 06:07:33 +0200 |
---|---|---|
committer | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2019-09-19 06:07:33 +0200 |
commit | 4af4e216d11883788a16dd513c8a2a1b38204a4d (patch) | |
tree | 61a3d6b9c6d4ab87e2fb4e40bf3a9449172e9973 /src | |
parent | 05be80efe3d7a1a302d75f3d07e19f9133cf8584 (diff) | |
download | GT5-Unofficial-4af4e216d11883788a16dd513c8a2a1b38204a4d.tar.gz GT5-Unofficial-4af4e216d11883788a16dd513c8a2a1b38204a4d.tar.bz2 GT5-Unofficial-4af4e216d11883788a16dd513c8a2a1b38204a4d.zip |
added Ross128ba into the game
+fixed ore decolorisation
+added "TheCore" Nq cell
+rewrote NEI Ore Handler
+limited oregen to the propper planets
+added Fluorspar ore
+further improved werkstoff recipe generation
+a lot of smaller fixes and balance
Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>
Former-commit-id: aaed052c041488605313bd133e66a575451a2a9e
Diffstat (limited to 'src')
21 files changed, 273 insertions, 213 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java b/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java index 06261bea9f..51ee9867a9 100644 --- a/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java +++ b/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java @@ -175,7 +175,7 @@ public class BWCoreTransformer implements IClassTransformer { nu.add(new VarInsnNode(ALOAD, 0)); nu.add(new FieldInsnNode(GETFIELD, "net/minecraft/client/renderer/RenderGlobal", useSrc ? theWorld_src : "theWorld", "Lnet/minecraft/client/multiplayer/WorldClient;")); nu.add(new FieldInsnNode(GETFIELD, "net/minecraft/client/multiplayer/WorldClient", useSrc ? provider_src : "provider", "Lnet/minecraft/world/WorldProvider;")); - nu.add(new TypeInsnNode(INSTANCEOF, "com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/WorldProviderRoss128b")); + nu.add(new TypeInsnNode(INSTANCEOF, "com/github/bartimaeusnek/crossmod/galacticraft/planets/AbstractWorldProviderSpace")); nu.add(new JumpInsnNode(IFEQ, LabelNodes[0])); nu.add(new VarInsnNode(ALOAD, 0)); nu.add(new FieldInsnNode(GETFIELD, "net/minecraft/client/renderer/RenderGlobal", useSrc ? renderEngine_src : "renderEngine", "Lnet/minecraft/client/renderer/texture/TextureManager;")); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java index 126a1263f4..1d452f0505 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java @@ -76,9 +76,7 @@ import org.apache.logging.log4j.Logger; import java.io.IOException; import java.lang.reflect.Field; -import java.lang.reflect.Modifier; import java.util.*; -import java.util.stream.Collectors; import static com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_ElectricImplosionCompressor.eicMap; import static com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader.*; diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_OreHandler.java b/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_OreHandler.java index 4f5f1a8cd2..cbd5706d16 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_OreHandler.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_OreHandler.java @@ -30,18 +30,17 @@ import com.github.bartimaeusnek.bartworks.MainMod; import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_Ores; import com.github.bartimaeusnek.bartworks.system.material.Werkstoff; import com.github.bartimaeusnek.bartworks.system.oregen.BW_OreLayer; -import com.github.bartimaeusnek.bartworks.system.oregen.BW_WorldGenRoss128b; import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; import cpw.mods.fml.common.event.FMLInterModComms; -import gregtech.api.GregTech_API; import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import java.awt.*; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Objects; public class BW_NEI_OreHandler extends TemplateRecipeHandler { @@ -60,7 +59,7 @@ public class BW_NEI_OreHandler extends TemplateRecipeHandler { @Override public void loadTransferRects() { - this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(0,40,40,10),"quickanddirtyneihandler")); + this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(0,40,40,120),"quickanddirtyneihandler")); } @Override @@ -71,93 +70,27 @@ public class BW_NEI_OreHandler extends TemplateRecipeHandler { @Override public void loadCraftingRecipes(String outputId, Object... results) { if (outputId.equalsIgnoreCase("quickanddirtyneihandler")) { - for (int i = 0; i < Werkstoff.werkstoffHashMap.values().size(); i++) { - Werkstoff w = Werkstoff.werkstoffHashMap.get((short)i); - if (w == null || w == Werkstoff.default_null_Werkstoff) - continue; - if (w.getGenerationFeatures().hasOres()) { - ItemStack result = w.get(OrePrefixes.ore); - TemplateRecipeHandler.CachedRecipe tmp = new TemplateRecipeHandler.CachedRecipe() { - - PositionedStack stack = new PositionedStack(result, 0, 0); - - @Override - public PositionedStack getResult() { - return this.stack; - } - - @Override - public List<PositionedStack> getOtherStacks() { - ArrayList<PositionedStack> ret = new ArrayList<>(); - for (int i = 0; i < BW_OreLayer.sList.size(); i++) { - if (BW_OreLayer.sList.get(i) instanceof BW_WorldGenRoss128b) { - int baseMeta = result.getItemDamage(); - BW_WorldGenRoss128b worldGen = ((BW_WorldGenRoss128b) BW_OreLayer.sList.get(i)); - if (worldGen.mPrimaryMeta == baseMeta || worldGen.mSecondaryMeta == baseMeta || worldGen.mBetweenMeta == baseMeta || worldGen.mSporadicMeta == baseMeta) { - ItemStack other; - other = result.copy().setStackDisplayName(result.getDisplayName().replaceAll("Ore", "Vein")); - this.stack = new PositionedStack(other, 83, 0); - if (((worldGen.bwOres & 0b1000) != 0)) { - other = result.copy(); - other.setItemDamage(worldGen.mPrimaryMeta); - ret.add(new PositionedStack(other, 0, 12)); - } else { - other = new ItemStack(GregTech_API.sBlockOres1); - other.setItemDamage(worldGen.mPrimaryMeta); - ret.add(new PositionedStack(other, 0, 12)); - } - if (((worldGen.bwOres & 0b0100) != 0)) { - other = result.copy(); - other.setItemDamage(worldGen.mSecondaryMeta); - ret.add(new PositionedStack(other, 20, 12)); - } else { - other = new ItemStack(GregTech_API.sBlockOres1); - other.setItemDamage(worldGen.mSecondaryMeta); - ret.add(new PositionedStack(other, 20, 12)); - } - if (((worldGen.bwOres & 0b0010) != 0)) { - other = result.copy(); - other.setItemDamage(worldGen.mBetweenMeta); - ret.add(new PositionedStack(other, 40, 12)); - } else { - other = new ItemStack(GregTech_API.sBlockOres1); - other.setItemDamage(worldGen.mBetweenMeta); - ret.add(new PositionedStack(other, 40, 12)); - } - if (((worldGen.bwOres & 0b0001) != 0)) { - other = result.copy(); - other.setItemDamage(worldGen.mSporadicMeta); - ret.add(new PositionedStack(other, 60, 12)); - } else { - other = new ItemStack(GregTech_API.sBlockOres1); - other.setItemDamage(worldGen.mSporadicMeta); - ret.add(new PositionedStack(other, 60, 12)); - } - break; - } - } - } - return ret; - } - }; - boolean add = true; - for (TemplateRecipeHandler.CachedRecipe recipe: this.arecipes) { - if (recipe == null || recipe.getOtherStacks() == null || recipe.getOtherStacks().get(0) == null || recipe.getOtherStacks().get(0).item == null) - continue; - if (GT_Utility.areStacksEqual(recipe.getOtherStacks().get(0).item,tmp.getOtherStacks().get(0).item)) - add = false; - } - if (add) - this.arecipes.add(tmp); - } - } - } else super.loadCraftingRecipes(outputId, results); + HashSet<ItemStack> result = new HashSet<>(); + Werkstoff.werkstoffHashSet.stream().filter(w -> w.getGenerationFeatures().hasOres()).forEach(w -> result.add(w.get(OrePrefixes.ore))); + result.forEach(this::loadCraftingRecipes); + HashSet<TemplateRecipeHandler.CachedRecipe> hashSet = new HashSet<>(this.arecipes); + this.arecipes.clear(); + this.arecipes.addAll(hashSet); + } + if (outputId.equals("item")) { + this.loadCraftingRecipes((ItemStack)results[0]); + HashSet<TemplateRecipeHandler.CachedRecipe> hashSet = new HashSet<>(this.arecipes); + this.arecipes.clear(); + this.arecipes.addAll(hashSet); + } } @Override public void drawExtras(int recipe) { - if ((recipe < this.arecipes.size()) && (this.arecipes.get(recipe).getOtherStacks().size() >= 4) ) { - GuiDraw.drawString(ChatColorHelper.BOLD + "DIM:" + ChatColorHelper.RESET + " Ross128", 0, 40, 0, false); + if ((recipe < this.arecipes.size()) && (this.arecipes.get(recipe) instanceof CachedOreRecipe) ) { + CachedOreRecipe cachedOreRecipe = (CachedOreRecipe) this.arecipes.get(recipe); + + GuiDraw.drawString(ChatColorHelper.BOLD + "DIM: " + ChatColorHelper.RESET + cachedOreRecipe.worldGen.getDimName(), 0, 40, 0, false); GuiDraw.drawString(ChatColorHelper.BOLD + "Primary:", 0, 50, 0, false); GuiDraw.drawString(this.arecipes.get(recipe).getOtherStacks().get(0).item.getDisplayName(), 0, 60, 0, false); GuiDraw.drawString(ChatColorHelper.BOLD + "Secondary:", 0, 70, 0, false); @@ -173,70 +106,7 @@ public class BW_NEI_OreHandler extends TemplateRecipeHandler { @Override public void loadCraftingRecipes(ItemStack result) { if (Block.getBlockFromItem(result.getItem()) instanceof BW_MetaGenerated_Ores) { - TemplateRecipeHandler.CachedRecipe tmp = new TemplateRecipeHandler.CachedRecipe() { - - PositionedStack stack = new PositionedStack(result, 0, 0); - - @Override - public PositionedStack getResult() { - return this.stack; - } - - @Override - public List<PositionedStack> getOtherStacks() { - ArrayList<PositionedStack> ret = new ArrayList<>(); - for (int i = 0; i < BW_OreLayer.sList.size(); i++) { - if (BW_OreLayer.sList.get(i) instanceof BW_WorldGenRoss128b) { - int baseMeta = result.getItemDamage(); - BW_WorldGenRoss128b worldGen = ((BW_WorldGenRoss128b) BW_OreLayer.sList.get(i)); - if (worldGen.mPrimaryMeta == baseMeta || worldGen.mSecondaryMeta == baseMeta || worldGen.mBetweenMeta == baseMeta || worldGen.mSporadicMeta == baseMeta) { - ItemStack other; - other = result.copy().setStackDisplayName(result.getDisplayName().replaceAll("Ore", "Vein")); - this.stack = new PositionedStack(other, 83, 0); - if (((worldGen.bwOres & 0b1000) != 0)) { - other = result.copy(); - other.setItemDamage(worldGen.mPrimaryMeta); - ret.add(new PositionedStack(other, 0, 12)); - } else { - other = new ItemStack(GregTech_API.sBlockOres1); - other.setItemDamage(worldGen.mPrimaryMeta); - ret.add(new PositionedStack(other, 0, 12)); - } - if (((worldGen.bwOres & 0b0100) != 0)) { - other = result.copy(); - other.setItemDamage(worldGen.mSecondaryMeta); - ret.add(new PositionedStack(other, 20, 12)); - } else { - other = new ItemStack(GregTech_API.sBlockOres1); - other.setItemDamage(worldGen.mSecondaryMeta); - ret.add(new PositionedStack(other, 20, 12)); - } - if (((worldGen.bwOres & 0b0010) != 0)) { - other = result.copy(); - other.setItemDamage(worldGen.mBetweenMeta); - ret.add(new PositionedStack(other, 40, 12)); - } else { - other = new ItemStack(GregTech_API.sBlockOres1); - other.setItemDamage(worldGen.mBetweenMeta); - ret.add(new PositionedStack(other, 40, 12)); - } - if (((worldGen.bwOres & 0b0001) != 0)) { - other = result.copy(); - other.setItemDamage(worldGen.mSporadicMeta); - ret.add(new PositionedStack(other, 60, 12)); - } else { - other = new ItemStack(GregTech_API.sBlockOres1); - other.setItemDamage(worldGen.mSporadicMeta); - ret.add(new PositionedStack(other, 60, 12)); - } - break; - } - } - } - return ret; - } - }; - this.arecipes.add(tmp); + BW_OreLayer.NEIMAP.get((short) result.getItemDamage()).forEach(l -> this.arecipes.add(new CachedOreRecipe(l, result))); } } @@ -249,4 +119,44 @@ public class BW_NEI_OreHandler extends TemplateRecipeHandler { public String getRecipeName() { return "BartWorks Ores"; } + + class CachedOreRecipe extends TemplateRecipeHandler.CachedRecipe{ + + public CachedOreRecipe(BW_OreLayer worldGen, ItemStack result) { + this.worldGen = worldGen; + this.stack = new PositionedStack(result, 0, 0); + } + + BW_OreLayer worldGen; + PositionedStack stack ; + + @Override + public PositionedStack getResult() { + return this.stack; + } + + @Override + public List<PositionedStack> getOtherStacks() { + List<PositionedStack> ret = new ArrayList<>(); + int x = 0; + for (int i = 0; i < 4; i++) { + x += 20; + ret.add(new PositionedStack(worldGen.getStacks().get(i), x, 12)); + } + return ret; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof CachedOreRecipe)) return false; + CachedOreRecipe that = (CachedOreRecipe) o; + return Objects.equals(worldGen, that.worldGen); + } + + @Override + public int hashCode() { + return worldGen.hashCode(); + } + } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedOreTE.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedOreTE.java index 1e671a1d29..55714c38ec 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedOreTE.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedOreTE.java @@ -33,6 +33,7 @@ import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.Packet; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; @@ -78,9 +79,11 @@ public class BW_MetaGeneratedOreTE extends TileEntity implements ITexturedTileEn return rList; } - public void sendPacket(){ + @Override + public Packet getDescriptionPacket() { if (!this.worldObj.isRemote) BW_Network_instance.sendPacketToAllPlayersInRange(this.worldObj, new OrePacket(this.xCoord, (short) this.yCoord, this.zCoord, this.mMetaData), this.xCoord, this.zCoord); + return null; } @Override diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java index 47e676e082..4d1a5a4a9e 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java @@ -24,7 +24,6 @@ package com.github.bartimaeusnek.bartworks.system.material; import com.github.bartimaeusnek.bartworks.client.renderer.BW_Renderer_Block_Ores; import com.github.bartimaeusnek.bartworks.common.blocks.BW_TileEntityContainer; -import cpw.mods.fml.common.FMLCommonHandler; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_ModHandler; @@ -41,6 +40,7 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import static com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_Items.metaTab; @@ -66,7 +66,7 @@ public class BW_MetaGenerated_Ores extends BW_TileEntityContainer { } } - public static boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData, boolean air, Block block) { + public static boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData, boolean air, Block block, int[] aBlockMeta) { if (!air) { aY = Math.min(aWorld.getActualHeight(), Math.max(aY, 1)); } @@ -77,7 +77,11 @@ public class BW_MetaGenerated_Ores extends BW_TileEntityContainer { return false; } else { - if (!tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, block)) { + if (Block.getIdFromBlock(tBlock) != Block.getIdFromBlock(block)) { + return false; + } + final int aaY = aY; + if (Arrays.stream(aBlockMeta).noneMatch(e -> e == aWorld.getBlockMetadata(aX, aaY, aZ))) { return false; } @@ -164,17 +168,17 @@ public class BW_MetaGenerated_Ores extends BW_TileEntityContainer { } } - @Override - public void onNeighborBlockChange(World aWorld, int aX, int aY, int aZ, Block p_149695_5_) { - if ((!aWorld.isRemote || this.checkForAir(aWorld,aX,aY,aZ)) && aWorld.getTileEntity(aX, aY, aZ) instanceof BW_MetaGeneratedOreTE) - ((BW_MetaGeneratedOreTE)aWorld.getTileEntity(aX, aY, aZ)).sendPacket(); - } - - @Override - public void onNeighborChange(IBlockAccess aWorld, int aX, int aY, int aZ, int tileX, int tileY, int tileZ) { - if ((FMLCommonHandler.instance().getEffectiveSide().isServer() || this.checkForAir(aWorld,aX,aY,aZ)) && aWorld.getTileEntity(aX, aY, aZ) instanceof BW_MetaGeneratedOreTE) - ((BW_MetaGeneratedOreTE)aWorld.getTileEntity(aX, aY, aZ)).sendPacket(); - } +// @Override +// public void onNeighborBlockChange(World aWorld, int aX, int aY, int aZ, Block p_149695_5_) { +// if ((!aWorld.isRemote || this.checkForAir(aWorld,aX,aY,aZ)) && aWorld.getTileEntity(aX, aY, aZ) instanceof BW_MetaGeneratedOreTE) +// ((BW_MetaGeneratedOreTE)aWorld.getTileEntity(aX, aY, aZ)).sendPacket(); +// } +// +// @Override +// public void onNeighborChange(IBlockAccess aWorld, int aX, int aY, int aZ, int tileX, int tileY, int tileZ) { +// if ((FMLCommonHandler.instance().getEffectiveSide().isServer() || this.checkForAir(aWorld,aX,aY,aZ)) && aWorld.getTileEntity(aX, aY, aZ) instanceof BW_MetaGeneratedOreTE) +// ((BW_MetaGeneratedOreTE)aWorld.getTileEntity(aX, aY, aZ)).sendPacket(); +// } private boolean checkForAir(IBlockAccess aWorld, int aX, int aY, int aZ){ for (int x = -1; x <= 1; x++) { diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_NonMeta_MaterialItems.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_NonMeta_MaterialItems.java index 7f36e43193..1c3455147f 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_NonMeta_MaterialItems.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_NonMeta_MaterialItems.java @@ -34,8 +34,8 @@ import static gregtech.api.enums.GT_Values.W; public enum BW_NonMeta_MaterialItems implements IItemContainer { Depleted_Tiberium_1,Depleted_Tiberium_2,Depleted_Tiberium_4, - TiberiumCell_1,TiberiumCell_2,TiberiumCell_4 - ; + TiberiumCell_1,TiberiumCell_2,TiberiumCell_4, + TheCoreCell,Depleted_TheCoreCell; private ItemStack mStack; private boolean mHasNotBeenSet = true; diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java index 4d138e21db..0cfc13e342 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java @@ -86,6 +86,7 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { public Werkstoff(short[] rgba, String defaultName, Werkstoff.Stats stats, Werkstoff.Types type, Werkstoff.GenerationFeatures generationFeatures, int mID, TextureSet texSet, List<ISubTagContainer> oreByProduct, Pair<ISubTagContainer, Integer>... contents) { this(rgba, defaultName, "", stats, type, generationFeatures, mID, texSet, contents); + this.mOreByProducts.clear(); this.mOreByProducts.addAll(oreByProduct); } @@ -95,6 +96,7 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { public Werkstoff(short[] rgba, String defaultName, String toolTip, Werkstoff.Stats stats, Werkstoff.Types type, Werkstoff.GenerationFeatures generationFeatures, int mID, TextureSet texSet, List<ISubTagContainer> oreByProduct, Pair<ISubTagContainer, Integer>... contents) { this(rgba, defaultName, toolTip, stats, type, generationFeatures, mID, texSet, contents); + this.mOreByProducts.clear(); this.mOreByProducts.addAll(oreByProduct); } @@ -164,6 +166,12 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { } this.texSet = texSet; + if (this.mOreByProducts.isEmpty()) { + this.mOreByProducts.add(this); + this.mOreByProducts.add(this); + this.mOreByProducts.add(this); + } + Werkstoff.werkstoffHashSet.add(this); Werkstoff.werkstoffHashMap.put(this.mID, this); Werkstoff.werkstoffNameHashMap.put(this.defaultName,this); @@ -323,10 +331,10 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { } public FluidStack getFluidOrGas(int fluidAmount) { - return new FluidStack(WerkstoffLoader.fluids.get(this),fluidAmount); + return new FluidStack(Objects.requireNonNull(WerkstoffLoader.fluids.get(this)),fluidAmount); } public FluidStack getMolten(int fluidAmount) { - return new FluidStack(WerkstoffLoader.molten.get(this),fluidAmount); + return new FluidStack(Objects.requireNonNull(WerkstoffLoader.molten.get(this)),fluidAmount); } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java index d821007533..95337e0a7b 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java @@ -48,7 +48,6 @@ import gregtech.api.interfaces.ISubTagContainer; import gregtech.api.objects.GT_Fluid; import gregtech.api.objects.GT_MultiTexture; import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.objects.ItemData; import gregtech.api.util.*; import gregtech.common.GT_Proxy; import gregtech.common.items.behaviors.Behaviour_DataOrb; @@ -111,7 +110,8 @@ public class WerkstoffLoader implements Runnable { } catch (NullPointerException | IllegalArgumentException e){} Element t = EnumHelper.addEnum(Element.class,"Tr",new Class[]{long.class, long.class, long.class, long.class, String.class, String.class, boolean.class}, new Object[]{123L, 203L, 0L, -1L, (String) null, "Tiberium", false}); } - //TODO: FREE ID RANGE: 19-32766 + + //TODO: FREE ID RANGE: 91-32766 public static final Werkstoff Bismutite = new Werkstoff( new short[]{255, 233, 0, 0}, @@ -1202,7 +1202,7 @@ public class WerkstoffLoader implements Runnable { "Tr", new Werkstoff.Stats().setProtons(123).setMass(326).setBlastFurnace(true).setMeltingPoint(1800).setRadioactive(true).setToxic(true), Werkstoff.Types.ELEMENT, - new Werkstoff.GenerationFeatures().onlyDust().addGems().addCraftingMetalWorkingItems().addSimpleMetalWorkingItems(), + new Werkstoff.GenerationFeatures().addGems().addCraftingMetalWorkingItems().addSimpleMetalWorkingItems(), 89, TextureSet.SET_DIAMOND ); @@ -1217,6 +1217,31 @@ public class WerkstoffLoader implements Runnable { new Pair<>(WerkstoffLoader.Ruthenium,2), new Pair<>(Materials.Iridium,1) ); + public static final Werkstoff Fluorspar = new Werkstoff( + new short[]{185,69,251}, + "Fluorspar", + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().addGems(), + 91, + TextureSet.SET_GEM_VERTICAL, + new Pair<>(Materials.Calcium,1), + new Pair<>(Materials.Fluorine,2) + ); +// public static final Werkstoff Baryte = new Werkstoff( +// new short[]{0xB9,0x45,0xFB}, +// "Baryte", +// new Werkstoff.Stats().setElektrolysis(true), +// Werkstoff.Types.COMPOUND, +// new Werkstoff.GenerationFeatures().addGems(), +// 92, +// TextureSet.SET_GEM_VERTICAL, +// new Pair<>(Materials.Barium,1), +// new Pair<>(Materials.Sulfur,1), +// new Pair<>(Materials.Oxygen,3) +// ); + + public static HashMap<OrePrefixes, BW_MetaGenerated_Items> items = new HashMap<>(); public static HashBiMap<Werkstoff, Fluid> fluids = HashBiMap.create(); @@ -1476,7 +1501,7 @@ public class WerkstoffLoader implements Runnable { public static void runGTItemDataRegistrator(){ HashSet<Materials> toRem = new HashSet<>(); for (Werkstoff werkstoff : Werkstoff.werkstoffHashSet) { - Materials werkstoffBridgeMaterial = werkstoff.getBridgeMaterial() != null ? werkstoff.getBridgeMaterial() : new Materials(-1, werkstoff.getTexSet(), 0, 0, 0, false, werkstoff.getDefaultName().replaceAll(" ", ""), werkstoff.getDefaultName()); + Materials werkstoffBridgeMaterial = werkstoff.getBridgeMaterial() != null ? werkstoff.getBridgeMaterial() : Materials.get(werkstoff.getDefaultName()) != Materials._NULL ? Materials.get(werkstoff.getDefaultName()) : new Materials(-1, werkstoff.getTexSet(), 0, 0, 0, false, werkstoff.getDefaultName().replaceAll(" ", ""), werkstoff.getDefaultName()); for (OrePrefixes prefixes : values()) { if (!(prefixes == cell && werkstoff.getType().equals(Werkstoff.Types.ELEMENT))) { if (prefixes == dust && werkstoff.getType().equals(Werkstoff.Types.ELEMENT)) { @@ -1486,7 +1511,7 @@ public class WerkstoffLoader implements Runnable { if (e.toString().equals(werkstoff.getToolTip())) { if (e.mLinkedMaterials.size() > 0) break; - werkstoffBridgeMaterial = new Materials(-1, werkstoff.getTexSet(), 0, 0, 0, true, werkstoff.getDefaultName().replaceAll(" ", ""), werkstoff.getDefaultName()); + werkstoffBridgeMaterial = werkstoff.getBridgeMaterial() != null ? werkstoff.getBridgeMaterial() : Materials.get(werkstoff.getDefaultName()) != Materials._NULL ? Materials.get(werkstoff.getDefaultName()) : new Materials(-1, werkstoff.getTexSet(), 0, 0, 0, false, werkstoff.getDefaultName().replaceAll(" ", ""), werkstoff.getDefaultName()); werkstoffBridgeMaterial.mElement = e; e.mLinkedMaterials = new ArrayList<>(); e.mLinkedMaterials.add(werkstoffBridgeMaterial); @@ -1837,6 +1862,7 @@ public class WerkstoffLoader implements Runnable { if (cells > 0) stOutputs.add(Materials.Empty.getCells(cells)); GT_Recipe.GT_Recipe_Map.sChemicalRecipes.add(new BWRecipes.DynamicGTRecipe(true, stOutputs.toArray(new ItemStack[0]),new ItemStack[]{input},null,null,new FluidStack[]{flOutputs.size() > 0 ? flOutputs.get(0) : null},null,(int) Math.max(1L, Math.abs(werkstoff.getStats().protons * werkstoff.getContents().getValue().size())), Math.min(4, werkstoff.getContents().getValue().size()) * 30,0)); + GT_Recipe.GT_Recipe_Map.sMultiblockChemicalRecipes.addRecipe(true, stOutputs.toArray(new ItemStack[0]),new ItemStack[]{input},null,null,new FluidStack[]{flOutputs.size() > 0 ? flOutputs.get(0) : null},null,(int) Math.max(1L, Math.abs(werkstoff.getStats().protons * werkstoff.getContents().getValue().size())), Math.min(4, werkstoff.getContents().getValue().size()) * 30,0); } if (werkstoff.getGenerationFeatures().hasMixerRecipes()) { if (cells > 0) diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/AdditionalRecipes.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/AdditionalRecipes.java index f2ac02b257..8071b9b423 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/AdditionalRecipes.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/AdditionalRecipes.java @@ -31,7 +31,9 @@ import com.github.bartimaeusnek.bartworks.util.BWRecipes; import com.github.bartimaeusnek.bartworks.util.BW_Util; import gregtech.api.GregTech_API; import gregtech.api.enums.*; -import gregtech.api.util.*; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; import gregtech.common.items.behaviors.Behaviour_DataOrb; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -140,6 +142,8 @@ public class AdditionalRecipes implements Runnable { GT_Values.RA.addAssemblerRecipe(BW_NonMeta_MaterialItems.TiberiumCell_1.get(4L), GT_OreDictUnificator.get(stickLong, Materials.TungstenSteel, 6L), BW_NonMeta_MaterialItems.TiberiumCell_4.get(1L), 150, 400); GT_Values.RA.addAssemblerRecipe(BW_NonMeta_MaterialItems.TiberiumCell_2.get(2L), GT_OreDictUnificator.get(stick, Materials.TungstenSteel, 4L), BW_NonMeta_MaterialItems.TiberiumCell_4.get(1L), 100, 400); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.NaquadahCell_1.get(32L), GT_OreDictUnificator.get(stickLong, Materials.TungstenSteel,64L), GT_OreDictUnificator.get(stickLong, Materials.TungstenSteel,64L), GT_OreDictUnificator.get(stickLong, Materials.TungstenSteel,64L)},null, BW_NonMeta_MaterialItems.TheCoreCell.get(1L), 100, BW_Util.getMachineVoltageFromTier(6)); + GregTech_API.sAfterGTPostload.add(new LuVTierEnhancer()); AdditionalRecipes.oldGThelperMethod(); } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/AfterLuVTierEnhacement.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/AfterLuVTierEnhacement.java index b0d0c2e79c..95ee440ddb 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/AfterLuVTierEnhacement.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/AfterLuVTierEnhacement.java @@ -25,17 +25,18 @@ package com.github.bartimaeusnek.bartworks.system.material.processingLoaders; import com.github.bartimaeusnek.bartworks.system.material.BW_NonMeta_MaterialItems; import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader; import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.util.GT_OreDictUnificator; -import static gregtech.api.enums.OrePrefixes.*; import static gregtech.api.enums.OrePrefixes.dust; +import static gregtech.api.enums.OrePrefixes.dustSmall; public class AfterLuVTierEnhacement implements Runnable { @Override public void run() { - GT_Values.RA.addCentrifugeRecipe(BW_NonMeta_MaterialItems.Depleted_Tiberium_1.get(1), null,null,WerkstoffLoader.Xenon.getFluidOrGas(50), + GT_Values.RA.addCentrifugeRecipe(BW_NonMeta_MaterialItems.Depleted_Tiberium_1.get(1), null,null,WerkstoffLoader.Xenon.getFluidOrGas(1), WerkstoffLoader.Zirconium.get(dust), WerkstoffLoader.Zirconium.get(dust), WerkstoffLoader.Tiberium.get(dustSmall,2), @@ -43,7 +44,7 @@ public class AfterLuVTierEnhacement implements Runnable { GT_OreDictUnificator.get(dust, Materials.TungstenSteel, 8L), GT_OreDictUnificator.get(dust, Materials.Platinum, 1L), new int[]{10_000,5_000,5_000,2_500,10_000,10_000},250,2000); - GT_Values.RA.addCentrifugeRecipe(BW_NonMeta_MaterialItems.Depleted_Tiberium_2.get(1), null,null,WerkstoffLoader.Xenon.getFluidOrGas(100), + GT_Values.RA.addCentrifugeRecipe(BW_NonMeta_MaterialItems.Depleted_Tiberium_2.get(1), null,null,WerkstoffLoader.Xenon.getFluidOrGas(2), WerkstoffLoader.Zirconium.get(dust,2), WerkstoffLoader.Zirconium.get(dust,2), WerkstoffLoader.Tiberium.get(dust), @@ -51,7 +52,7 @@ public class AfterLuVTierEnhacement implements Runnable { GT_OreDictUnificator.get(dust, Materials.TungstenSteel, 18L), GT_OreDictUnificator.get(dust, Materials.Platinum, 2L), new int[]{10_000,5_000,5_000,2_500,10_000,10_000},500,2000); - GT_Values.RA.addCentrifugeRecipe(BW_NonMeta_MaterialItems.Depleted_Tiberium_4.get(1), null,null,WerkstoffLoader.Xenon.getFluidOrGas(200), + GT_Values.RA.addCentrifugeRecipe(BW_NonMeta_MaterialItems.Depleted_Tiberium_4.get(1), null,null,WerkstoffLoader.Xenon.getFluidOrGas(4), WerkstoffLoader.Zirconium.get(dust,4), WerkstoffLoader.Zirconium.get(dust,4), WerkstoffLoader.Tiberium.get(dust,2), @@ -59,5 +60,13 @@ public class AfterLuVTierEnhacement implements Runnable { GT_OreDictUnificator.get(dust, Materials.TungstenSteel, 38L), GT_OreDictUnificator.get(dust, Materials.Platinum, 4L), new int[]{10_000,5_000,5_000,2_500,10_000,10_000},1000,2000); + GT_Values.RA.addCentrifugeRecipe(BW_NonMeta_MaterialItems.Depleted_TheCoreCell.get(1), null,null,null, + ItemList.Depleted_Naquadah_4.get(8), + null, + null, + null, + null, + null, + null,2000,8000); } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/LoadItemContainers.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/LoadItemContainers.java index 053b899ea8..bcc0917b9a 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/LoadItemContainers.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/LoadItemContainers.java @@ -36,5 +36,7 @@ public class LoadItemContainers implements Runnable { BW_NonMeta_MaterialItems.TiberiumCell_1.set(new GT_RadioactiveCellIC_Item("Tiberiumcell", "Fuel Rod (Tiberium)", 1, 50000, 2F, 1, 0.5F, BW_NonMeta_MaterialItems.Depleted_Tiberium_1.get(1), false)); BW_NonMeta_MaterialItems.TiberiumCell_2.set(new GT_RadioactiveCellIC_Item("Double_Tiberiumcell", "Dual Fuel Rod (Tiberium)", 2, 50000, 2F, 1, 0.5F, BW_NonMeta_MaterialItems.Depleted_Tiberium_2.get(1), false)); BW_NonMeta_MaterialItems.TiberiumCell_4.set(new GT_RadioactiveCellIC_Item("Quad_Tiberiumcell", "Quad Fuel Rod (Tiberium)", 4, 50000, 2F, 1, 0.5F, BW_NonMeta_MaterialItems.Depleted_Tiberium_4.get(1), false)); + BW_NonMeta_MaterialItems.Depleted_TheCoreCell.set(new GT_DepletetCell_Item("Core_Reactor_CellDep", "Depleted \"The Core\" Cell", 32)); + BW_NonMeta_MaterialItems.TheCoreCell.set(new GT_RadioactiveCellIC_Item("Core_Reactor_Cell", "\"The Core\" Cell", 32, 102400000, 8F, 32, 1F, BW_NonMeta_MaterialItems.Depleted_TheCoreCell.get(1), false)); } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/PlatinumSludgeOverHaul.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/PlatinumSludgeOverHaul.java index 69bd771eb0..b04e2e6db0 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/PlatinumSludgeOverHaul.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/PlatinumSludgeOverHaul.java @@ -505,6 +505,9 @@ public class PlatinumSludgeOverHaul { } private static boolean isInBlackList(ItemStack stack) { + if (stack == null) + return true; + if (stack.getItem() instanceof BW_MetaGenerated_Items) return true; diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_OreLayer.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_OreLayer.java index ebc432d1b5..d9dff96cf7 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_OreLayer.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_OreLayer.java @@ -26,6 +26,9 @@ import com.github.bartimaeusnek.bartworks.MainMod; import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGeneratedOreTE; import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_Ores; import com.github.bartimaeusnek.bartworks.system.material.Werkstoff; +import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader; +import com.github.bartimaeusnek.bartworks.util.MurmurHash3; +import com.google.common.collect.ArrayListMultimap; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.interfaces.ISubTagContainer; @@ -33,11 +36,13 @@ import gregtech.api.world.GT_Worldgen; import gregtech.common.blocks.GT_TileEntity_Ores; import net.minecraft.block.Block; import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; +import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; import java.util.Random; @@ -47,12 +52,15 @@ import java.util.Random; */ public abstract class BW_OreLayer extends GT_Worldgen { public static final List<BW_OreLayer> sList = new ArrayList<>(); + public static final ArrayListMultimap<Short,BW_OreLayer> NEIMAP = ArrayListMultimap.create(); private static final boolean logOregenRoss128 = false; public static int sWeight; public byte bwOres; public int mMinY, mWeight, mDensity, mSize, mMaxY, mPrimaryMeta, mSecondaryMeta, mBetweenMeta, mSporadicMeta; public abstract Block getDefaultBlockToReplace(); + public abstract int[] getDefaultDamageToReplace(); + public abstract String getDimName(); public BW_OreLayer(String aName, boolean aDefault, int aMinY, int aMaxY, int aWeight, int aDensity, int aSize, ISubTagContainer top, ISubTagContainer bottom, ISubTagContainer between, ISubTagContainer sprinkled) { super(aName, BW_OreLayer.sList, aDefault); @@ -98,11 +106,24 @@ public abstract class BW_OreLayer extends GT_Worldgen { this.mSecondaryMeta = aSecondary; this.mBetweenMeta = aBetween; this.mSporadicMeta = aSporadic; + NEIMAP.put((short) this.mPrimaryMeta,this); + NEIMAP.put((short) this.mSecondaryMeta,this); + NEIMAP.put((short) this.mBetweenMeta,this); + NEIMAP.put((short) this.mSporadicMeta,this); + } + public List<ItemStack> getStacks(){ + ArrayList<ItemStack> ret = new ArrayList<>(); + ret.add((this.bwOres & 0b1000) != 0 ? new ItemStack(WerkstoffLoader.BWOres,1,this.mPrimaryMeta) : new ItemStack ( GregTech_API.sBlockOres1,1,this.mPrimaryMeta)); + ret.add((this.bwOres & 0b0100) != 0 ? new ItemStack(WerkstoffLoader.BWOres,1,this.mSecondaryMeta) : new ItemStack ( GregTech_API.sBlockOres1,1,this.mSecondaryMeta)); + ret.add((this.bwOres & 0b0010) != 0 ? new ItemStack(WerkstoffLoader.BWOres,1,this.mBetweenMeta) : new ItemStack ( GregTech_API.sBlockOres1,1,this.mBetweenMeta)); + ret.add((this.bwOres & 0b0001) != 0 ? new ItemStack(WerkstoffLoader.BWOres,1,this.mSporadicMeta) : new ItemStack ( GregTech_API.sBlockOres1,1,this.mSporadicMeta)); + return ret; } @Override public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { { + int tMinY = this.mMinY + aRandom.nextInt(this.mMaxY - this.mMinY - 5); int cX = aChunkX - aRandom.nextInt(this.mSize); int eX = aChunkX + 16 + aRandom.nextInt(this.mSize); @@ -156,7 +177,7 @@ public abstract class BW_OreLayer extends GT_Worldgen { return true; if ((aMetaData == this.mSporadicMeta && (this.bwOres & 0b0001) != 0) || (aMetaData == this.mBetweenMeta && (this.bwOres & 0b0010) != 0) || (aMetaData == this.mPrimaryMeta && (this.bwOres & 0b1000) != 0) || (aMetaData == this.mSecondaryMeta && (this.bwOres & 0b0100) != 0)) { - return BW_MetaGenerated_Ores.setOreBlock(aWorld, aX, aY, aZ, aMetaData, false, this.getDefaultBlockToReplace()); + return BW_MetaGenerated_Ores.setOreBlock(aWorld, aX, aY, aZ, aMetaData, false, this.getDefaultBlockToReplace(),this.getDefaultDamageToReplace()); } return this.setGTOreBlockSpace(aWorld, aX, aY, aZ, aMetaData, this.getDefaultBlockToReplace()); @@ -184,4 +205,28 @@ public abstract class BW_OreLayer extends GT_Worldgen { }else return true; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof BW_OreLayer)) return false; + + BW_OreLayer that = (BW_OreLayer) o; + + if (bwOres != that.bwOres) return false; + if (mMinY != that.mMinY) return false; + if (mWeight != that.mWeight) return false; + if (mDensity != that.mDensity) return false; + if (mSize != that.mSize) return false; + if (mMaxY != that.mMaxY) return false; + if (mPrimaryMeta != that.mPrimaryMeta) return false; + if (mSecondaryMeta != that.mSecondaryMeta) return false; + if (mBetweenMeta != that.mBetweenMeta) return false; + return mSporadicMeta == that.mSporadicMeta; + } + + @Override + public int hashCode() { + return MurmurHash3.murmurhash3_x86_32(ByteBuffer.allocate(37).put(bwOres).putInt(mMinY).putInt(mWeight).putInt(mDensity).putInt(mSize).putInt(mMaxY).putInt(mPrimaryMeta).putInt(mSecondaryMeta).putInt(mBetweenMeta).putInt(mSporadicMeta).array(),0,37,31); + } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WordGenerator.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WordGenerator.java index 2cc26fe8cc..8a442787b9 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WordGenerator.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WordGenerator.java @@ -101,17 +101,19 @@ public class BW_WordGenerator implements IWorldGenerator { for (int i = 0; (i < 256) && (temp); i++) { tRandomWeight = random.nextInt(BW_OreLayer.sWeight); for (BW_OreLayer tWorldGen : BW_OreLayer.sList) { + if (!tWorldGen.isGenerationAllowed(this.mWorld, this.mDimensionType, this.mDimensionType)) + continue; tRandomWeight -= tWorldGen.mWeight; if (tRandomWeight <= 0) { try { boolean placed; int attempts = 0; - do{ + do { placed = tWorldGen.executeWorldgen(this.mWorld, random, "", this.mDimensionType, xCenter, zCenter, this.mChunkGenerator, this.mChunkProvider); ++attempts; } while ((!placed) && attempts < 25); - temp = false; + temp = false; break; } catch (Throwable e) { e.printStackTrace(GT_Log.err); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128b.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128b.java index 08e26b4075..471120793e 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128b.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128b.java @@ -40,11 +40,21 @@ public class BW_WorldGenRoss128b extends BW_OreLayer { return Blocks.stone; } + @Override + public int[] getDefaultDamageToReplace() { + return new int[]{0}; + } + + @Override + public String getDimName() { + return StatCollector.translateToLocal("planet.Ross128b"); + } + public BW_WorldGenRoss128b(String aName, boolean aDefault, int aMinY, int aMaxY, int aWeight, int aDensity, int aSize, ISubTagContainer top, ISubTagContainer bottom, ISubTagContainer between, ISubTagContainer sprinkled) { super(aName, aDefault, aMinY, aMaxY, aWeight, aDensity, aSize, top, bottom, between, sprinkled); } - public static void init_OresRoss128() { + public static void initOres() { new BW_WorldGenRoss128b("ore.mix.ross128.Thorianit", true, 30, 60, 17, 1, 16, Thorianit, Uraninite, Lepidolite, Spodumene); new BW_WorldGenRoss128b("ore.mix.ross128.carbon", true, 5, 25, 5, 4, 12, Graphite, Diamond, Coal, Graphite); new BW_WorldGenRoss128b("ore.mix.ross128.bismuth", true, 5, 80, 30, 1, 16, Bismuthinit, Stibnite, Bismuth, Bismutite); @@ -57,7 +67,7 @@ public class BW_WorldGenRoss128b extends BW_OreLayer { new BW_WorldGenRoss128b("ore.mix.ross128.RedZircon", true, 10, 80, 40, 3, 24, Fayalit, FuchsitAL, RedZircon, FuchsitCR); } - public static void init_undergroundFluidsRoss128() { + public static void initundergroundFluids() { String ross128b = StatCollector.translateToLocal("planet.Ross128b"); uo_dimensionList.SetConfigValues(ross128b, ross128b, "veryheavyoil", "liquid_extra_heavy_oil", 0, 625, 40, 5); uo_dimensionList.SetConfigValues(ross128b, ross128b, "lava", FluidRegistry.getFluidName(FluidRegistry.LAVA), 0, 32767, 5, 5); @@ -66,7 +76,7 @@ public class BW_WorldGenRoss128b extends BW_OreLayer { @Override public boolean isGenerationAllowed(World aWorld, int aDimensionType, int aAllowedDimensionType) { - return aWorld.provider.dimensionId == ConfigHandler.ross128BID; + return aDimensionType == ConfigHandler.ross128BID; } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128ba.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128ba.java index 8bcffab9b1..ae7b8bcf6c 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128ba.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128ba.java @@ -22,11 +22,11 @@ package com.github.bartimaeusnek.bartworks.system.oregen; -import gregtech.api.enums.Materials; +import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; import gregtech.api.interfaces.ISubTagContainer; -import gregtech.api.util.GT_ModHandler; import net.minecraft.block.Block; import net.minecraft.util.StatCollector; +import net.minecraft.world.World; import static com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader.*; import static com.github.bartimaeusnek.crossmod.galacticraft.GalacticraftProxy.uo_dimensionList; @@ -40,20 +40,43 @@ public class BW_WorldGenRoss128ba extends BW_OreLayer { @Override public Block getDefaultBlockToReplace() { - return Block.getBlockFromItem(GT_ModHandler.getModItem("galacticraftCore","tile.moonBlock",1).getItem()); + return Block.getBlockFromName("GalacticraftCore:tile.moonBlock"); + } + @Override + public int[] getDefaultDamageToReplace(){ + int[] ret = new int[12]; + for (int i = 0; i < 12; i++) { + if (i != 5 && i != 3) + ret[i] = i; + } + return ret; } - public static void init_OresRoss128ba() { - new BW_WorldGenRoss128ba("ore.mix.ross128ba.tib", true, 30, 60, 6, 1, 16, Tiberium, Tiberium, NaquadahEnriched, NaquadahEnriched); - new BW_WorldGenRoss128ba("ore.mix.ross128.Tungstate", true, 5, 40, 10, 4, 14, Ferberite, Huebnerit, Loellingit, Scheelite); - new BW_WorldGenRoss128ba("ore.mix.ross128ba.bart", true, 30, 60, 1, 1, 3, BArTiMaEuSNeK, BArTiMaEuSNeK, BArTiMaEuSNeK, BArTiMaEuSNeK); + @Override + public String getDimName() { + return StatCollector.translateToLocal("moon.Ross128ba"); + } + public static void init_Ores() { + new BW_WorldGenRoss128ba("ore.mix.ross128ba.tib", true, 30, 60, 6, 1, 16, Tiberium, Tiberium, NaquadahEnriched, NaquadahEnriched); + new BW_WorldGenRoss128ba("ore.mix.ross128ba.Tungstate", true, 5, 40, 60, 4, 14, Ferberite, Huebnerit, Loellingit, Scheelite); + new BW_WorldGenRoss128ba("ore.mix.ross128ba.bart", true, 30, 60, 1, 1, 1, BArTiMaEuSNeK, BArTiMaEuSNeK, BArTiMaEuSNeK, BArTiMaEuSNeK); + new BW_WorldGenRoss128ba("ore.mix.ross128ba.TurmalinAlkali", true, 5, 80, 60, 4, 48, Olenit, FluorBuergerit, ChromoAluminoPovondrait, VanadioOxyDravit); + new BW_WorldGenRoss128ba("ore.mix.ross128ba.Amethyst", true, 5, 80, 35, 2, 8, Amethyst, Olivine, Prasiolite, Hedenbergit); + new BW_WorldGenRoss128ba("ore.mix.ross128ba.CopperSulfits", true, 40, 70, 80, 3, 24, Djurleit, Bornite, Wittichenit, Tetrahedrite); + new BW_WorldGenRoss128ba("ore.mix.ross128ba.RedZircon", true, 10, 80, 40, 3, 24, Fayalit, FuchsitAL, RedZircon, FuchsitCR); + new BW_WorldGenRoss128ba("ore.mix.ross128ba.Fluorspar", true, 10, 80, 35, 4, 8, Galena, Sphalerite, Fluorspar, Barite); } - public static void init_undergroundFluidsRoss128ba() { - String ross128b = StatCollector.translateToLocal("planet.Ross128ba"); - uo_dimensionList.SetConfigValues(ross128b, ross128b, Materials.SaltWater.getFluid(1).getUnlocalizedName(), Materials.SaltWater.getFluid(1).getUnlocalizedName(), 0, 625, 40, 5); - uo_dimensionList.SetConfigValues(ross128b, ross128b, Materials.Helium_3.getGas(1).getUnlocalizedName(), Materials.Helium_3.getGas(1).getUnlocalizedName(), 0, 625, 60, 5); + public static void init_undergroundFluids() { + String ross128b = StatCollector.translateToLocal("moon.Ross128ba"); + uo_dimensionList.SetConfigValues(ross128b, ross128b, SaltWater.getFluid(1).getFluid().getName(), SaltWater.getFluid(1).getFluid().getName(), 0, 625, 40, 5); + uo_dimensionList.SetConfigValues(ross128b, ross128b, Helium_3.getGas(1).getFluid().getName(), Helium_3.getGas(1).getFluid().getName(), 0, 625, 60, 5); + } + @Override + public boolean isGenerationAllowed(World aWorld, int aDimensionType, int aAllowedDimensionType) { + return aDimensionType == ConfigHandler.ross128BAID; } + } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/util/BW_ColorUtil.java b/src/main/java/com/github/bartimaeusnek/bartworks/util/BW_ColorUtil.java index f1ae2667ee..11d6637db3 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/util/BW_ColorUtil.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/util/BW_ColorUtil.java @@ -203,9 +203,12 @@ public class BW_ColorUtil { } public static short[] correctCorlorArray(short[] rgba){ + if (rgba.length>4) { + rgba = Arrays.copyOfRange(rgba, 0,4); + } if (rgba.length<4) { short[] tmp = Arrays.copyOf(rgba, 4); - Arrays.fill(tmp,rgba.length-1,4, (short) 0); + Arrays.fill(tmp,rgba.length,4, (short) 0); rgba = tmp; } if (rgba[0] > 255) diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/GalacticraftProxy.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/GalacticraftProxy.java index cca1bf94d4..b3648ccabc 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/GalacticraftProxy.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/GalacticraftProxy.java @@ -23,6 +23,8 @@ package com.github.bartimaeusnek.crossmod.galacticraft; import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; +import com.github.bartimaeusnek.bartworks.system.oregen.BW_WorldGenRoss128b; +import com.github.bartimaeusnek.bartworks.system.oregen.BW_WorldGenRoss128ba; import com.github.bartimaeusnek.crossmod.galacticraft.atmosphere.BWAtmosphereManager; import com.github.bartimaeusnek.crossmod.galacticraft.solarsystems.Ross128SolarSystem; import cpw.mods.fml.common.FMLCommonHandler; @@ -35,9 +37,6 @@ import net.minecraftforge.common.config.Configuration; import java.io.File; -import static com.github.bartimaeusnek.bartworks.system.oregen.BW_WorldGenRoss128b.init_OresRoss128; -import static com.github.bartimaeusnek.bartworks.system.oregen.BW_WorldGenRoss128b.init_undergroundFluidsRoss128; - public class GalacticraftProxy { public static GT_UO_DimensionList uo_dimensionList = new GT_UO_DimensionList(); static Configuration gtConf; @@ -72,10 +71,12 @@ public class GalacticraftProxy { private static void commonpreInit(FMLPreInitializationEvent e) { GalacticraftProxy.gtConf = new Configuration(new File(new File(e.getModConfigurationDirectory(), "GregTech"), "GregTech.cfg")); GalacticraftProxy.uo_dimensionList.getConfig(GalacticraftProxy.gtConf, "undergroundfluid"); - init_undergroundFluidsRoss128(); + BW_WorldGenRoss128b.initundergroundFluids(); + BW_WorldGenRoss128ba.init_undergroundFluids(); if (GalacticraftProxy.gtConf.hasChanged()) GalacticraftProxy.gtConf.save(); - init_OresRoss128(); + BW_WorldGenRoss128b.initOres(); + BW_WorldGenRoss128ba.init_Ores(); MinecraftForge.EVENT_BUS.register(BWAtmosphereManager.INSTANCE); } diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/ChunkProviderRoss128b.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/ChunkProviderRoss128b.java index 34e96e6111..c815c6f3d6 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/ChunkProviderRoss128b.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/ChunkProviderRoss128b.java @@ -53,7 +53,7 @@ import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.Ev public class ChunkProviderRoss128b extends ChunkProviderGenerate { XSTR rand = new XSTR(); private BiomeGenBase[] biomesForGeneration; - private final BW_WordGenerator BWOreGen = new BW_WordGenerator(); + public static final BW_WordGenerator BWOreGen = new BW_WordGenerator(); private final World worldObj; private final MapGenBase caveGenerator = new MapGenCaves(); private final MapGenBase ravineGenerator = new MapGenRavine(); @@ -159,7 +159,7 @@ public class ChunkProviderRoss128b extends ChunkProviderGenerate { } } - this.BWOreGen.generate(this.rand, p_73153_2_, p_73153_3_, this.worldObj, this, this); + BWOreGen.generate(this.rand, p_73153_2_, p_73153_3_, this.worldObj, this, this); MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, this.worldObj, this.rand, p_73153_2_, p_73153_3_, false)); BlockFalling.fallInstantly = false; diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128ba/ChunkProviderRoss128ba.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128ba/ChunkProviderRoss128ba.java index 044737ac9c..2cc84b41ea 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128ba/ChunkProviderRoss128ba.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128ba/ChunkProviderRoss128ba.java @@ -23,6 +23,7 @@ package com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128ba; import com.github.bartimaeusnek.bartworks.util.NoiseUtil.BartsNoise; +import com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128b.ChunkProviderRoss128b; import gregtech.api.objects.XSTR; import micdoodle8.mods.galacticraft.api.prefab.world.gen.MapGenBaseMeta; import micdoodle8.mods.galacticraft.core.blocks.GCBlocks; @@ -30,10 +31,12 @@ import micdoodle8.mods.galacticraft.core.world.gen.BiomeGenBaseMoon; import micdoodle8.mods.galacticraft.core.world.gen.ChunkProviderMoon; import micdoodle8.mods.galacticraft.core.world.gen.MapGenCavesMoon; import net.minecraft.block.Block; +import net.minecraft.block.BlockFalling; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.IChunkProvider; import java.util.Arrays; @@ -66,6 +69,14 @@ public class ChunkProviderRoss128ba extends ChunkProviderMoon { return Chunk; } + @Override + public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) { + super.populate(par1IChunkProvider, par2, par3); + BlockFalling.fallInstantly = true; + ChunkProviderRoss128b.BWOreGen.generate(this.rand, par2, par3, this.worldObj, this, this); + BlockFalling.fallInstantly = false; + } + private int getIndex(int x, int y, int z) { return (x * 16 + z) * 256 + y; } diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/solarsystems/Ross128SolarSystem.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/solarsystems/Ross128SolarSystem.java index 359450c7f9..a4410102a7 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/solarsystems/Ross128SolarSystem.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/solarsystems/Ross128SolarSystem.java @@ -71,15 +71,13 @@ public class Ross128SolarSystem { Ross128SolarSystem.Ross128ba.setDimensionInfo(ConfigHandler.ross128BAID, WorldProviderRoss128Ba.class); Ross128SolarSystem.Ross128ba.setTierRequired(Loader.isModLoaded("galaxyspace") ? Math.min(ConfigHandler.ross128btier + 1, 8) : 3); - //Ross128SolarSystem.Ross128ba.setUnreachable(); - GalaxyRegistry.registerSolarSystem(Ross128SolarSystem.Ross128System); GalaxyRegistry.registerPlanet(Ross128SolarSystem.Ross128b); -// GalaxyRegistry.registerMoon(Ross128SolarSystem.Ross128ba); + GalaxyRegistry.registerMoon(Ross128SolarSystem.Ross128ba); GalacticraftRegistry.registerRocketGui(WorldProviderRoss128b.class, new ResourceLocation(GalacticraftCore.ASSET_PREFIX, "textures/gui/overworldRocketGui.png")); -// GalacticraftRegistry.registerRocketGui(WorldProviderRoss128Ba.class, new ResourceLocation(GalacticraftCore.ASSET_PREFIX, "textures/gui/moonRocketGui.png")); + GalacticraftRegistry.registerRocketGui(WorldProviderRoss128Ba.class, new ResourceLocation(GalacticraftCore.ASSET_PREFIX, "textures/gui/moonRocketGui.png")); GalacticraftRegistry.registerTeleportType(WorldProviderRoss128b.class, new UniversalTeleportType()); -// GalacticraftRegistry.registerTeleportType(WorldProviderRoss128Ba.class, new UniversalTeleportType()); + GalacticraftRegistry.registerTeleportType(WorldProviderRoss128Ba.class, new UniversalTeleportType()); } } |