From 6888617c1b4d6a9836b97e4234ea114ad9bd25bc Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Tue, 16 Apr 2019 00:29:22 +0200 Subject: +added World Generation feature for Ross128b +started on Ross128ba +cleaned up code +started on Werkstoff Liquids +fixed small translation failure Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Former-commit-id: a43cc5cc4ac47e49a27203595c4b8ca841a81a9a --- .../bartimaeusnek/ASM/BWCoreTransformer.java | 4 +- .../bartworks/common/commands/SummonRuin.java | 55 ++++ .../bartworks/common/configs/ConfigHandler.java | 7 +- .../bartworks/neiHandler/BW_NEI_OreHandler.java | 13 +- .../system/material/BW_MetaGenerated_Items.java | 48 +-- .../system/material/BW_MetaGenerated_Ores.java | 4 +- .../bartworks/system/material/Werkstoff.java | 10 + .../bartworks/system/material/WerkstoffLoader.java | 195 +++++++------ .../bartworks/system/oregen/BW_OreLayer.java | 181 ++++++++++++ .../bartworks/system/oregen/BW_WordGenerator.java | 125 ++++++++ .../system/oregen/BW_WorldGenRoss128b.java | 74 +++++ .../system/oregen/BW_WorldGenRoss128ba.java | 54 ++++ .../bartworks/system/worldgen/GT_WorldgenUtil.java | 106 +++++++ .../bartworks/system/worldgen/MapGenRuins.java | 325 +++++++++++++++++++++ .../bartimaeusnek/crossmod/BartWorksCrossmod.java | 6 + .../crossmod/galacticraft/GalacticraftProxy.java | 4 +- .../planets/AbstractWorldProviderSpace.java | 40 +++ .../planets/ross128/world/oregen/BW_OreLayer.java | 150 ---------- .../ross128/world/oregen/BW_WordGenerator.java | 126 -------- .../ross128/world/oregen/BW_WorldGenRoss128.java | 69 ----- .../world/worldprovider/ChunkProviderRoss128b.java | 178 ----------- .../world/worldprovider/SkyProviderRoss128b.java | 33 --- .../world/worldprovider/WorldProviderRoss128b.java | 175 ----------- .../planets/ross128b/ChunkProviderRoss128b.java | 179 ++++++++++++ .../planets/ross128b/SkyProviderRoss128b.java | 33 +++ .../planets/ross128b/WorldProviderRoss128b.java | 163 +++++++++++ .../planets/ross128ba/ChunkProviderRoss128ba.java | 66 +++++ .../planets/ross128ba/WorldProviderRoss128ba.java | 117 ++++++++ .../solarsystems/Ross128SolarSystem.java | 17 +- .../resources/assets/bartworks/lang/en_US.lang | 2 +- 30 files changed, 1686 insertions(+), 873 deletions(-) create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/commands/SummonRuin.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_OreLayer.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WordGenerator.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128b.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128ba.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/system/worldgen/GT_WorldgenUtil.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/system/worldgen/MapGenRuins.java create mode 100644 src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/AbstractWorldProviderSpace.java delete mode 100644 src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_OreLayer.java delete mode 100644 src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WordGenerator.java delete mode 100644 src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WorldGenRoss128.java delete mode 100644 src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/ChunkProviderRoss128b.java delete mode 100644 src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/SkyProviderRoss128b.java delete mode 100644 src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/WorldProviderRoss128b.java create mode 100644 src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/ChunkProviderRoss128b.java create mode 100644 src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/SkyProviderRoss128b.java create mode 100644 src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/WorldProviderRoss128b.java create mode 100644 src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128ba/ChunkProviderRoss128ba.java create mode 100644 src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128ba/WorldProviderRoss128ba.java (limited to 'src/main') diff --git a/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java b/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java index 6a9850e4fe..e56fd65c51 100644 --- a/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java +++ b/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java @@ -143,11 +143,11 @@ 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/ross128/world/worldprovider/WorldProviderRoss128b")); + nu.add(new TypeInsnNode(INSTANCEOF, "com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/WorldProviderRoss128b")); 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;")); - nu.add(new FieldInsnNode(GETSTATIC, "com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/SkyProviderRoss128b", "sunTex", "Lnet/minecraft/util/ResourceLocation;")); + nu.add(new FieldInsnNode(GETSTATIC, "com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/SkyProviderRoss128b", "sunTex", "Lnet/minecraft/util/ResourceLocation;")); nu.add(new MethodInsnNode(INVOKEVIRTUAL, "net/minecraft/client/renderer/texture/TextureManager", useSrc ? bindTexture_src : "bindTexture", "(Lnet/minecraft/util/ResourceLocation;)V", false)); nu.add(new JumpInsnNode(GOTO, LabelNodes[1])); nu.add(LabelNodes[0]); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/commands/SummonRuin.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/commands/SummonRuin.java new file mode 100644 index 0000000000..f569d62abe --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/commands/SummonRuin.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.bartworks.common.commands; + +import com.github.bartimaeusnek.bartworks.system.worldgen.MapGenRuins; +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommandSender; + +public class SummonRuin extends CommandBase { + + @Override + public String getCommandName() { + return "SummonRuin"; + } + + @Override + public String getCommandUsage(ICommandSender p_71518_1_) { + return "SummonRuin x z"; + } + + @Override + public void processCommand(ICommandSender iCommandSender, String[] p_71515_2_) { + try { + new MapGenRuins.RuinsBase().generate( + iCommandSender.getEntityWorld(), + iCommandSender.getEntityWorld().rand, + Integer.parseInt(p_71515_2_[0]), + 256, + Integer.parseInt(p_71515_2_[1]) + ); + }catch (Exception e){ + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java index 3f27a5adcf..6676b242aa 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java @@ -38,7 +38,8 @@ public class ConfigHandler { public static boolean DEHPDirectSteam; public static int megaMachinesMax = 256; public static int mbWaterperSec = 150; - public static int ross128ID = -64; + public static int ross128BID = -64; + public static int ross128BAID = -63; public static boolean Ross128Enabled = true; public static boolean debugLog; public static boolean experimentalThreadedLoader; @@ -68,7 +69,9 @@ public class ConfigHandler { BWCoreTransformer.shouldTransform[i] = ConfigHandler.c.get("ASM fixes", BWCoreTransformer.DESCRIPTIONFORCONFIG[i] + " in class: " + BWCoreTransformer.CLASSESBEEINGTRANSFORMED[i], true).getBoolean(true); } - ConfigHandler.ross128ID = ConfigHandler.c.get("CrossMod Interactions", "DimID - Ross128b", -64, "The Dim ID for Ross128b").getInt(-64); + ConfigHandler.ross128BID = ConfigHandler.c.get("CrossMod Interactions", "DimID - Ross128b", -64, "The Dim ID for Ross128b").getInt(-64); + ConfigHandler.ross128BAID = ConfigHandler.c.get("CrossMod Interactions", "DimID - Ross128ba", -63, "The Dim ID for Ross128ba (Ross128b's Moon)").getInt(-63); + ConfigHandler.Ross128Enabled = ConfigHandler.c.get("CrossMod Interactions", "Galacticraft - Activate Ross128 System", true, "If the Ross128 System should be activated").getBoolean(true); ConfigHandler.setUpComments(); 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 5360268200..1012cffc01 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 @@ -29,10 +29,9 @@ import codechicken.nei.recipe.TemplateRecipeHandler; 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.material.WerkstoffLoader; import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; -import com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.oregen.BW_OreLayer; -import com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.oregen.BW_WorldGenRoss128; +import com.github.bartimaeusnek.bartworks.system.oregen.BW_OreLayer; +import com.github.bartimaeusnek.bartworks.system.oregen.BW_WorldGenRoss128b; import cpw.mods.fml.common.event.FMLInterModComms; import gregtech.api.GregTech_API; import gregtech.api.enums.OrePrefixes; @@ -91,9 +90,9 @@ public class BW_NEI_OreHandler extends TemplateRecipeHandler { public List getOtherStacks() { ArrayList ret = new ArrayList<>(); for (int i = 0; i < BW_OreLayer.sList.size(); i++) { - if (BW_OreLayer.sList.get(i) instanceof BW_WorldGenRoss128) { + if (BW_OreLayer.sList.get(i) instanceof BW_WorldGenRoss128b) { int baseMeta = result.getItemDamage(); - BW_WorldGenRoss128 worldGen = ((BW_WorldGenRoss128) BW_OreLayer.sList.get(i)); + 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")); @@ -187,9 +186,9 @@ public class BW_NEI_OreHandler extends TemplateRecipeHandler { public List getOtherStacks() { ArrayList ret = new ArrayList<>(); for (int i = 0; i < BW_OreLayer.sList.size(); i++) { - if (BW_OreLayer.sList.get(i) instanceof BW_WorldGenRoss128) { + if (BW_OreLayer.sList.get(i) instanceof BW_WorldGenRoss128b) { int baseMeta = result.getItemDamage(); - BW_WorldGenRoss128 worldGen = ((BW_WorldGenRoss128) BW_OreLayer.sList.get(i)); + 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")); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Items.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Items.java index 72db71e58d..d50081c9e9 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Items.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Items.java @@ -76,28 +76,30 @@ public class BW_MetaGenerated_Items extends GT_MetaGenerated_Item { } public boolean onEntityItemUpdate(EntityItem aItemEntity) { - int aDamage = aItemEntity.getEntityItem().getItemDamage(); - if ((aDamage >= 0) && (!aItemEntity.worldObj.isRemote)) { - Werkstoff aMaterial = werkstoffHashMap.get((short) aDamage); - if ((aMaterial != null) && (aMaterial != Werkstoff.default_null_Werkstoff)) { - int tX = MathHelper.floor_double(aItemEntity.posX); - int tY = MathHelper.floor_double(aItemEntity.posY); - int tZ = MathHelper.floor_double(aItemEntity.posZ); - if ((orePrefixes == OrePrefixes.dustImpure) || (orePrefixes == OrePrefixes.dustPure)) { - Block tBlock = aItemEntity.worldObj.getBlock(tX, tY, tZ); - byte tMetaData = (byte) aItemEntity.worldObj.getBlockMetadata(tX, tY, tZ); - if ((tBlock == Blocks.cauldron) && (tMetaData > 0)) { - aItemEntity.setEntityItemStack(WerkstoffLoader.getCorresopndingItemStack(OrePrefixes.dust, aMaterial, aItemEntity.getEntityItem().stackSize)); - aItemEntity.worldObj.setBlockMetadataWithNotify(tX, tY, tZ, tMetaData - 1, 3); - return true; - } - } else if (orePrefixes == OrePrefixes.crushed) { - Block tBlock = aItemEntity.worldObj.getBlock(tX, tY, tZ); - byte tMetaData = (byte) aItemEntity.worldObj.getBlockMetadata(tX, tY, tZ); - if ((tBlock == Blocks.cauldron) && (tMetaData > 0)) { - aItemEntity.setEntityItemStack(WerkstoffLoader.getCorresopndingItemStack(OrePrefixes.crushedPurified, aMaterial, aItemEntity.getEntityItem().stackSize)); - aItemEntity.worldObj.setBlockMetadataWithNotify(tX, tY, tZ, tMetaData - 1, 3); - return true; + if (orePrefixes == OrePrefixes.dustImpure || orePrefixes == OrePrefixes.dustPure || orePrefixes == OrePrefixes.crushed) { + int aDamage = aItemEntity.getEntityItem().getItemDamage(); + if ((aDamage >= 0) && (!aItemEntity.worldObj.isRemote)) { + Werkstoff aMaterial = werkstoffHashMap.get((short) aDamage); + if ((aMaterial != null) && (aMaterial != Werkstoff.default_null_Werkstoff)) { + int tX = MathHelper.floor_double(aItemEntity.posX); + int tY = MathHelper.floor_double(aItemEntity.posY); + int tZ = MathHelper.floor_double(aItemEntity.posZ); + if ((orePrefixes == OrePrefixes.dustImpure) || (orePrefixes == OrePrefixes.dustPure)) { + Block tBlock = aItemEntity.worldObj.getBlock(tX, tY, tZ); + byte tMetaData = (byte) aItemEntity.worldObj.getBlockMetadata(tX, tY, tZ); + if ((tBlock == Blocks.cauldron) && (tMetaData > 0)) { + aItemEntity.setEntityItemStack(WerkstoffLoader.getCorresopndingItemStack(OrePrefixes.dust, aMaterial, aItemEntity.getEntityItem().stackSize)); + aItemEntity.worldObj.setBlockMetadataWithNotify(tX, tY, tZ, tMetaData - 1, 3); + return true; + } + } else if (orePrefixes == OrePrefixes.crushed) { + Block tBlock = aItemEntity.worldObj.getBlock(tX, tY, tZ); + byte tMetaData = (byte) aItemEntity.worldObj.getBlockMetadata(tX, tY, tZ); + if ((tBlock == Blocks.cauldron) && (tMetaData > 0)) { + aItemEntity.setEntityItemStack(WerkstoffLoader.getCorresopndingItemStack(OrePrefixes.crushedPurified, aMaterial, aItemEntity.getEntityItem().stackSize)); + aItemEntity.worldObj.setBlockMetadataWithNotify(tX, tY, tZ, tMetaData - 1, 3); + return true; + } } } } @@ -113,6 +115,8 @@ public class BW_MetaGenerated_Items extends GT_MetaGenerated_Item { if (orePrefixes == OrePrefixes.dustImpure || orePrefixes == OrePrefixes.dustPure) { aList.add(GT_LanguageManager.getTranslation("metaitem.01.tooltip.purify")); } + if (orePrefixes == OrePrefixes.crushed) + aList.add(GT_LanguageManager.getTranslation("metaitem.01.tooltip.purify.2")); aList.add(StatCollector.translateToLocal("tooltip.bw.0.name") + ChatColorHelper.DARKGREEN + " BartWorks"); } 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 fd8e39ebcb..ba03007669 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 @@ -65,7 +65,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) { + public static boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData, boolean air, Block block) { if (!air) { aY = Math.min(aWorld.getActualHeight(), Math.max(aY, 1)); } @@ -76,7 +76,7 @@ public class BW_MetaGenerated_Ores extends BW_TileEntityContainer { return false; } else { - if (!tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone)) { + if (!tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, block)) { return false; } 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 c1bd80e0ea..a681a86270 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 @@ -28,6 +28,7 @@ import com.github.bartimaeusnek.bartworks.util.Pair; import gregtech.api.enums.*; import gregtech.api.interfaces.IColorModulationContainer; import gregtech.api.interfaces.ISubTagContainer; +import gregtech.api.objects.GT_Fluid; import gregtech.api.util.GT_OreDictUnificator; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; @@ -135,6 +136,12 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { this.stats = stats.setMass(tmpmass); this.texSet = texSet; + + if (this.getStats().meltingPoint > 0) { + this.fluid = new GT_Fluid("molten" + this.getDefaultName().replaceAll(" ", ""), "molten.autogenerated", this.getRGBA()); + this.getGenerationFeatures().toGenerate |= 16; + } + Werkstoff.werkstoffHashSet.add(this); Werkstoff.werkstoffHashMap.put(this.mID, this); } @@ -310,6 +317,7 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { metal 10 gem 100 ore 1000 + cell 1000 */ public byte toGenerate = 0b0001001; public byte blacklist; @@ -392,6 +400,8 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { public static class Stats { + public static final int NULL_KELVIN = 0; + int boilingPoint; int meltingPoint; long protons; 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 824435461d..7256b12a43 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 @@ -42,6 +42,7 @@ import gregtech.api.enums.*; import gregtech.api.interfaces.ISubTagContainer; import gregtech.api.objects.GT_MultiTexture; import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; @@ -74,9 +75,9 @@ public class WerkstoffLoader implements Runnable { 1, TextureSet.SET_FLINT, Arrays.asList(Materials.Bismuth), - new Pair(Materials.Bismuth, 2), - new Pair(Materials.Oxygen, 2), - new Pair(Materials.CarbonDioxide, 2) + new Pair<>(Materials.Bismuth, 2), + new Pair<>(Materials.Oxygen, 2), + new Pair<>(Materials.CarbonDioxide, 2) ); public static final Werkstoff Bismuthinit = new Werkstoff( new short[]{192, 192, 192, 0}, @@ -86,8 +87,8 @@ public class WerkstoffLoader implements Runnable { 2, TextureSet.SET_METALLIC, Arrays.asList(Materials.Bismuth, Materials.Sulfur), - new Pair(Materials.Bismuth, 2), - new Pair(Materials.Sulfur, 3) + new Pair<>(Materials.Bismuth, 2), + new Pair<>(Materials.Sulfur, 3) ); public static final Werkstoff Zirconium = new Werkstoff( new short[]{175, 175, 175, 0}, @@ -108,8 +109,8 @@ public class WerkstoffLoader implements Runnable { 4, TextureSet.SET_DIAMOND, Arrays.asList(Zirconium), - new Pair(Zirconium, 1), - new Pair(Materials.Oxygen, 2) + new Pair<>(Zirconium, 1), + new Pair<>(Materials.Oxygen, 2) ); public static final Werkstoff FluorBuergerit = new Werkstoff( new short[]{0x20, 0x20, 0x20, 0}, @@ -120,13 +121,13 @@ public class WerkstoffLoader implements Runnable { 5, TextureSet.SET_RUBY, Arrays.asList(Materials.Sodium, Materials.Boron, Materials.Silicon), - new Pair(Materials.Sodium, 1), - new Pair(Materials.Iron, 3), - new Pair(Materials.Aluminium, 6), - new Pair(Materials.Silicon, 6), - new Pair(Materials.Boron, 3), - new Pair(Materials.Oxygen, 30), - new Pair(Materials.Fluorine, 1) + new Pair<>(Materials.Sodium, 1), + new Pair<>(Materials.Iron, 3), + new Pair<>(Materials.Aluminium, 6), + new Pair<>(Materials.Silicon, 6), + new Pair<>(Materials.Boron, 3), + new Pair<>(Materials.Oxygen, 30), + new Pair<>(Materials.Fluorine, 1) ); public static final Werkstoff YttriumOxide = new Werkstoff( new short[]{255,255,255,0}, @@ -135,8 +136,8 @@ public class WerkstoffLoader implements Runnable { new Werkstoff.GenerationFeatures().onlyDust(), //No autoadd here to gate this material by hand 6, TextureSet.SET_DULL, - new Pair(Materials.Yttrium, 2), - new Pair(Materials.Oxygen, 3) + new Pair<>(Materials.Yttrium, 2), + new Pair<>(Materials.Oxygen, 3) ); public static final Werkstoff ChromoAluminoPovondrait = new Werkstoff( new short[]{0, 0x79, 0x6A, 0}, @@ -148,13 +149,13 @@ public class WerkstoffLoader implements Runnable { 7, TextureSet.SET_RUBY, Arrays.asList(Materials.Sodium, Materials.Boron, Materials.Silicon), - new Pair(Materials.Sodium, 1), - new Pair(Materials.Chrome, 3), - new Pair(Materials.Magnalium, 6), - new Pair(Materials.Silicon, 6), - new Pair(Materials.Boron, 3), - new Pair(Materials.Oxygen, 31), - new Pair(Materials.Hydrogen, 3) + new Pair<>(Materials.Sodium, 1), + new Pair<>(Materials.Chrome, 3), + new Pair<>(Materials.Magnalium, 6), + new Pair<>(Materials.Silicon, 6), + new Pair<>(Materials.Boron, 3), + new Pair<>(Materials.Oxygen, 31), + new Pair<>(Materials.Hydrogen, 3) ); public static final Werkstoff VanadioOxyDravit = new Werkstoff( new short[]{0x60, 0xA0, 0xA0, 0}, @@ -166,13 +167,13 @@ public class WerkstoffLoader implements Runnable { 8, TextureSet.SET_RUBY, Arrays.asList(Materials.Sodium, Materials.Boron, Materials.Silicon), - new Pair(Materials.Sodium, 1), - new Pair(Materials.Vanadium, 3), - new Pair(Materials.Magnalium, 6), - new Pair(Materials.Silicon, 6), - new Pair(Materials.Boron, 3), - new Pair(Materials.Oxygen, 31), - new Pair(Materials.Hydrogen, 3) + new Pair<>(Materials.Sodium, 1), + new Pair<>(Materials.Vanadium, 3), + new Pair<>(Materials.Magnalium, 6), + new Pair<>(Materials.Silicon, 6), + new Pair<>(Materials.Boron, 3), + new Pair<>(Materials.Oxygen, 31), + new Pair<>(Materials.Hydrogen, 3) ); public static final Werkstoff Olenit = new Werkstoff( new short[]{210, 210, 210, 0}, @@ -184,12 +185,12 @@ public class WerkstoffLoader implements Runnable { 9, TextureSet.SET_RUBY, Arrays.asList(Materials.Sodium, Materials.Boron, Materials.Silicon), - new Pair(Materials.Sodium, 1), - new Pair(Materials.Aluminium, 9), - new Pair(Materials.Silicon, 6), - new Pair(Materials.Boron, 3), - new Pair(Materials.Oxygen, 31), - new Pair(Materials.Hydrogen, 1) + new Pair<>(Materials.Sodium, 1), + new Pair<>(Materials.Aluminium, 9), + new Pair<>(Materials.Silicon, 6), + new Pair<>(Materials.Boron, 3), + new Pair<>(Materials.Oxygen, 31), + new Pair<>(Materials.Hydrogen, 1) ); public static final Werkstoff Arsenopyrite = new Werkstoff( new short[]{0xB0, 0xB0, 0xB0, 0}, @@ -199,9 +200,9 @@ public class WerkstoffLoader implements Runnable { 10, TextureSet.SET_METALLIC, Arrays.asList(Materials.Sulfur, Materials.Arsenic, Materials.Iron), - new Pair(Materials.Iron, 1), - new Pair(Materials.Arsenic, 1), - new Pair(Materials.Sulfur, 1) + new Pair<>(Materials.Iron, 1), + new Pair<>(Materials.Arsenic, 1), + new Pair<>(Materials.Sulfur, 1) ); public static final Werkstoff Ferberite = new Werkstoff( new short[]{0xB0, 0xB0, 0xB0, 0}, @@ -211,9 +212,9 @@ public class WerkstoffLoader implements Runnable { 11, TextureSet.SET_METALLIC, Arrays.asList(Materials.Iron, Materials.Tungsten), - new Pair(Materials.Iron, 1), - new Pair(Materials.Tungsten, 1), - new Pair(Materials.Oxygen, 3) + new Pair<>(Materials.Iron, 1), + new Pair<>(Materials.Tungsten, 1), + new Pair<>(Materials.Oxygen, 3) ); public static final Werkstoff Loellingit = new Werkstoff( new short[]{0xD0, 0xD0, 0xD0, 0}, @@ -223,8 +224,8 @@ public class WerkstoffLoader implements Runnable { 12, TextureSet.SET_METALLIC, Arrays.asList(Materials.Iron, Materials.Arsenic), - new Pair(Materials.Iron, 1), - new Pair(Materials.Arsenic, 2) + new Pair<>(Materials.Iron, 1), + new Pair<>(Materials.Arsenic, 2) ); public static final Werkstoff Roquesit = new Werkstoff( new short[]{0xA0, 0xA0, 0xA0, 0}, @@ -234,9 +235,9 @@ public class WerkstoffLoader implements Runnable { 13, TextureSet.SET_METALLIC, Arrays.asList(Materials.Copper, Materials.Sulfur), - new Pair(Materials.Copper, 1), - new Pair(Materials.Indium, 1), - new Pair(Materials.Sulfur, 2) + new Pair<>(Materials.Copper, 1), + new Pair<>(Materials.Indium, 1), + new Pair<>(Materials.Sulfur, 2) ); public static final Werkstoff Bornite = new Werkstoff( new short[]{0x97, 0x66, 0x2B, 0}, @@ -246,9 +247,9 @@ public class WerkstoffLoader implements Runnable { 14, TextureSet.SET_METALLIC, Arrays.asList(Materials.Copper, Materials.Iron, Materials.Sulfur), - new Pair(Materials.Copper, 5), - new Pair(Materials.Iron, 1), - new Pair(Materials.Sulfur, 4) + new Pair<>(Materials.Copper, 5), + new Pair<>(Materials.Iron, 1), + new Pair<>(Materials.Sulfur, 4) ); public static final Werkstoff Wittichenit = new Werkstoff( Materials.Copper.mRGBa, @@ -258,9 +259,9 @@ public class WerkstoffLoader implements Runnable { 15, TextureSet.SET_METALLIC, Arrays.asList(Materials.Copper, Materials.Bismuth, Materials.Sulfur), - new Pair(Materials.Copper, 5), - new Pair(Materials.Bismuth, 1), - new Pair(Materials.Sulfur, 4) + new Pair<>(Materials.Copper, 5), + new Pair<>(Materials.Bismuth, 1), + new Pair<>(Materials.Sulfur, 4) ); public static final Werkstoff Djurleit = new Werkstoff( new short[]{0x60, 0x60, 0x60, 0}, @@ -270,8 +271,8 @@ public class WerkstoffLoader implements Runnable { 16, TextureSet.SET_METALLIC, Arrays.asList(Materials.Copper, Materials.Copper, Materials.Sulfur), - new Pair(Materials.Copper, 31), - new Pair(Materials.Sulfur, 16) + new Pair<>(Materials.Copper, 31), + new Pair<>(Materials.Sulfur, 16) ); public static final Werkstoff Huebnerit = new Werkstoff( new short[]{0x80, 0x60, 0x60, 0}, @@ -281,9 +282,9 @@ public class WerkstoffLoader implements Runnable { 17, TextureSet.SET_METALLIC, Arrays.asList(Materials.Manganese, Materials.Tungsten), - new Pair(Materials.Manganese, 1), - new Pair(Materials.Tungsten, 1), - new Pair(Materials.Oxygen, 3) + new Pair<>(Materials.Manganese, 1), + new Pair<>(Materials.Tungsten, 1), + new Pair<>(Materials.Oxygen, 3) ); public static final Werkstoff Thorianit = new Werkstoff( new short[]{0x30, 0x30, 0x30, 0}, @@ -293,8 +294,8 @@ public class WerkstoffLoader implements Runnable { 18, TextureSet.SET_METALLIC, Arrays.asList(Materials.Thorium), - new Pair(Materials.Thorium, 1), - new Pair(Materials.Oxygen, 2) + new Pair<>(Materials.Thorium, 1), + new Pair<>(Materials.Oxygen, 2) ); public static final Werkstoff RedZircon = new Werkstoff( new short[]{195, 19, 19, 0}, @@ -305,9 +306,9 @@ public class WerkstoffLoader implements Runnable { 19, TextureSet.SET_GEM_VERTICAL, Arrays.asList(Zirconium,Materials.Silicon), - new Pair(Zirconium, 1), - new Pair(Materials.Silicon, 1), - new Pair(Materials.Oxygen, 4) + new Pair<>(Zirconium, 1), + new Pair<>(Materials.Silicon, 1), + new Pair<>(Materials.Oxygen, 4) ); //GT Enhancements @@ -320,7 +321,7 @@ public class WerkstoffLoader implements Runnable { 20, TextureSet.SET_FLINT, Arrays.asList(Materials.RockSalt,Materials.Borax), - new Pair(Materials.Salt, 1) + new Pair<>(Materials.Salt, 1) ); public static final Werkstoff Spodumen = new Werkstoff( Materials.Spodumene.mRGBa, @@ -331,7 +332,7 @@ public class WerkstoffLoader implements Runnable { 21, TextureSet.SET_FLINT, Arrays.asList(Materials.Spodumene), - new Pair(Materials.Spodumene, 1) + new Pair<>(Materials.Spodumene, 1) ); public static final Werkstoff RockSalt = new Werkstoff( Materials.RockSalt.mRGBa, @@ -342,7 +343,7 @@ public class WerkstoffLoader implements Runnable { 22, TextureSet.SET_FLINT, Arrays.asList(Materials.RockSalt,Materials.Borax), - new Pair(Materials.RockSalt, 1) + new Pair<>(Materials.RockSalt, 1) ); public static final Werkstoff Fayalit = new Werkstoff( new short[]{50,50,50,0}, @@ -353,9 +354,9 @@ public class WerkstoffLoader implements Runnable { 23, TextureSet.SET_QUARTZ, Arrays.asList(Materials.Iron,Materials.Silicon), - new Pair(Materials.Iron, 2), - new Pair(Materials.Silicon, 1), - new Pair(Materials.Oxygen, 4) + new Pair<>(Materials.Iron, 2), + new Pair<>(Materials.Silicon, 1), + new Pair<>(Materials.Oxygen, 4) ); public static final Werkstoff Forsterit = new Werkstoff( new short[]{255,255,255,0}, @@ -366,9 +367,9 @@ public class WerkstoffLoader implements Runnable { 24, TextureSet.SET_QUARTZ, Arrays.asList(Materials.Magnesium,Materials.Silicon), - new Pair(Materials.Magnesium, 2), - new Pair(Materials.Silicon, 1), - new Pair(Materials.Oxygen, 4) + new Pair<>(Materials.Magnesium, 2), + new Pair<>(Materials.Silicon, 1), + new Pair<>(Materials.Oxygen, 4) ); public static final Werkstoff Hedenbergit = new Werkstoff( new short[]{100,150,100,0}, @@ -379,10 +380,10 @@ public class WerkstoffLoader implements Runnable { 25, TextureSet.SET_QUARTZ, Arrays.asList(Materials.Iron,Materials.Calcium,Materials.Silicon), - new Pair(Materials.Calcium, 1), - new Pair(Materials.Iron, 1), - new Pair(Materials.Silicon, 2), - new Pair(Materials.Oxygen, 6) + new Pair<>(Materials.Calcium, 1), + new Pair<>(Materials.Iron, 1), + new Pair<>(Materials.Silicon, 2), + new Pair<>(Materials.Oxygen, 6) ); public static final Werkstoff DescloiziteZNVO4 = new Werkstoff( new short[]{0xBF,0x18,0x0F,0}, @@ -393,10 +394,10 @@ public class WerkstoffLoader implements Runnable { 26, TextureSet.SET_QUARTZ, Arrays.asList(Materials.Lead,Materials.Copper,Materials.Vanadium), - new Pair(Materials.Lead, 1), - new Pair(Materials.Zinc, 1), - new Pair(Materials.Vanadium, 1), - new Pair(Materials.Oxygen, 4) + new Pair<>(Materials.Lead, 1), + new Pair<>(Materials.Zinc, 1), + new Pair<>(Materials.Vanadium, 1), + new Pair<>(Materials.Oxygen, 4) ); public static final Werkstoff DescloiziteCUVO4 = new Werkstoff( new short[]{0xf9,0x6d,0x18,0}, @@ -407,10 +408,10 @@ public class WerkstoffLoader implements Runnable { 27, TextureSet.SET_QUARTZ, Arrays.asList(Materials.Lead,Materials.Zinc,Materials.Vanadium), - new Pair(Materials.Lead, 1), - new Pair(Materials.Copper, 1), - new Pair(Materials.Vanadium, 1), - new Pair(Materials.Oxygen, 4) + new Pair<>(Materials.Lead, 1), + new Pair<>(Materials.Copper, 1), + new Pair<>(Materials.Vanadium, 1), + new Pair<>(Materials.Oxygen, 4) ); public static final Werkstoff FuchsitAL = new Werkstoff( new short[]{0x4D,0x7F,0x64,0}, @@ -422,11 +423,11 @@ public class WerkstoffLoader implements Runnable { 28, TextureSet.SET_METALLIC, Arrays.asList(Materials.Potassium,Materials.Aluminium,Materials.Silicon), - new Pair(Materials.Potassium, 1), - new Pair(Materials.Aluminium, 3), - new Pair(Materials.Silicon, 3), - new Pair(Materials.Oxygen, 12), - new Pair(Materials.Hydrogen, 2) + new Pair<>(Materials.Potassium, 1), + new Pair<>(Materials.Aluminium, 3), + new Pair<>(Materials.Silicon, 3), + new Pair<>(Materials.Oxygen, 12), + new Pair<>(Materials.Hydrogen, 2) ); public static final Werkstoff FuchsitCR = new Werkstoff( @@ -439,11 +440,11 @@ public class WerkstoffLoader implements Runnable { 29, TextureSet.SET_METALLIC, Arrays.asList(Materials.Potassium,Materials.Chrome,Materials.Silicon), - new Pair(Materials.Potassium, 1), - new Pair(Materials.Chrome, 3), - new Pair(Materials.Silicon, 3), - new Pair(Materials.Oxygen, 12), - new Pair(Materials.Hydrogen, 2) + new Pair<>(Materials.Potassium, 1), + new Pair<>(Materials.Chrome, 3), + new Pair<>(Materials.Silicon, 3), + new Pair<>(Materials.Oxygen, 12), + new Pair<>(Materials.Hydrogen, 2) ); public static final Werkstoff Thorium232 = new Werkstoff( @@ -477,6 +478,7 @@ public class WerkstoffLoader implements Runnable { public void init() { if (WerkstoffLoader.INSTANCE == null) MainMod.LOGGER.error("INSTANCE IS NULL THIS SHOULD NEVER HAPPEN!"); + GT_LanguageManager.addStringLocalization("metaitem.01.tooltip.purify.2","Throw into Cauldron to get clean crushed Ore"); } public void runInit() { @@ -589,6 +591,11 @@ public class WerkstoffLoader implements Runnable { WerkstoffLoader.items.put(dustPure, new BW_MetaGenerated_Items(dustPure)); WerkstoffLoader.items.put(dustImpure, new BW_MetaGenerated_Items(dustImpure)); } + if ((toGenerateGlobal & 0b10000) != 0) { + WerkstoffLoader.items.put(cell, new BW_MetaGenerated_Items(cell)); + WerkstoffLoader.items.put(bottle, new BW_MetaGenerated_Items(bottle)); + WerkstoffLoader.items.put(capsule, new BW_MetaGenerated_Items(capsule)); + } } public void gameRegistryHandler(){ 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 new file mode 100644 index 0000000000..92f42ad9e0 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_OreLayer.java @@ -0,0 +1,181 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.bartworks.system.oregen; + +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 gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.interfaces.ISubTagContainer; +import gregtech.api.world.GT_Worldgen; +import gregtech.common.blocks.GT_Block_Ores; +import gregtech.common.blocks.GT_TileEntity_Ores; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.chunk.IChunkProvider; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +/** + * Original GT File Stripped and adjusted to work with this mod + */ +public abstract class BW_OreLayer extends GT_Worldgen { + public static final List sList = new ArrayList<>(); + 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 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); + this.mMinY = (short) aMinY; + this.mMaxY = (short) aMaxY; + this.mWeight = (short) aWeight; + this.mDensity = (short) aDensity; + this.mSize = (short) Math.max(1, aSize); + + if (this.mEnabled) + BW_OreLayer.sWeight += this.mWeight; + + if (top instanceof Werkstoff) + this.bwOres = (byte) (this.bwOres | 0b1000); + if (bottom instanceof Werkstoff) + this.bwOres = (byte) (this.bwOres | 0b0100); + if (between instanceof Werkstoff) + this.bwOres = (byte) (this.bwOres | 0b0010); + if (sprinkled instanceof Werkstoff) + this.bwOres = (byte) (this.bwOres | 0b0001); + + short aPrimary = top instanceof Materials ? + (short) ((Materials) top).mMetaItemSubID : + top instanceof Werkstoff ? + ((Werkstoff) top).getmID() : + 0; + short aSecondary = bottom instanceof Materials ? + (short) ((Materials) bottom).mMetaItemSubID : + bottom instanceof Werkstoff ? + ((Werkstoff) bottom).getmID() : + 0; + short aBetween = between instanceof Materials ? + (short) ((Materials) between).mMetaItemSubID : + between instanceof Werkstoff ? + ((Werkstoff) between).getmID() : + 0; + short aSporadic = sprinkled instanceof Materials ? + (short) ((Materials) sprinkled).mMetaItemSubID : + sprinkled instanceof Werkstoff ? + ((Werkstoff) sprinkled).getmID() : + 0; + this.mPrimaryMeta = aPrimary; + this.mSecondaryMeta = aSecondary; + this.mBetweenMeta = aBetween; + this.mSporadicMeta = aSporadic; + + } + + @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); + + for (int tX = cX; tX <= eX; ++tX) { + int cZ = aChunkZ - aRandom.nextInt(this.mSize); + int eZ = aChunkZ + 16 + aRandom.nextInt(this.mSize); + + for (int tZ = cZ; tZ <= eZ; ++tZ) { + int i; + if (this.mSecondaryMeta > 0) { + for (i = tMinY - 1; i < tMinY + 2; ++i) { + if (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0 || aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0) { + this.setOreBlock(aWorld, tX, i, tZ, this.mSecondaryMeta, false); + } + } + } + + if (this.mBetweenMeta > 0 && (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0 || aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0)) { + this.setOreBlock(aWorld, tX, tMinY + 2 + aRandom.nextInt(2), tZ, this.mBetweenMeta, false); + } + + if (this.mPrimaryMeta > 0) { + for (i = tMinY + 3; i < tMinY + 6; ++i) { + if (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0 || aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0) { + this.setOreBlock(aWorld, tX, i, tZ, this.mPrimaryMeta, false); + } + } + } + + if (this.mSporadicMeta > 0 && (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0 || aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0)) { + this.setOreBlock(aWorld, tX, tMinY - 1 + aRandom.nextInt(7), tZ, this.mSporadicMeta, false); + } + } + } + + if (BW_OreLayer.logOregenRoss128) { + MainMod.LOGGER.info("Generated Orevein: " + this.mWorldGenName + " " + aChunkX + " " + aChunkZ); + } + + return true; + } + } + + public boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData, boolean isSmallOre) { + 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, getDefaultBlockToReplace()); + } + return setGTOreBlockSpace(aWorld, aX, aY, aZ, aMetaData, getDefaultBlockToReplace()); + } + + public boolean setGTOreBlockSpace(World aWorld, int aX, int aY, int aZ, int aMetaData, Block block){ + if (!GT_TileEntity_Ores.setOreBlock(aWorld, aX, aY, aZ, aMetaData, false, false)) { + aY = Math.min(aWorld.getActualHeight(), Math.max(aY, 1)); + Block tBlock = aWorld.getBlock(aX, aY, aZ); + Block tOreBlock = GregTech_API.sBlockOres1; + if (aMetaData < 0 || tBlock == Blocks.air) { + return false; + } else { + if (!tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, block)) { + return false; + } + aMetaData += 5000; + aWorld.setBlock(aX, aY, aZ, tOreBlock, aMetaData, 0); + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity instanceof GT_TileEntity_Ores) { + ((GT_TileEntity_Ores) tTileEntity).mMetaData = (short) aMetaData; + } + return true; + } + }else + return true; + } +} 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 new file mode 100644 index 0000000000..907f1eeaff --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WordGenerator.java @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.bartworks.system.oregen; + + +import cpw.mods.fml.common.IWorldGenerator; +import gregtech.api.objects.XSTR; +import gregtech.api.util.GT_Log; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.IChunkProvider; + +import java.util.HashSet; +import java.util.Random; + +/** + * Original GT File Stripped and adjusted to work with this mod + */ +public class BW_WordGenerator implements IWorldGenerator { + + public BW_WordGenerator() { + //GT_NH Override... wont be actually registered to force its generation directly in the ChunkProvider + //GameRegistry.registerWorldGenerator(this, 1073741823); + } + + public synchronized void generate(Random aRandom, int aX, int aZ, World aWorld, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { + new BW_WordGenerator.WorldGenContainer(aX * 16, aZ * 16, aWorld.provider.dimensionId, aWorld, aChunkGenerator, aChunkProvider).run(); + } + + public static class WorldGenContainer implements Runnable { + public static HashSet mGenerated = new HashSet<>(2000); + public final int mDimensionType; + public final World mWorld; + public final IChunkProvider mChunkGenerator; + public final IChunkProvider mChunkProvider; + public int mX; + public int mZ; + + public WorldGenContainer(int aX, int aZ, int aDimensionType, World aWorld, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { + this.mX = aX; + this.mZ = aZ; + this.mDimensionType = aDimensionType; + this.mWorld = aWorld; + this.mChunkGenerator = aChunkGenerator; + this.mChunkProvider = aChunkProvider; + } + + //returns a coordinate of a center chunk of 3x3 square; the argument belongs to this square + public int getVeinCenterCoordinate(int c) { + c += c < 0 ? 1 : 3; + return c - c % 3 - 2; + } + + public boolean surroundingChunksLoaded(int xCenter, int zCenter) { + return this.mWorld.checkChunksExist(xCenter - 16, 0, zCenter - 16, xCenter + 16, 0, zCenter + 16); + } + + public XSTR getRandom(int xChunk, int zChunk) { + long worldSeed = this.mWorld.getSeed(); + XSTR fmlRandom = new XSTR(worldSeed); + long xSeed = fmlRandom.nextLong() >> 2 + 1L; + long zSeed = fmlRandom.nextLong() >> 2 + 1L; + long chunkSeed = (xSeed * xChunk + zSeed * zChunk) ^ worldSeed; + fmlRandom.setSeed(chunkSeed); + return new XSTR(fmlRandom.nextInt()); + } + + public void run() { + int xCenter = this.getVeinCenterCoordinate(this.mX >> 4); + int zCenter = this.getVeinCenterCoordinate(this.mZ >> 4); + Random random = this.getRandom(xCenter, zCenter); + xCenter <<= 4; + zCenter <<= 4; + ChunkCoordIntPair centerChunk = new ChunkCoordIntPair(xCenter, zCenter); + if (!BW_WordGenerator.WorldGenContainer.mGenerated.contains(centerChunk) && this.surroundingChunksLoaded(xCenter, zCenter)) { + BW_WordGenerator.WorldGenContainer.mGenerated.add(centerChunk); + if ((BW_OreLayer.sWeight > 0) && (BW_OreLayer.sList.size() > 0)) { + boolean temp = true; + int tRandomWeight; + for (int i = 0; (i < 256) && (temp); i++) { + tRandomWeight = random.nextInt(BW_OreLayer.sWeight); + for (BW_OreLayer tWorldGen : BW_OreLayer.sList) { + tRandomWeight -= tWorldGen.mWeight; + if (tRandomWeight <= 0) { + try { + if (tWorldGen.executeWorldgen(this.mWorld, random, "", this.mDimensionType, xCenter, zCenter, this.mChunkGenerator, this.mChunkProvider)) { + temp = false; + } + break; + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); + } + } + } + } + } + } + Chunk tChunk = this.mWorld.getChunkFromBlockCoords(this.mX, this.mZ); + if (tChunk != null) { + tChunk.isModified = true; + } + } + } +} 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 new file mode 100644 index 0000000000..a1535ff8f5 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128b.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.bartworks.system.oregen; + +import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; +import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader; +import gregtech.api.enums.Materials; +import gregtech.api.interfaces.ISubTagContainer; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import net.minecraftforge.fluids.FluidRegistry; + +import static com.github.bartimaeusnek.crossmod.galacticraft.GalacticraftProxy.uo_dimensionList; + + +public class BW_WorldGenRoss128b extends BW_OreLayer { + + public Block getDefaultBlockToReplace(){ + return Blocks.stone; + } + + 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() { + new BW_WorldGenRoss128b("ore.mix.ross128.Thorianit", true, 30, 60, 17, 1, 16, WerkstoffLoader.Thorianit, Materials.Uraninite, Materials.Lepidolite, Materials.Spodumene); + new BW_WorldGenRoss128b("ore.mix.ross128.carbon", true, 5, 25, 5, 4, 12, Materials.Graphite, Materials.Diamond, Materials.Coal, Materials.Graphite); + new BW_WorldGenRoss128b("ore.mix.ross128.bismuth", true, 5, 80, 30, 1, 16, WerkstoffLoader.Bismuthinit, Materials.Stibnite, Materials.Bismuth, WerkstoffLoader.Bismutite); + new BW_WorldGenRoss128b("ore.mix.ross128.TurmalinAlkali", true, 5, 200, 15, 4, 48, WerkstoffLoader.Olenit, WerkstoffLoader.FluorBuergerit, WerkstoffLoader.ChromoAluminoPovondrait, WerkstoffLoader.VanadioOxyDravit); + new BW_WorldGenRoss128b("ore.mix.ross128.Roquesit", true, 5, 250, 3, 1, 12, WerkstoffLoader.Arsenopyrite, WerkstoffLoader.Ferberite, WerkstoffLoader.Loellingit, WerkstoffLoader.Roquesit); + new BW_WorldGenRoss128b("ore.mix.ross128.Tungstate", true, 5, 250, 10, 4, 14, WerkstoffLoader.Ferberite, WerkstoffLoader.Huebnerit, WerkstoffLoader.Loellingit, Materials.Scheelite); + new BW_WorldGenRoss128b("ore.mix.ross128.CopperSulfits", true, 40, 70, 80, 3, 24, WerkstoffLoader.Djurleit, WerkstoffLoader.Bornite, WerkstoffLoader.Wittichenit, Materials.Tetrahedrite); + new BW_WorldGenRoss128b("ore.mix.ross128.Forsterit", true, 20, 180, 50, 2, 32, WerkstoffLoader.Forsterit, WerkstoffLoader.Fayalit, WerkstoffLoader.DescloiziteCUVO4, WerkstoffLoader.DescloiziteZNVO4); + new BW_WorldGenRoss128b("ore.mix.ross128.Hedenbergit", true, 20, 180, 50, 2, 32, WerkstoffLoader.Hedenbergit, WerkstoffLoader.Fayalit, WerkstoffLoader.DescloiziteCUVO4, WerkstoffLoader.DescloiziteZNVO4); + new BW_WorldGenRoss128b("ore.mix.ross128.RedZircon", true, 10, 40, 40, 3, 24, WerkstoffLoader.Fayalit,WerkstoffLoader.FuchsitAL , WerkstoffLoader.RedZircon,WerkstoffLoader.FuchsitCR); + } + + public static void init_undergroundFluidsRoss128() { + 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); + uo_dimensionList.SetConfigValues(ross128b, ross128b, "gas_natural_gas", "gas_natural_gas", 0, 625, 65, 5); + + } + + @Override + public boolean isGenerationAllowed(World aWorld, int aDimensionType, int aAllowedDimensionType) { + return aWorld.provider.dimensionId == 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 new file mode 100644 index 0000000000..87158bf01e --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128ba.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.bartworks.system.oregen; + +import gregtech.api.enums.Materials; +import gregtech.api.interfaces.ISubTagContainer; +import gregtech.api.util.GT_ModHandler; +import net.minecraft.block.Block; +import net.minecraft.util.StatCollector; + +import static com.github.bartimaeusnek.crossmod.galacticraft.GalacticraftProxy.uo_dimensionList; + +public class BW_WorldGenRoss128ba extends BW_OreLayer { + + public BW_WorldGenRoss128ba(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); + } + + @Override + public Block getDefaultBlockToReplace() { + return Block.getBlockFromItem(GT_ModHandler.getModItem("galacticraftCore","tile.moonBlock",1).getItem()); + } + + public static void init_OresRoss128ba() { + //none + } + + 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); + + } +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/worldgen/GT_WorldgenUtil.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/worldgen/GT_WorldgenUtil.java new file mode 100644 index 0000000000..8254b44815 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/worldgen/GT_WorldgenUtil.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.bartworks.system.worldgen; + +import gregtech.api.GregTech_API; +import net.minecraft.block.Block; + +import java.util.Random; + +public class GT_WorldgenUtil { + + private GT_WorldgenUtil() {} + + public final static Block GT_TILES = GregTech_API.sBlockMachines; + + public final static short[][] METAFORTIERS_ENERGY = { + {100,101,102,105}, //ULV=HPSteam + {1110,1115,1120,1127}, + {1111,12726,1116,1121,1128}, + {1112,12727,1117,1122,1129}, + {12728,1190,1130,12685}, + {1191,1174,695,12686}, + }; + public final static short[][] METAFORTIERS_BUFFER = { + {5133,5123}, //ULV=HPSteam + {161,171,181,191}, + {162,172,182,192}, + {163,173,183,193}, + {164,174,184,194}, + {165,175,185,195}, + }; + //ULV=HPSteam + public final static short[][] METAFORTIERS_CABLE = { + {5133,5123}, //ULV=HPSteam + {1210,1230,1250,1270,1290}, + {1310,1330,1350,1370,1390}, + {1410,1430,1450,1470,1490}, + {1510,1530,1550,1570,1590}, + {1650,1670,1690}, + }; + public final static short[][] METAFORTIERS_MACHINE = { + {103,104,106,107,109,110,112,113,115,116,118,119}, //ULV=HPSteam + {201,211,221,231,241,251,261,271,281,291,301,311,321,331,341,351,361,371,381,391,401,411,421,431,441,451,461,471,481,491,501,511,521,531,541,551,561,571,581,591,601,611,621,631,641,651,661,671}, + {}, + {}, + {}, + {}, + }; + + private static boolean initialisized = false; + + private static void init(){ + + for (int j = 1; j < 5; j++) { + METAFORTIERS_MACHINE[j+1]=new short[METAFORTIERS_MACHINE[1].length]; + for (int i = 0; i < METAFORTIERS_MACHINE[1].length; i++) { + METAFORTIERS_MACHINE[j+1][i]= (short) (METAFORTIERS_MACHINE[1][i]+j); + } + } + initialisized=true; + } + + public static short getGenerator(Random rand,int tier){ + short meta = METAFORTIERS_ENERGY[tier][rand.nextInt(METAFORTIERS_ENERGY[tier].length)]; + return GregTech_API.METATILEENTITIES[meta] != null ? meta : getGenerator(rand,tier); + } + + public static short getBuffer(Random rand,int tier){ + short meta = METAFORTIERS_BUFFER[tier][rand.nextInt(METAFORTIERS_BUFFER[tier].length)]; + return GregTech_API.METATILEENTITIES[meta] != null ? meta : getBuffer(rand,tier); + } + + public static short getCable(Random rand,int tier){ + short meta = METAFORTIERS_CABLE[tier][rand.nextInt(METAFORTIERS_CABLE[tier].length)]; + return GregTech_API.METATILEENTITIES[meta] != null ? meta : getCable(rand,tier); + } + + public static short getMachine(Random rand,int tier){ + if (!initialisized) + init(); + short meta = METAFORTIERS_MACHINE[tier][rand.nextInt(METAFORTIERS_MACHINE[tier].length)]; + return GregTech_API.METATILEENTITIES[meta] != null ? meta : getMachine(rand,tier); + } + + +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/worldgen/MapGenRuins.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/worldgen/MapGenRuins.java new file mode 100644 index 0000000000..acd948dd19 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/worldgen/MapGenRuins.java @@ -0,0 +1,325 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.bartworks.system.worldgen; + +import com.github.bartimaeusnek.bartworks.util.Pair; +import gregtech.api.GregTech_API; +import gregtech.api.metatileentity.BaseMetaPipeEntity; +import gregtech.api.metatileentity.BaseMetaTileEntity; +import gregtech.api.metatileentity.MetaPipeEntity; +import gregtech.api.objects.XSTR; +import gregtech.api.util.GT_Utility; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.IInventory; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.util.WeightedRandomChestContent; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenerator; +import net.minecraftforge.common.ChestGenHooks; +import net.minecraftforge.common.ForgeHooks; + +import java.util.Random; + +import static net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST; +import static net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST; +import static net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_CHEST; + +public abstract class MapGenRuins extends WorldGenerator { + + protected Pair[][] ToBuildWith = new Pair[4][0]; + + @Override + public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int p_76484_4_, int p_76484_5_) { + return false; + } + + protected void setFloorBlocks(int[] metas, Block... blocks){ + ToBuildWith[0]=new Pair[metas.length]; + for (int i = 0; i < metas.length; i++) { + ToBuildWith[0][i]=new Pair<>(blocks[i%blocks.length],metas[i]); + } + } + + protected void setWallBlocks(int[] metas,Block... blocks){ + ToBuildWith[1]=new Pair[metas.length]; + for (int i = 0; i < metas.length; i++) { + ToBuildWith[1][i]=new Pair<>(blocks[i%blocks.length],metas[i]); + } + } + + protected void setRoofBlocks(int[] metas,Block... blocks){ + ToBuildWith[2]=new Pair[metas.length]; + for (int i = 0; i < metas.length; i++) { + ToBuildWith[2][i]=new Pair<>(blocks[i%blocks.length],metas[i]); + } + } + + protected void setMiscBlocks(int[] metas,Block... blocks){ + ToBuildWith[3]=new Pair[metas.length]; + for (int i = 0; i < metas.length; i++) { + ToBuildWith[3][i]=new Pair<>(blocks[i%blocks.length],metas[i]); + } + } + + int[] statBlocks = new int[4]; + + protected void setRandomBlockWAirChance(World worldObj, int x, int y, int z, Random rand, int airchance, Pair... blocks){ + if (rand.nextInt(100) > airchance) + setRandomBlock(worldObj,x,y,z,rand,blocks); + else + setBlock(worldObj,x,y,z,Blocks.air,0); + } + + protected void setRandomBlock(World worldObj, int x, int y, int z, Random rand, Pair... blocks){ + Block toSet = blocks[rand.nextInt(blocks.length)].getKey(); + int meta = blocks[rand.nextInt(blocks.length)].getValue(); + this.setBlock(worldObj,x,y,z,toSet,meta); + } + + protected void setBlock(World worldObj, int x, int y, int z, Block block,int meta){ + this.setBlockAndNotifyAdequately(worldObj,x,y,z,block,meta); + } + protected void setBlock(World worldObj, int x, int y, int z, Pair pair){ + this.setBlockAndNotifyAdequately(worldObj,x,y,z,pair.getKey(),pair.getValue()); + } + + public static class RuinsBase extends MapGenRuins{ + + @Override + public boolean generate(World worldObj, Random rand1, int x, int y, int z) { + + for (int i = 0; i < rand1.nextInt(144); i++) { + rand1.nextLong(); + } + + Random rand = new XSTR(rand1.nextLong()); + + + x=x+5; + z=z+5; + + if (worldObj.getBlock(x,y,z) == Blocks.air) { + while (worldObj.getBlock(x, y, z) == Blocks.air) { + y--; + } + } else { + while (worldObj.getBlock(x, y, z) != Blocks.air) { + y++; + } + y--; + } + + setFloorBlocks(new int[]{0,0,0},Blocks.brick_block,Blocks.double_stone_slab,Blocks.stonebrick); + setWallBlocks(new int[]{0,1,2,1,1},Blocks.stonebrick); + setRoofBlocks(new int[]{9},Blocks.log); + setMiscBlocks(new int[]{1},Blocks.log); + statBlocks= new int[]{rand.nextInt(ToBuildWith[0].length)}; + int colored=rand.nextInt(15); + int tier = rand.nextInt(6); + boolean useColor = rand.nextBoolean(); + byte set = 0; + byte toSet = (byte) (rand.nextInt(6-tier)+1); + short cablemeta = GT_WorldgenUtil.getCable(rand,tier); + byte treeinaRow = 0; + boolean lastset = rand.nextBoolean(); + for (int dx = -6; dx <= 6; dx++) { + for (int dy = 0; dy <= 8; dy++) { + for (int dz = -6; dz <= 6; dz++) { + this.setBlock(worldObj,x+dx,y+dy,z+dz,Blocks.air,0); + if (dy == 0){ + Pair floor = ToBuildWith[0][statBlocks[0]]; + this.setBlock(worldObj,x+dx,y+dy,z+dz, floor.getKey(),floor.getValue()); + } + else if (dy > 0 && dy < 4){ + if (Math.abs(dx) == 5 && Math.abs(dz) == 5){ + setRandomBlockWAirChance(worldObj,x+dx,y+dy,z+dz,rand,5, ToBuildWith[3][0]); + } + else if ((dx == 0) && dz == -5 && (dy == 1 || dy == 2)){ + if (dy == 1) + this.setBlock(worldObj,x+dx,y+dy,z+dz, Blocks.iron_door,1); + if (dy == 2) + this.setBlock(worldObj,x+dx,y+dy,z+dz, Blocks.iron_door,8); + } + else if (Math.abs(dx)== 5 && Math.abs(dz) < 5 || Math.abs(dz)== 5 && Math.abs(dx) < 5){ + setRandomBlockWAirChance(worldObj,x+dx,y+dy,z+dz,rand,25,ToBuildWith[1]); + if (dy == 2) { + if (rand.nextInt(100)<12) + if (useColor) + setRandomBlockWAirChance(worldObj,x+dx,y+dy,z+dz,rand,25,new Pair<>(Blocks.stained_glass_pane,colored)); + else + setRandomBlockWAirChance(worldObj,x+dx,y+dy,z+dz,rand,25,new Pair<>(Blocks.glass_pane,0)); + } + } + + if (dy == 3 && Math.abs(dx)== 6){ + setRandomBlockWAirChance(worldObj,x+dx,y+dy,z+dz,rand,25,ToBuildWith[2]); + } + + if (dy == 1){ + if (dx == 3 && dz == -3){ + setBlock(worldObj,x + dx, y + dy, z + dz,Blocks.crafting_table,0); + } + if (dx == -3 && (dz == -3 || dz == -2)){ + setBlock(worldObj,x + dx, y + dy, z + dz,Blocks.chest,5); + IInventory chest = (IInventory)worldObj.getTileEntity(x + dx, y + dy, z + dz); + if (chest != null) { + WeightedRandomChestContent.generateChestContents(rand, ChestGenHooks.getItems(PYRAMID_JUNGLE_CHEST, rand), chest, ChestGenHooks.getCount(PYRAMID_JUNGLE_CHEST, rand)); + } + } + + if (dx == 4 && dz==4) { + short meta = GT_WorldgenUtil.getGenerator(rand,tier); + setBlock(worldObj, x + dx, y + dy, z + dz, GT_WorldgenUtil.GT_TILES,GregTech_API.METATILEENTITIES[meta].getTileEntityBaseType()); + BaseMetaTileEntity BTE = (BaseMetaTileEntity) worldObj.getTileEntity(x + dx, y + dy, z + dz); + BTE.setInitialValuesAsNBT(null,meta); + BTE.setOwnerName("Ancient Cultures"); + BTE.setFrontFacing(tier > 0 ? (byte)4 : (byte) 2); + + } + else if (dx == 3 && dz==4) { + if (tier>0) { + short meta = GT_WorldgenUtil.getBuffer(rand, tier); + setBlock(worldObj, x + dx, y + dy, z + dz, GT_WorldgenUtil.GT_TILES, GregTech_API.METATILEENTITIES[meta].getTileEntityBaseType()); + BaseMetaTileEntity BTE = (BaseMetaTileEntity) worldObj.getTileEntity(x + dx, y + dy, z + dz); + BTE.setInitialValuesAsNBT(null, meta); + BTE.setOwnerName("Ancient Cultures"); + BTE.setFrontFacing((byte) 4); + }else{ + short meta = cablemeta; + setRandomBlockWAirChance(worldObj, x + dx, y + dy, z + dz, rand, 33, new Pair(GT_WorldgenUtil.GT_TILES, (int) GregTech_API.METATILEENTITIES[meta].getTileEntityBaseType())); + BaseMetaPipeEntity BTE = (BaseMetaPipeEntity) worldObj.getTileEntity(x + dx, y + dy, z + dz); + if (BTE != null) { + BTE.setInitialValuesAsNBT(null, meta); + BTE.setOwnerName("Ancient Cultures"); + BTE.setFrontFacing((byte) 4); + BTE.mConnections = (byte) (BTE.mConnections | 1 << (byte) 4); + BTE.mConnections = (byte) (BTE.mConnections | 1 << (byte) GT_Utility.getOppositeSide(4)); + ((MetaPipeEntity) BTE.getMetaTileEntity()).mConnections = BTE.mConnections; + } + } + } + else if (dx < 3 && dx > -5 && dz == 4) { + short meta = cablemeta; + setRandomBlockWAirChance(worldObj, x + dx, y + dy, z + dz, rand, 33, new Pair(GT_WorldgenUtil.GT_TILES, (int) GregTech_API.METATILEENTITIES[meta].getTileEntityBaseType())); + + BaseMetaPipeEntity BTE = (BaseMetaPipeEntity) worldObj.getTileEntity(x + dx, y + dy, z + dz); + if (BTE != null) { + BTE.setInitialValuesAsNBT(null, meta); + BTE.setOwnerName("Ancient Cultures"); + BTE.setFrontFacing((byte) 4); + BTE.mConnections = (byte)(BTE.mConnections | 1 << (byte)4); + BTE.mConnections = (byte)(BTE.mConnections | 1 << (byte) GT_Utility.getOppositeSide(4)); + + BaseMetaTileEntity BPE = (BaseMetaTileEntity) worldObj.getTileEntity(x + dx, y + dy, z + dz-1); + if (BPE != null) { + BTE.mConnections = (byte)(BTE.mConnections | 1 << (byte)2); + } + ((MetaPipeEntity)BTE.getMetaTileEntity()).mConnections=BTE.mConnections; + } + + } + else if (dx < 3 && dx > -5 && dz == 3 && set < toSet){ + if (!lastset || treeinaRow > 2) { + short meta = GT_WorldgenUtil.getMachine(rand, tier); + setBlock(worldObj, x + dx, y + dy, z + dz, GT_WorldgenUtil.GT_TILES, GregTech_API.METATILEENTITIES[meta].getTileEntityBaseType()); + BaseMetaTileEntity BTE = (BaseMetaTileEntity) worldObj.getTileEntity(x + dx, y + dy, z + dz); + BTE.setInitialValuesAsNBT(null, meta); + BTE.setOwnerName("Ancient Cultures"); + BTE.setFrontFacing((byte) 2); + + set++; + treeinaRow = 0; + lastset=true; + } + else { + lastset = rand.nextBoolean(); + if (lastset) + treeinaRow++; + } + } + } + } + else if(dy == 4){ + if (Math.abs(dx)== 5) + setRandomBlockWAirChance(worldObj,x+dx,y+dy,z+dz,rand,25,ToBuildWith[2]); + else if (Math.abs(dz) == 5 && Math.abs(dx) < 5) + setRandomBlockWAirChance(worldObj,x+dx,y+dy,z+dz,rand,25,ToBuildWith[1]); + } + else if(dy == 5){ + if (Math.abs(dx)== 4) + setRandomBlockWAirChance(worldObj,x+dx,y+dy,z+dz,rand,25,ToBuildWith[2]); + else if (Math.abs(dz) == 5 && Math.abs(dx) < 4) + setRandomBlockWAirChance(worldObj,x+dx,y+dy,z+dz,rand,25,ToBuildWith[1]); + } + else if(dy == 6){ + if (Math.abs(dx)== 3) + setRandomBlockWAirChance(worldObj,x+dx,y+dy,z+dz,rand,25,ToBuildWith[2]); + else if (Math.abs(dz) == 5 && Math.abs(dx) < 3) + setRandomBlockWAirChance(worldObj,x+dx,y+dy,z+dz,rand,25,ToBuildWith[1]); + } + else if(dy == 7){ + if (Math.abs(dx)== 2) + setRandomBlockWAirChance(worldObj,x+dx,y+dy,z+dz,rand,25,ToBuildWith[2]); + else if (Math.abs(dz) == 5 && Math.abs(dx) < 2) + setRandomBlockWAirChance(worldObj,x+dx,y+dy,z+dz,rand,25,ToBuildWith[1]); + } + else if(dy == 8) { + if (Math.abs(dx) == 1 || Math.abs(dx) == 0) + setRandomBlockWAirChance(worldObj, x + dx, y + dy, z + dz, rand, 25, ToBuildWith[2]); + } + } + } + } + tosetloop: + while (set < toSet){ + int dy = 1; + int dz = 3; + for (int dx = 2; dx > -5; dx--) { + if (set < toSet){ + if (!lastset || treeinaRow > 2 && worldObj.getTileEntity(x + dx, y + dy, z + dz) == null) { + short meta = GT_WorldgenUtil.getMachine(rand, tier); + setBlock(worldObj, x + dx, y + dy, z + dz, GT_WorldgenUtil.GT_TILES, GregTech_API.METATILEENTITIES[meta].getTileEntityBaseType()); + BaseMetaTileEntity BTE = (BaseMetaTileEntity) worldObj.getTileEntity(x + dx, y + dy, z + dz); + BTE.setInitialValuesAsNBT(null, meta); + BTE.setOwnerName("Ancient Cultures"); + BTE.setFrontFacing((byte) 2); + + set++; + treeinaRow = 0; + lastset=true; + } + else { + lastset = rand.nextBoolean(); + if (lastset) + treeinaRow++; + } + }else + break tosetloop; + } + } + return true; + } + } + +} diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java b/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java index cd420afdcb..da78891b8c 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java @@ -22,12 +22,14 @@ package com.github.bartimaeusnek.crossmod; +import com.github.bartimaeusnek.bartworks.common.commands.SummonRuin; import com.github.bartimaeusnek.crossmod.galacticraft.GalacticraftProxy; import com.github.bartimaeusnek.crossmod.thaumcraft.CustomAspects; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.event.FMLServerStartingEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -61,4 +63,8 @@ public class BartWorksCrossmod { GalacticraftProxy.init(init); } + @Mod.EventHandler + public void onFMLServerStart(FMLServerStartingEvent event) { + event.registerServerCommand(new SummonRuin()); + } } 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 c93a698902..a8c9a218b1 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/GalacticraftProxy.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/GalacticraftProxy.java @@ -32,8 +32,8 @@ import net.minecraftforge.common.config.Configuration; import java.io.File; -import static com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.oregen.BW_WorldGenRoss128.init_OresRoss128; -import static com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.oregen.BW_WorldGenRoss128.init_undergroundFluidsRoss128; +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(); diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/AbstractWorldProviderSpace.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/AbstractWorldProviderSpace.java new file mode 100644 index 0000000000..c3b87bf15c --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/AbstractWorldProviderSpace.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.crossmod.galacticraft.planets; + +import micdoodle8.mods.galacticraft.api.prefab.world.gen.WorldProviderSpace; +import micdoodle8.mods.galacticraft.api.world.IExitHeight; +import micdoodle8.mods.galacticraft.api.world.ISolarLevel; + +public abstract class AbstractWorldProviderSpace extends WorldProviderSpace implements IExitHeight, ISolarLevel { + @Override + public boolean canRainOrSnow() { + return false; + } + + @Override + public boolean hasSunset() { + return true; + } + +} diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_OreLayer.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_OreLayer.java deleted file mode 100644 index 4f15b27b60..0000000000 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_OreLayer.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 2019 bartimaeusnek - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.oregen; - -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 gregtech.api.enums.Materials; -import gregtech.api.interfaces.ISubTagContainer; -import gregtech.api.world.GT_Worldgen; -import gregtech.common.blocks.GT_TileEntity_Ores; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; -import net.minecraft.world.chunk.IChunkProvider; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -/** - * Original GT File Stripped and adjusted to work with this mod - */ -public class BW_OreLayer extends GT_Worldgen { - public static final List sList = new ArrayList<>(); - 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 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); - this.mMinY = (short) aMinY; - this.mMaxY = (short) aMaxY; - this.mWeight = (short) aWeight; - this.mDensity = (short) aDensity; - this.mSize = (short) Math.max(1, aSize); - - if (this.mEnabled) - BW_OreLayer.sWeight += this.mWeight; - - if (top instanceof Werkstoff) - this.bwOres = (byte) (this.bwOres | 0b1000); - if (bottom instanceof Werkstoff) - this.bwOres = (byte) (this.bwOres | 0b0100); - if (between instanceof Werkstoff) - this.bwOres = (byte) (this.bwOres | 0b0010); - if (sprinkled instanceof Werkstoff) - this.bwOres = (byte) (this.bwOres | 0b0001); - - short aPrimary = top instanceof Materials ? - (short) ((Materials) top).mMetaItemSubID : - top instanceof Werkstoff ? - ((Werkstoff) top).getmID() : - 0; - short aSecondary = bottom instanceof Materials ? - (short) ((Materials) bottom).mMetaItemSubID : - bottom instanceof Werkstoff ? - ((Werkstoff) bottom).getmID() : - 0; - short aBetween = between instanceof Materials ? - (short) ((Materials) between).mMetaItemSubID : - between instanceof Werkstoff ? - ((Werkstoff) between).getmID() : - 0; - short aSporadic = sprinkled instanceof Materials ? - (short) ((Materials) sprinkled).mMetaItemSubID : - sprinkled instanceof Werkstoff ? - ((Werkstoff) sprinkled).getmID() : - 0; - this.mPrimaryMeta = aPrimary; - this.mSecondaryMeta = aSecondary; - this.mBetweenMeta = aBetween; - this.mSporadicMeta = aSporadic; - - } - - @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); - - for (int tX = cX; tX <= eX; ++tX) { - int cZ = aChunkZ - aRandom.nextInt(this.mSize); - int eZ = aChunkZ + 16 + aRandom.nextInt(this.mSize); - - for (int tZ = cZ; tZ <= eZ; ++tZ) { - int i; - if (this.mSecondaryMeta > 0) { - for (i = tMinY - 1; i < tMinY + 2; ++i) { - if (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0 || aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0) { - this.setOreBlock(aWorld, tX, i, tZ, this.mSecondaryMeta, false); - } - } - } - - if (this.mBetweenMeta > 0 && (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0 || aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0)) { - this.setOreBlock(aWorld, tX, tMinY + 2 + aRandom.nextInt(2), tZ, this.mBetweenMeta, false); - } - - if (this.mPrimaryMeta > 0) { - for (i = tMinY + 3; i < tMinY + 6; ++i) { - if (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0 || aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0) { - this.setOreBlock(aWorld, tX, i, tZ, this.mPrimaryMeta, false); - } - } - } - - if (this.mSporadicMeta > 0 && (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0 || aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0)) { - this.setOreBlock(aWorld, tX, tMinY - 1 + aRandom.nextInt(7), tZ, this.mSporadicMeta, false); - } - } - } - - if (BW_OreLayer.logOregenRoss128) { - MainMod.LOGGER.info("Generated Orevein: " + this.mWorldGenName + " " + aChunkX + " " + aChunkZ); - } - - return true; - } - } - - public boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData, boolean isSmallOre) { - 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); - } - return GT_TileEntity_Ores.setOreBlock(aWorld, aX, aY, aZ, aMetaData, isSmallOre, false); - } -} diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WordGenerator.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WordGenerator.java deleted file mode 100644 index 36e017d626..0000000000 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WordGenerator.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2019 bartimaeusnek - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.oregen; - - -import cpw.mods.fml.common.IWorldGenerator; -import gregtech.api.objects.XSTR; -import gregtech.api.util.GT_Log; -import gregtech.api.world.GT_Worldgen; -import net.minecraft.world.ChunkCoordIntPair; -import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.chunk.IChunkProvider; - -import java.util.HashSet; -import java.util.Random; - -/** - * Original GT File Stripped and adjusted to work with this mod - */ -public class BW_WordGenerator implements IWorldGenerator { - - public BW_WordGenerator() { - //GT_NH Override... wont be actually registered to force its generation directly in the ChunkProvider - //GameRegistry.registerWorldGenerator(this, 1073741823); - } - - public synchronized void generate(Random aRandom, int aX, int aZ, World aWorld, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { - new BW_WordGenerator.WorldGenContainer(aX * 16, aZ * 16, aWorld.provider.dimensionId, aWorld, aChunkGenerator, aChunkProvider).run(); - } - - public static class WorldGenContainer implements Runnable { - public static HashSet mGenerated = new HashSet<>(2000); - public final int mDimensionType; - public final World mWorld; - public final IChunkProvider mChunkGenerator; - public final IChunkProvider mChunkProvider; - public int mX; - public int mZ; - - public WorldGenContainer(int aX, int aZ, int aDimensionType, World aWorld, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { - this.mX = aX; - this.mZ = aZ; - this.mDimensionType = aDimensionType; - this.mWorld = aWorld; - this.mChunkGenerator = aChunkGenerator; - this.mChunkProvider = aChunkProvider; - } - - //returns a coordinate of a center chunk of 3x3 square; the argument belongs to this square - public int getVeinCenterCoordinate(int c) { - c += c < 0 ? 1 : 3; - return c - c % 3 - 2; - } - - public boolean surroundingChunksLoaded(int xCenter, int zCenter) { - return this.mWorld.checkChunksExist(xCenter - 16, 0, zCenter - 16, xCenter + 16, 0, zCenter + 16); - } - - public XSTR getRandom(int xChunk, int zChunk) { - long worldSeed = this.mWorld.getSeed(); - XSTR fmlRandom = new XSTR(worldSeed); - long xSeed = fmlRandom.nextLong() >> 2 + 1L; - long zSeed = fmlRandom.nextLong() >> 2 + 1L; - long chunkSeed = (xSeed * xChunk + zSeed * zChunk) ^ worldSeed; - fmlRandom.setSeed(chunkSeed); - return new XSTR(fmlRandom.nextInt()); - } - - public void run() { - int xCenter = this.getVeinCenterCoordinate(this.mX >> 4); - int zCenter = this.getVeinCenterCoordinate(this.mZ >> 4); - Random random = this.getRandom(xCenter, zCenter); - xCenter <<= 4; - zCenter <<= 4; - ChunkCoordIntPair centerChunk = new ChunkCoordIntPair(xCenter, zCenter); - if (!BW_WordGenerator.WorldGenContainer.mGenerated.contains(centerChunk) && this.surroundingChunksLoaded(xCenter, zCenter)) { - BW_WordGenerator.WorldGenContainer.mGenerated.add(centerChunk); - if ((BW_OreLayer.sWeight > 0) && (BW_OreLayer.sList.size() > 0)) { - boolean temp = true; - int tRandomWeight; - for (int i = 0; (i < 256) && (temp); i++) { - tRandomWeight = random.nextInt(BW_OreLayer.sWeight); - for (BW_OreLayer tWorldGen : BW_OreLayer.sList) { - tRandomWeight -= tWorldGen.mWeight; - if (tRandomWeight <= 0) { - try { - if (tWorldGen.executeWorldgen(this.mWorld, random, "", this.mDimensionType, xCenter, zCenter, this.mChunkGenerator, this.mChunkProvider)) { - temp = false; - } - break; - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); - } - } - } - } - } - } - Chunk tChunk = this.mWorld.getChunkFromBlockCoords(this.mX, this.mZ); - if (tChunk != null) { - tChunk.isModified = true; - } - } - } -} diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WorldGenRoss128.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WorldGenRoss128.java deleted file mode 100644 index 46a5fd07e2..0000000000 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WorldGenRoss128.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2019 bartimaeusnek - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.oregen; - -import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; -import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader; -import gregtech.api.enums.Materials; -import gregtech.api.interfaces.ISubTagContainer; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import net.minecraftforge.fluids.FluidRegistry; - -import static com.github.bartimaeusnek.crossmod.galacticraft.GalacticraftProxy.uo_dimensionList; - - -public class BW_WorldGenRoss128 extends BW_OreLayer { - - - public BW_WorldGenRoss128(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() { - new BW_WorldGenRoss128("ore.mix.ross128.Thorianit", true, 30, 60, 17, 1, 16, WerkstoffLoader.Thorianit, Materials.Uraninite, Materials.Lepidolite, Materials.Spodumene); - new BW_WorldGenRoss128("ore.mix.ross128.carbon", true, 5, 25, 5, 4, 12, Materials.Graphite, Materials.Diamond, Materials.Coal, Materials.Graphite); - new BW_WorldGenRoss128("ore.mix.ross128.bismuth", true, 5, 80, 30, 1, 16, WerkstoffLoader.Bismuthinit, Materials.Stibnite, Materials.Bismuth, WerkstoffLoader.Bismutite); - new BW_WorldGenRoss128("ore.mix.ross128.TurmalinAlkali", true, 5, 200, 15, 4, 48, WerkstoffLoader.Olenit, WerkstoffLoader.FluorBuergerit, WerkstoffLoader.ChromoAluminoPovondrait, WerkstoffLoader.VanadioOxyDravit); - new BW_WorldGenRoss128("ore.mix.ross128.Roquesit", true, 5, 250, 3, 1, 12, WerkstoffLoader.Arsenopyrite, WerkstoffLoader.Ferberite, WerkstoffLoader.Loellingit, WerkstoffLoader.Roquesit); - new BW_WorldGenRoss128("ore.mix.ross128.Tungstate", true, 5, 250, 10, 4, 14, WerkstoffLoader.Ferberite, WerkstoffLoader.Huebnerit, WerkstoffLoader.Loellingit, Materials.Scheelite); - new BW_WorldGenRoss128("ore.mix.ross128.CopperSulfits", true, 40, 70, 80, 3, 24, WerkstoffLoader.Djurleit, WerkstoffLoader.Bornite, WerkstoffLoader.Wittichenit, Materials.Tetrahedrite); - new BW_WorldGenRoss128("ore.mix.ross128.Forsterit", true, 20, 180, 50, 2, 32, WerkstoffLoader.Forsterit, WerkstoffLoader.Fayalit, WerkstoffLoader.DescloiziteCUVO4, WerkstoffLoader.DescloiziteZNVO4); - new BW_WorldGenRoss128("ore.mix.ross128.Hedenbergit", true, 20, 180, 50, 2, 32, WerkstoffLoader.Hedenbergit, WerkstoffLoader.Fayalit, WerkstoffLoader.DescloiziteCUVO4, WerkstoffLoader.DescloiziteZNVO4); - new BW_WorldGenRoss128("ore.mix.ross128.RedZircon", true, 10, 40, 40, 3, 24, WerkstoffLoader.Fayalit,WerkstoffLoader.FuchsitAL , WerkstoffLoader.RedZircon,WerkstoffLoader.FuchsitCR); - } - - public static void init_undergroundFluidsRoss128() { - 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); - uo_dimensionList.SetConfigValues(ross128b, ross128b, "gas_natural_gas", "gas_natural_gas", 0, 625, 65, 5); - - } - - @Override - public boolean isGenerationAllowed(World aWorld, int aDimensionType, int aAllowedDimensionType) { - return aWorld.provider.dimensionId == ConfigHandler.ross128ID; - } - -} diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/ChunkProviderRoss128b.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/ChunkProviderRoss128b.java deleted file mode 100644 index 956810dd7f..0000000000 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/ChunkProviderRoss128b.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2019 bartimaeusnek - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.worldprovider; - -import com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.oregen.BW_WordGenerator; -import com.github.bartimaeusnek.crossmod.thaumcraft.util.ThaumcraftHandler; -import cpw.mods.fml.common.Loader; -import gregtech.api.objects.XSTR; -import net.minecraft.block.Block; -import net.minecraft.block.BlockFalling; -import net.minecraft.entity.EnumCreatureType; -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 net.minecraft.world.gen.ChunkProviderGenerate; -import net.minecraft.world.gen.MapGenBase; -import net.minecraft.world.gen.MapGenCaves; -import net.minecraft.world.gen.MapGenRavine; -import net.minecraft.world.gen.feature.WorldGenLakes; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.terraingen.PopulateChunkEvent; -import net.minecraftforge.event.terraingen.TerrainGen; - -import java.util.List; - -import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE; -import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE; - -public class ChunkProviderRoss128b extends ChunkProviderGenerate { - XSTR rand = new XSTR(); - private BiomeGenBase[] biomesForGeneration; - private BW_WordGenerator BWOreGen = new BW_WordGenerator(); - private World worldObj; - private MapGenBase caveGenerator = new MapGenCaves(); - private MapGenBase ravineGenerator = new MapGenRavine(); - - public ChunkProviderRoss128b(World par1World, long seed, boolean mapFeaturesEnabled) { - super(par1World, seed, mapFeaturesEnabled); - worldObj = par1World; - } - - @Override - public List getPossibleCreatures(EnumCreatureType p_73155_1_, int p_73155_2_, int p_73155_3_, int p_73155_4_) { - return null; - } - - public Chunk provideChunk(int p_73154_1_, int p_73154_2_) { - this.rand.setSeed((long) p_73154_1_ * 341873128712L + (long) p_73154_2_ * 132897987541L); - Block[] ablock = new Block[65536]; - byte[] abyte = new byte[65536]; - this.func_147424_a(p_73154_1_, p_73154_2_, ablock); - this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, p_73154_1_ * 16, p_73154_2_ * 16, 16, 16); - for (int i = 0; i < biomesForGeneration.length; i++) { - BiomeGenBase biomeGenBase = biomesForGeneration[i]; - if (biomeGenBase.biomeID == BiomeGenBase.mushroomIsland.biomeID) { - this.biomesForGeneration[i] = BiomeGenBase.taiga; - } else if (biomeGenBase.biomeID == BiomeGenBase.mushroomIslandShore.biomeID) { - this.biomesForGeneration[i] = BiomeGenBase.stoneBeach; - } - if (Loader.isModLoaded("Thaumcraft")) { - if (ThaumcraftHandler.isTaintBiome(biomeGenBase.biomeID)) - this.biomesForGeneration[i] = BiomeGenBase.taiga; - } - } - this.replaceBlocksForBiome(p_73154_1_, p_73154_2_, ablock, abyte, this.biomesForGeneration); - this.caveGenerator.func_151539_a(this, this.worldObj, p_73154_1_, p_73154_2_, ablock); - this.ravineGenerator.func_151539_a(this, this.worldObj, p_73154_1_, p_73154_2_, ablock); - - Chunk chunk = new Chunk(this.worldObj, ablock, abyte, p_73154_1_, p_73154_2_); - byte[] abyte1 = chunk.getBiomeArray(); - - for (int k = 0; k < abyte1.length; ++k) { - abyte1[k] = (byte) this.biomesForGeneration[k].biomeID; - } - - chunk.generateSkylightMap(); - return chunk; - } - - @Override - public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) { - BlockFalling.fallInstantly = true; - int k = p_73153_2_ * 16; - int l = p_73153_3_ * 16; - BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16); - this.rand.setSeed(this.worldObj.getSeed()); - if (p_73153_2_ % 4 == 0 || p_73153_3_ % 4 == 0) { - long i1 = this.rand.nextLong() / 2L * 2L + 1L; - long j1 = this.rand.nextLong() / 2L * 2L + 1L; - this.rand.setSeed((long) p_73153_2_ * i1 + (long) p_73153_3_ * j1 ^ this.worldObj.getSeed()); - } - boolean flag = false; - - MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag)); - - int k1; - int l1; - int i2; - - if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && !flag && this.rand.nextInt(4) == 0 - && TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, LAKE)) { - k1 = k + this.rand.nextInt(16) + 8; - l1 = this.rand.nextInt(256); - i2 = l + this.rand.nextInt(16) + 8; - (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, k1, l1, i2); - } - - biomegenbase.decorate(this.worldObj, this.rand, k, l); - - k += 8; - l += 8; - - boolean doGen = TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, ICE); - for (k1 = 0; doGen && k1 < 16; ++k1) { - for (l1 = 0; l1 < 16; ++l1) { - i2 = this.worldObj.getPrecipitationHeight(k + k1, l + l1); - - if (this.worldObj.isBlockFreezable(k1 + k, i2 - 1, l1 + l)) { - this.worldObj.setBlock(k1 + k, i2 - 1, l1 + l, Blocks.ice, 0, 2); - } - - if (this.worldObj.func_147478_e(k1 + k, i2, l1 + l, true)) { - this.worldObj.setBlock(k1 + k, i2, l1 + l, Blocks.snow_layer, 0, 2); - } - } - } - MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag)); - - BWOreGen.generate(rand, p_73153_2_, p_73153_3_, worldObj, this, this); - - BlockFalling.fallInstantly = false; - } - - @Override - public void recreateStructures(int p_82695_1_, int p_82695_2_) { - } - - @Override - public void replaceBlocksForBiome(int p_147422_1_, int p_147422_2_, Block[] blocks, byte[] metas, BiomeGenBase[] p_147422_5_) { - super.replaceBlocksForBiome(p_147422_1_, p_147422_2_, blocks, metas, p_147422_5_); - for (int i = 0; i < blocks.length; i++) { -// if (blocks[i] == Blocks.stone) { -// blocks[i] = Ross128.Ross128bStone.getBlock(); -// metas[i] = Ross128.Ross128bStone.getMetadata(); -// }else - if (blocks[i] == Blocks.grass) { - blocks[i] = Blocks.dirt; - metas[i] = 2; - } -// else if (blocks[i] == Blocks.dirt) { -// blocks[i] = Ross128.Ross128bDirt.getBlock(); -// metas[i] = Ross128.Ross128bDirt.getMetadata(); -// } - } - } -} diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/SkyProviderRoss128b.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/SkyProviderRoss128b.java deleted file mode 100644 index c6785ee78b..0000000000 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/SkyProviderRoss128b.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2019 bartimaeusnek - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.worldprovider; - -import com.github.bartimaeusnek.crossmod.BartWorksCrossmod; -import micdoodle8.mods.galacticraft.core.client.SkyProviderOverworld; -import net.minecraft.util.ResourceLocation; - -public class SkyProviderRoss128b extends SkyProviderOverworld { - - //ASM enables this texture - public static final ResourceLocation sunTex = new ResourceLocation(BartWorksCrossmod.MOD_ID + ":galacticraft/Ross128b/World/SunRoss128.png"); -} diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/WorldProviderRoss128b.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/WorldProviderRoss128b.java deleted file mode 100644 index 9b2b9fc75a..0000000000 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/worldprovider/WorldProviderRoss128b.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2019 bartimaeusnek - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.worldprovider; - -import com.github.bartimaeusnek.crossmod.galacticraft.solarsystems.Ross128SolarSystem; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import micdoodle8.mods.galacticraft.api.galaxies.CelestialBody; -import micdoodle8.mods.galacticraft.api.prefab.world.gen.WorldProviderSpace; -import micdoodle8.mods.galacticraft.api.vector.Vector3; -import micdoodle8.mods.galacticraft.api.world.IExitHeight; -import micdoodle8.mods.galacticraft.api.world.ISolarLevel; -import net.minecraft.util.MathHelper; -import net.minecraft.util.Vec3; -import net.minecraft.world.biome.WorldChunkManager; -import net.minecraft.world.chunk.IChunkProvider; - -public class WorldProviderRoss128b extends WorldProviderSpace implements IExitHeight, ISolarLevel { - - @Override - public boolean canRespawnHere() { - return true; - } - - @SideOnly(Side.CLIENT) - public Vec3 getFogColor(float cy, float noidea) { - float angle = MathHelper.cos(cy * (float) Math.PI * 2.0F) * 2.0F + 0.5F; - - if (angle < 0.0F) { - angle = 0.0F; - } - - if (angle > 1.0F) { - angle = 1.0F; - } - - float red = 200 / 255f; - float green = 80 / 255f; - float blue = 0.0F; - red *= angle * 0.94F + 0.06F; - green *= angle * 0.94F + 0.06F; - return Vec3.createVectorHelper((double) red, (double) green, (double) blue); - } - - - @Override - public Vector3 getFogColor() { - //unused - return null; - } - - @Override - public float getSunBrightness(float par1) { - return super.getSunBrightness(par1) * 0.975f; - } - - @Override - public float calculateCelestialAngle(long par1, float par3) { - return super.calculateCelestialAngle(par1, par3); - } - - @Override - public Vector3 getSkyColor() { - float red = 200 / 255f; - float green = 120 / 255f; - float blue = 0.0F; - return new Vector3(red, green, blue); - } - - @Override - public boolean canRainOrSnow() { - return false; - } - - @Override - public boolean hasSunset() { - return true; - } - - @Override - public long getDayLength() { - return (long) (24000 * 9.9f); - } - - @Override - public Class getChunkProviderClass() { - return ChunkProviderRoss128b.class; - } - - @Override - public Class getWorldChunkManagerClass() { - return WorldChunkManager.class; - } - - @Override - public float getGravity() { - return -0.0035F; - } - - @Override - public double getMeteorFrequency() { - return 0D; - } - - @Override - public double getFuelUsageMultiplier() { - return 1.35D; - } - - @Override - public boolean canSpaceshipTierPass(int tier) { - return Ross128SolarSystem.Ross128b.getTierRequirement() <= tier; - } - - @Override - public float getFallDamageModifier() { - return 1.35F; - } - - @Override - public float getSoundVolReductionAmount() { - return 1F; - } - - @Override - public float getThermalLevelModifier() { - return 0.01f; - } - - @Override - public float getWindLevel() { - return 1.35f; - } - - @Override - public CelestialBody getCelestialBody() { - return Ross128SolarSystem.Ross128b; - } - - @Override - public double getYCoordinateToTeleport() { - return 500D; - } - - @Override - public double getSolarEnergyMultiplier() { - return 1.38D; - } - - @Override - public boolean hasBreathableAtmosphere() { - return true; - } - -} 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 new file mode 100644 index 0000000000..0e7f7e28d1 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/ChunkProviderRoss128b.java @@ -0,0 +1,179 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128b; + +import com.github.bartimaeusnek.bartworks.system.oregen.BW_WordGenerator; +import com.github.bartimaeusnek.bartworks.system.worldgen.MapGenRuins; +import com.github.bartimaeusnek.crossmod.thaumcraft.util.ThaumcraftHandler; +import cpw.mods.fml.common.Loader; +import gregtech.api.objects.XSTR; +import net.minecraft.block.Block; +import net.minecraft.block.BlockFalling; +import net.minecraft.entity.EnumCreatureType; +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 net.minecraft.world.gen.ChunkProviderGenerate; +import net.minecraft.world.gen.MapGenBase; +import net.minecraft.world.gen.MapGenCaves; +import net.minecraft.world.gen.MapGenRavine; +import net.minecraft.world.gen.feature.WorldGenLakes; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.terraingen.PopulateChunkEvent; +import net.minecraftforge.event.terraingen.TerrainGen; + +import java.util.List; + +import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE; +import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE; + +public class ChunkProviderRoss128b extends ChunkProviderGenerate { + XSTR rand = new XSTR(); + private BiomeGenBase[] biomesForGeneration; + private BW_WordGenerator BWOreGen = new BW_WordGenerator(); + private World worldObj; + private MapGenBase caveGenerator = new MapGenCaves(); + private MapGenBase ravineGenerator = new MapGenRavine(); + private MapGenRuins.RuinsBase ruinsBase = new MapGenRuins.RuinsBase(); + + public ChunkProviderRoss128b(World par1World, long seed, boolean mapFeaturesEnabled) { + super(par1World, seed, mapFeaturesEnabled); + worldObj = par1World; + } + + @Override + public List getPossibleCreatures(EnumCreatureType p_73155_1_, int p_73155_2_, int p_73155_3_, int p_73155_4_) { + return null; + } + + public Chunk provideChunk(int p_73154_1_, int p_73154_2_) { + this.rand.setSeed((long) p_73154_1_ * 341873128712L + (long) p_73154_2_ * 132897987541L); + Block[] ablock = new Block[65536]; + byte[] abyte = new byte[65536]; + this.func_147424_a(p_73154_1_, p_73154_2_, ablock); + this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, p_73154_1_ * 16, p_73154_2_ * 16, 16, 16); + for (int i = 0; i < biomesForGeneration.length; i++) { + BiomeGenBase biomeGenBase = biomesForGeneration[i]; + if (biomeGenBase.biomeID == BiomeGenBase.mushroomIsland.biomeID) { + this.biomesForGeneration[i] = BiomeGenBase.taiga; + } else if (biomeGenBase.biomeID == BiomeGenBase.mushroomIslandShore.biomeID) { + this.biomesForGeneration[i] = BiomeGenBase.stoneBeach; + } + if (Loader.isModLoaded("Thaumcraft")) { + if (ThaumcraftHandler.isTaintBiome(biomeGenBase.biomeID)) + this.biomesForGeneration[i] = BiomeGenBase.taiga; + } + } + this.replaceBlocksForBiome(p_73154_1_, p_73154_2_, ablock, abyte, this.biomesForGeneration); + this.caveGenerator.func_151539_a(this, this.worldObj, p_73154_1_, p_73154_2_, ablock); + this.ravineGenerator.func_151539_a(this, this.worldObj, p_73154_1_, p_73154_2_, ablock); + + Chunk chunk = new Chunk(this.worldObj, ablock, abyte, p_73154_1_, p_73154_2_); + byte[] abyte1 = chunk.getBiomeArray(); + + for (int k = 0; k < abyte1.length; ++k) { + abyte1[k] = (byte) this.biomesForGeneration[k].biomeID; + } + + chunk.generateSkylightMap(); + return chunk; + } + + @Override + public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) { + BlockFalling.fallInstantly = true; + int k = p_73153_2_ * 16; + int l = p_73153_3_ * 16; + BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16); + this.rand.setSeed(this.worldObj.getSeed()); + if (p_73153_2_ % 4 == 0 || p_73153_3_ % 4 == 0) { + long i1 = this.rand.nextLong() / 2L * 2L + 1L; + long j1 = this.rand.nextLong() / 2L * 2L + 1L; + this.rand.setSeed((long) p_73153_2_ * i1 + (long) p_73153_3_ * j1 ^ this.worldObj.getSeed()); + } + + MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, false)); + + int x1; + int y1; + int z1; + + if (biomegenbase != BiomeGenBase.ocean && biomegenbase != BiomeGenBase.deepOcean && biomegenbase != BiomeGenBase.river && biomegenbase != BiomeGenBase.frozenOcean && biomegenbase != BiomeGenBase.frozenRiver + && this.rand.nextInt(512) == 0) { + x1 = k + this.rand.nextInt(16) + 3; + y1 = this.rand.nextInt(256); + z1 = l + this.rand.nextInt(16) + 3; + ruinsBase.generate(worldObj, rand, x1, y1, z1); + } + + if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && this.rand.nextInt(4) == 0 + && TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, false, LAKE)) { + x1 = k + this.rand.nextInt(16) + 8; + y1 = this.rand.nextInt(256); + z1 = l + this.rand.nextInt(16) + 8; + (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, x1, y1, z1); + } + + biomegenbase.decorate(this.worldObj, this.rand, k, l); + + k += 8; + l += 8; + + boolean doGen = TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, false, ICE); + for (x1 = 0; doGen && x1 < 16; ++x1) { + for (y1 = 0; y1 < 16; ++y1) { + z1 = this.worldObj.getPrecipitationHeight(k + x1, l + y1); + + if (this.worldObj.isBlockFreezable(x1 + k, z1 - 1, y1 + l)) { + this.worldObj.setBlock(x1 + k, z1 - 1, y1 + l, Blocks.ice, 0, 2); + } + + if (this.worldObj.func_147478_e(x1 + k, z1, y1 + l, true)) { + this.worldObj.setBlock(x1 + k, z1, y1 + l, Blocks.snow_layer, 0, 2); + } + } + } + + BWOreGen.generate(rand, p_73153_2_, p_73153_3_, worldObj, this, this); + MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, false)); + + BlockFalling.fallInstantly = false; + } + + @Override + public void recreateStructures(int p_82695_1_, int p_82695_2_) { + } + + @Override + public void replaceBlocksForBiome(int p_147422_1_, int p_147422_2_, Block[] blocks, byte[] metas, BiomeGenBase[] p_147422_5_) { + super.replaceBlocksForBiome(p_147422_1_, p_147422_2_, blocks, metas, p_147422_5_); + for (int i = 0; i < blocks.length; i++) { + if (blocks[i] == Blocks.grass) { + blocks[i] = Blocks.dirt; + metas[i] = 2; + } + } + } +} diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/SkyProviderRoss128b.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/SkyProviderRoss128b.java new file mode 100644 index 0000000000..24c8e8573e --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/SkyProviderRoss128b.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128b; + +import com.github.bartimaeusnek.crossmod.BartWorksCrossmod; +import micdoodle8.mods.galacticraft.core.client.SkyProviderOverworld; +import net.minecraft.util.ResourceLocation; + +public class SkyProviderRoss128b extends SkyProviderOverworld { + + //ASM enables this texture + public static final ResourceLocation sunTex = new ResourceLocation(BartWorksCrossmod.MOD_ID + ":galacticraft/Ross128b/World/SunRoss128.png"); +} diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/WorldProviderRoss128b.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/WorldProviderRoss128b.java new file mode 100644 index 0000000000..40cfbbbca4 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/WorldProviderRoss128b.java @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128b; + +import com.github.bartimaeusnek.crossmod.galacticraft.planets.AbstractWorldProviderSpace; +import com.github.bartimaeusnek.crossmod.galacticraft.solarsystems.Ross128SolarSystem; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import micdoodle8.mods.galacticraft.api.galaxies.CelestialBody; +import micdoodle8.mods.galacticraft.api.vector.Vector3; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.world.biome.WorldChunkManager; +import net.minecraft.world.chunk.IChunkProvider; + +public class WorldProviderRoss128b extends AbstractWorldProviderSpace { + + @Override + public boolean canRespawnHere() { + return true; + } + + @SideOnly(Side.CLIENT) + public Vec3 getFogColor(float cy, float noidea) { + float angle = MathHelper.cos(cy * (float) Math.PI * 2.0F) * 2.0F + 0.5F; + + if (angle < 0.0F) { + angle = 0.0F; + } + + if (angle > 1.0F) { + angle = 1.0F; + } + + float red = 200 / 255f; + float green = 80 / 255f; + float blue = 0.0F; + red *= angle * 0.94F + 0.06F; + green *= angle * 0.94F + 0.06F; + return Vec3.createVectorHelper((double) red, (double) green, (double) blue); + } + + + @Override + public Vector3 getFogColor() { + //unused + return null; + } + + @Override + public float getSunBrightness(float par1) { + return super.getSunBrightness(par1) * 0.975f; + } + + @Override + public float calculateCelestialAngle(long par1, float par3) { + return super.calculateCelestialAngle(par1, par3); + } + + @Override + public Vector3 getSkyColor() { + float red = 200 / 255f; + float green = 120 / 255f; + float blue = 0.0F; + return new Vector3(red, green, blue); + } + + @Override + public long getDayLength() { + return (long) (24000 * 9.9f); + } + + @Override + public Class getChunkProviderClass() { + return ChunkProviderRoss128b.class; + } + + @Override + public Class getWorldChunkManagerClass() { + return WorldChunkManager.class; + } + + @Override + public float getGravity() { + return -0.0035F; + } + + @Override + public double getMeteorFrequency() { + return 0D; + } + + @Override + public double getFuelUsageMultiplier() { + return 1.35D; + } + + @Override + public boolean canSpaceshipTierPass(int tier) { + return Ross128SolarSystem.Ross128b.getTierRequirement() <= tier; + } + + @Override + public float getFallDamageModifier() { + return 1.35F; + } + + @Override + public float getSoundVolReductionAmount() { + return 1F; + } + + @Override + public float getThermalLevelModifier() { + return 0.01f; + } + + @Override + public float getWindLevel() { + return 1.35f; + } + + @Override + public CelestialBody getCelestialBody() { + return Ross128SolarSystem.Ross128b; + } + + @Override + public double getYCoordinateToTeleport() { + return 500D; + } + + @Override + public double getSolarEnergyMultiplier() { + return 1.38D; + } + + @Override + public boolean hasBreathableAtmosphere() { + return true; + } + +} 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 new file mode 100644 index 0000000000..01bb163283 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128ba/ChunkProviderRoss128ba.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128ba; + +import gregtech.api.objects.XSTR; +import micdoodle8.mods.galacticraft.api.prefab.world.gen.MapGenBaseMeta; +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.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.chunk.Chunk; + +import java.util.Arrays; + +public class ChunkProviderRoss128ba extends ChunkProviderMoon { + + private XSTR rand = new XSTR(); + private World worldObj; + private BiomeGenBase[] biomesForGeneration; + private MapGenBaseMeta caveGenerator; + + public ChunkProviderRoss128ba(World world, long seed, boolean mapFeaturesEnabled) { + super(world, seed, mapFeaturesEnabled); + this.biomesForGeneration = new BiomeGenBase[]{BiomeGenBaseMoon.moonFlat}; + this.caveGenerator = new MapGenCavesMoon(); + this.worldObj=world; + } + + public Chunk provideChunk(int cx, int cz) { + this.rand.setSeed((long)cx * 341873128712L + (long)cz * 132897987541L); + Block[] ids = new Block[65536]; + byte[] meta = new byte[65536]; + Arrays.fill(ids, Blocks.air); + this.generateTerrain(cx, cz, ids, meta); + this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, cx * 16, cz * 16, 16, 16); + this.createCraters(cx, cz, ids, meta); + this.replaceBlocksForBiome(cx, cz, ids, meta, this.biomesForGeneration); + this.caveGenerator.generate(this, this.worldObj, cx, cz, ids, meta); + Chunk Chunk = new Chunk(this.worldObj, ids, meta, cx, cz); + Chunk.generateSkylightMap(); + return Chunk; + } +} diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128ba/WorldProviderRoss128ba.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128ba/WorldProviderRoss128ba.java new file mode 100644 index 0000000000..c28374d2ca --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128ba/WorldProviderRoss128ba.java @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128ba; + +import com.github.bartimaeusnek.crossmod.galacticraft.planets.AbstractWorldProviderSpace; +import com.github.bartimaeusnek.crossmod.galacticraft.solarsystems.Ross128SolarSystem; +import micdoodle8.mods.galacticraft.api.galaxies.CelestialBody; +import micdoodle8.mods.galacticraft.api.vector.Vector3; +import micdoodle8.mods.galacticraft.core.world.gen.WorldChunkManagerMoon; +import net.minecraft.world.biome.WorldChunkManager; +import net.minecraft.world.chunk.IChunkProvider; + +public class WorldProviderRoss128ba extends AbstractWorldProviderSpace { + @Override + public Vector3 getFogColor() { + return new Vector3(0,0,0); + } + + @Override + public Vector3 getSkyColor() { + return new Vector3(0,0,0); + } + + @Override + public long getDayLength() { + return (long) Math.floor(24000f*9.9f/100f); + } + @Override + public boolean hasSunset() { + return false; + } + + @Override + public Class getChunkProviderClass() { + return ChunkProviderRoss128ba.class; + } + + @Override + public Class getWorldChunkManagerClass() { + return WorldChunkManagerMoon.class; + } + + @Override + public double getYCoordinateToTeleport() { + return 500; + } + + @Override + public float getGravity() { + return 0.060f; + } + + @Override + public double getMeteorFrequency() { + return 9D; + } + + @Override + public double getFuelUsageMultiplier() { + return 0.7D; + } + + @Override + public boolean canSpaceshipTierPass(int i) { + return i >= Ross128SolarSystem.Ross128ba.getTierRequirement(); + } + + @Override + public float getFallDamageModifier() { + return 0.2f; + } + + @Override + public float getSoundVolReductionAmount() { + return 20f; + } + + @Override + public float getThermalLevelModifier() { + return 0; + } + + @Override + public float getWindLevel() { + return 0; + } + + @Override + public CelestialBody getCelestialBody() { + return Ross128SolarSystem.Ross128ba; + } + + @Override + public double getSolarEnergyMultiplier() { + return 1.9D; + } +} 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 ba2ac7c185..5035090c2e 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 @@ -25,7 +25,8 @@ package com.github.bartimaeusnek.crossmod.galacticraft.solarsystems; import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; import com.github.bartimaeusnek.crossmod.BartWorksCrossmod; import com.github.bartimaeusnek.crossmod.galacticraft.UniversalTeleportType; -import com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128.world.worldprovider.WorldProviderRoss128b; +import com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128b.WorldProviderRoss128b; +import com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128ba.WorldProviderRoss128ba; import cpw.mods.fml.common.Loader; import micdoodle8.mods.galacticraft.api.GalacticraftRegistry; import micdoodle8.mods.galacticraft.api.galaxies.*; @@ -47,8 +48,6 @@ public class Ross128SolarSystem { public static void init() { -// Ross128bBlocks = new UniversalSpaceBlocks("Ross128bBlocks",new String[]{BartWorksCrossmod.MOD_ID+":Ross128bStone",BartWorksCrossmod.MOD_ID+":Ross128bDirt",BartWorksCrossmod.MOD_ID+":Ross128bGrass"}); - Ross128SolarSystem.Ross128System = new SolarSystem("Ross128System", "milkyWay").setMapPosition(new Vector3(-1.0D, 1.3D, 0.0D)); Ross128SolarSystem.Ross128 = (Star) new Star("Ross128").setParentSolarSystem(Ross128SolarSystem.Ross128System).setTierRequired(-1); Ross128SolarSystem.Ross128.setUnreachable(); @@ -62,24 +61,22 @@ public class Ross128SolarSystem { Ross128SolarSystem.Ross128b.setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(0.75F, 1.75F)); Ross128SolarSystem.Ross128b.setRelativeOrbitTime(0.65F); Ross128SolarSystem.Ross128b.atmosphere.addAll(Arrays.asList(IAtmosphericGas.OXYGEN, IAtmosphericGas.NITROGEN, IAtmosphericGas.ARGON)); - Ross128SolarSystem.Ross128b.setDimensionInfo(ConfigHandler.ross128ID, WorldProviderRoss128b.class); + Ross128SolarSystem.Ross128b.setDimensionInfo(ConfigHandler.ross128BID, WorldProviderRoss128b.class); Ross128SolarSystem.Ross128b.setTierRequired(Loader.isModLoaded("galaxyspace") ? 4 : Loader.isModLoaded("GalacticraftMars") ? 3 : -1); Ross128SolarSystem.Ross128ba = new Moon("Ross128ba").setParentPlanet(Ross128SolarSystem.Ross128b); Ross128SolarSystem.Ross128ba.setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(10f, 15f)).setRelativeOrbitTime(1 / 0.01F); Ross128SolarSystem.Ross128ba.setBodyIcon(new ResourceLocation(BartWorksCrossmod.MOD_ID + ":galacticraft/Ross128b/MapObjs/Ross128ba.png")); - Ross128SolarSystem.Ross128ba.setUnreachable(); //for now + Ross128SolarSystem.Ross128ba.setDimensionInfo(ConfigHandler.ross128BAID, WorldProviderRoss128ba.class); + Ross128SolarSystem.Ross128ba.setTierRequired(Loader.isModLoaded("galaxyspace") ? 5 : Loader.isModLoaded("GalacticraftMars") ? 3 : -1); -// GameRegistry.registerBlock(Ross128bBlocks,Ross128bBlocks.getUnlocalizedName()); -// -// Ross128bStone=new BlockMetaPair(Ross128bBlocks, (byte) 0); -// Ross128bDirt=new BlockMetaPair(Ross128bBlocks, (byte) 1); -// Ross128bGrass=new BlockMetaPair(Ross128bBlocks, (byte) 2); + Ross128SolarSystem.Ross128ba.setUnreachable(); GalaxyRegistry.registerPlanet(Ross128SolarSystem.Ross128b); GalaxyRegistry.registerMoon(Ross128SolarSystem.Ross128ba); GalaxyRegistry.registerSolarSystem(Ross128SolarSystem.Ross128System); GalacticraftRegistry.registerTeleportType(WorldProviderRoss128b.class, new UniversalTeleportType()); + GalacticraftRegistry.registerTeleportType(WorldProviderRoss128ba.class, new UniversalTeleportType()); } } diff --git a/src/main/resources/assets/bartworks/lang/en_US.lang b/src/main/resources/assets/bartworks/lang/en_US.lang index e2df35928f..d035c87472 100644 --- a/src/main/resources/assets/bartworks/lang/en_US.lang +++ b/src/main/resources/assets/bartworks/lang/en_US.lang @@ -148,7 +148,7 @@ tooltip.tile.htr.0.name=Controller Block for the Thorium High Temperature Reacto item.TRISOPellet.name=TRISO pebble item.TRISOPelletBall.name=TRISO pebble ball item.BISOPelletBall.name=BISO pebble ball -item.BISOPellet.name=BRISO pebble +item.BISOPellet.name=BISO pebble item.TRISOPelletCompound.name=TRISO pebble compund item.BISOPelletCompound.name=BISO pebble compund itemGroup.bartworksMetaMaterials=BartWorks' Meta Materials -- cgit