From 424a900880e309401cb7983cf84a17a045546001 Mon Sep 17 00:00:00 2001 From: Reika Date: Fri, 15 May 2020 19:31:48 -0400 Subject: [PATCH] Update 900 --- Auxiliary/RecipeManagers/CastingRecipe.java | 4 + .../Blocks/CompoundRuneRecipe.java | 5 + .../Blocks/EnhancedRuneRecipe.java | 5 + .../Blocks/FloatingRelayRecipe.java | 9 +- .../CastingRecipes/Blocks/RelayRecipe.java | 5 + .../CastingRecipes/Blocks/RuneRecipe.java | 5 + .../Blocks/StoneRuneRecipe.java | 5 + .../Items/CrystalClusterRecipe.java | 5 + .../Items/CrystalCoreRecipe.java | 5 + .../Items/CrystalFocusRecipe.java | 5 + .../Items/CrystalGroupRecipe.java | 5 + .../Items/CrystalLensRecipe.java | 5 + .../Items/CrystalMirrorRecipe.java | 4 + .../Items/CrystalStarRecipe.java | 5 + .../Items/ElementUnitRecipe.java | 5 + .../CastingRecipes/Items/HighCoreRecipe.java | 5 + .../Items/IridescentChunkRecipe.java | 5 + .../CastingRecipes/Items/LowCoreRecipe.java | 5 + .../Items/LumenChunkRecipe.java | 9 +- .../CastingRecipes/Items/LumenCoreRecipe.java | 9 +- .../Items/RawCrystalRecipe.java | 5 + .../Special/BeeConversionRecipe.java | 5 + Auxiliary/RecipeManagers/PoolRecipes.java | 6 +- Resources/machines.xml | 2 +- .../Acquisition/TileEntityItemFabricator.java | 9 +- TileEntity/Processing/TileEntityGlowFire.java | 7 +- TileEntity/Recipe/TileEntityCastingTable.java | 3 + .../Recipe/TileEntityChromaCrafter.java | 6 + TileEntity/Recipe/TileEntityItemInfuser.java | 11 +- World/BiomeEnderForest.java | 22 +- World/EnderOakGenerator.java | 249 ++++++++++++++++++ 31 files changed, 421 insertions(+), 14 deletions(-) create mode 100644 World/EnderOakGenerator.java diff --git a/Auxiliary/RecipeManagers/CastingRecipe.java b/Auxiliary/RecipeManagers/CastingRecipe.java index 4c41c9bff..5de0582b5 100644 --- a/Auxiliary/RecipeManagers/CastingRecipe.java +++ b/Auxiliary/RecipeManagers/CastingRecipe.java @@ -487,6 +487,10 @@ public boolean canBeSimpleAutomated() { return false; } + public boolean canGiveDoubleOutput() { + return false; + } + public int getInputCount() { return ReikaRecipeHelper.getRecipeIngredientCount(recipe); } diff --git a/Auxiliary/RecipeManagers/CastingRecipes/Blocks/CompoundRuneRecipe.java b/Auxiliary/RecipeManagers/CastingRecipes/Blocks/CompoundRuneRecipe.java index c65c90300..708a80db6 100644 --- a/Auxiliary/RecipeManagers/CastingRecipes/Blocks/CompoundRuneRecipe.java +++ b/Auxiliary/RecipeManagers/CastingRecipes/Blocks/CompoundRuneRecipe.java @@ -63,6 +63,11 @@ public final boolean canBeSimpleAutomated() { return true; } + @Override + public boolean canGiveDoubleOutput() { + return true; + } + @Override public int getTypicalCraftedAmount() { return 32; diff --git a/Auxiliary/RecipeManagers/CastingRecipes/Blocks/EnhancedRuneRecipe.java b/Auxiliary/RecipeManagers/CastingRecipes/Blocks/EnhancedRuneRecipe.java index cb5838be4..bbaf2866b 100644 --- a/Auxiliary/RecipeManagers/CastingRecipes/Blocks/EnhancedRuneRecipe.java +++ b/Auxiliary/RecipeManagers/CastingRecipes/Blocks/EnhancedRuneRecipe.java @@ -39,4 +39,9 @@ public int getNumberProduced() { return 8; } + @Override + public boolean canGiveDoubleOutput() { + return true; + } + } diff --git a/Auxiliary/RecipeManagers/CastingRecipes/Blocks/FloatingRelayRecipe.java b/Auxiliary/RecipeManagers/CastingRecipes/Blocks/FloatingRelayRecipe.java index e21e2b27a..efaf22f14 100644 --- a/Auxiliary/RecipeManagers/CastingRecipes/Blocks/FloatingRelayRecipe.java +++ b/Auxiliary/RecipeManagers/CastingRecipes/Blocks/FloatingRelayRecipe.java @@ -1,8 +1,8 @@ /******************************************************************************* * @author Reika Kalseki - * + * * Copyright 2017 - * + * * All rights reserved. * Distribution of the software in any form is only allowed with * explicit, prior permission from the owner. @@ -31,4 +31,9 @@ public FloatingRelayRecipe(ItemStack out, ItemStack main) { this.addAuxItem(ChromaStacks.enderDust, 0, -2); } + @Override + public boolean canGiveDoubleOutput() { + return true; + } + } diff --git a/Auxiliary/RecipeManagers/CastingRecipes/Blocks/RelayRecipe.java b/Auxiliary/RecipeManagers/CastingRecipes/Blocks/RelayRecipe.java index 590dbbef9..cc378834a 100644 --- a/Auxiliary/RecipeManagers/CastingRecipes/Blocks/RelayRecipe.java +++ b/Auxiliary/RecipeManagers/CastingRecipes/Blocks/RelayRecipe.java @@ -42,4 +42,9 @@ public int getNumberProduced() { return 8; } + @Override + public boolean canGiveDoubleOutput() { + return true; + } + } diff --git a/Auxiliary/RecipeManagers/CastingRecipes/Blocks/RuneRecipe.java b/Auxiliary/RecipeManagers/CastingRecipes/Blocks/RuneRecipe.java index af5099840..7a13c7687 100644 --- a/Auxiliary/RecipeManagers/CastingRecipes/Blocks/RuneRecipe.java +++ b/Auxiliary/RecipeManagers/CastingRecipes/Blocks/RuneRecipe.java @@ -48,4 +48,9 @@ protected void getRequiredProgress(Collection c) { c.add(ProgressStage.ALLCOLORS); } + @Override + public boolean canGiveDoubleOutput() { + return true; + } + } diff --git a/Auxiliary/RecipeManagers/CastingRecipes/Blocks/StoneRuneRecipe.java b/Auxiliary/RecipeManagers/CastingRecipes/Blocks/StoneRuneRecipe.java index 1abb2f67c..615956464 100644 --- a/Auxiliary/RecipeManagers/CastingRecipes/Blocks/StoneRuneRecipe.java +++ b/Auxiliary/RecipeManagers/CastingRecipes/Blocks/StoneRuneRecipe.java @@ -39,4 +39,9 @@ public int getNumberProduced() { return 4; } + @Override + public boolean canGiveDoubleOutput() { + return true; + } + } diff --git a/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalClusterRecipe.java b/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalClusterRecipe.java index 2948bb1ec..c82a2144a 100644 --- a/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalClusterRecipe.java +++ b/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalClusterRecipe.java @@ -33,6 +33,11 @@ public boolean canBeSimpleAutomated() { return true; } + @Override + public boolean canGiveDoubleOutput() { + return true; + } + private static IRecipe getRecipe(ItemStack out) { int mod = (out.getItemDamage()-ChromaStacks.primaryCluster.getItemDamage())%2; ItemStack is1 = ChromaItems.CLUSTER.getStackOfMetadata(2*mod); diff --git a/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalCoreRecipe.java b/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalCoreRecipe.java index 069e78de0..afcc2fdac 100644 --- a/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalCoreRecipe.java +++ b/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalCoreRecipe.java @@ -34,6 +34,11 @@ public boolean canBeSimpleAutomated() { return true; } + @Override + public boolean canGiveDoubleOutput() { + return true; + } + @Override public int getDuration() { return 2*super.getDuration(); diff --git a/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalFocusRecipe.java b/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalFocusRecipe.java index 0a524ebe5..30f06947d 100644 --- a/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalFocusRecipe.java +++ b/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalFocusRecipe.java @@ -35,6 +35,11 @@ public boolean canBeSimpleAutomated() { return true; } + @Override + public boolean canGiveDoubleOutput() { + return true; + } + @Override public int getTypicalCraftedAmount() { return 32; diff --git a/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalGroupRecipe.java b/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalGroupRecipe.java index 35a871510..7e38447ef 100644 --- a/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalGroupRecipe.java +++ b/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalGroupRecipe.java @@ -44,6 +44,11 @@ public boolean canBeSimpleAutomated() { return true; } + @Override + public boolean canGiveDoubleOutput() { + return true; + } + private static IRecipe getRecipe(ItemStack out, CrystalElement e1, CrystalElement e2, CrystalElement e3, CrystalElement e4, ItemStack ctr, boolean chg) { return ReikaRecipeHelper.getShapedRecipeFor(out, " A ", "BIC", " D ", 'A', getShardType(e1, chg), 'B', getShardType(e2, chg), 'C', getShardType(e3, chg), 'D', getShardType(e4, chg), 'I', ctr); } diff --git a/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalLensRecipe.java b/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalLensRecipe.java index 629a2c99d..ac51e3fdd 100644 --- a/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalLensRecipe.java +++ b/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalLensRecipe.java @@ -36,6 +36,11 @@ public boolean canBeSimpleAutomated() { return true; } + @Override + public boolean canGiveDoubleOutput() { + return true; + } + @Override public int getTypicalCraftedAmount() { return 64; diff --git a/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalMirrorRecipe.java b/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalMirrorRecipe.java index 632fa57e6..f8b5fba58 100644 --- a/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalMirrorRecipe.java +++ b/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalMirrorRecipe.java @@ -38,6 +38,10 @@ public boolean canBeSimpleAutomated() { return true; } + @Override + public boolean canGiveDoubleOutput() { + return true; + } @Override public int getTypicalCraftedAmount() { diff --git a/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalStarRecipe.java b/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalStarRecipe.java index dfd5d596e..f67694042 100644 --- a/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalStarRecipe.java +++ b/Auxiliary/RecipeManagers/CastingRecipes/Items/CrystalStarRecipe.java @@ -60,6 +60,11 @@ public boolean canBeSimpleAutomated() { return true; } + @Override + public boolean canGiveDoubleOutput() { + return true; + } + @Override public int getDuration() { return 4*super.getDuration(); diff --git a/Auxiliary/RecipeManagers/CastingRecipes/Items/ElementUnitRecipe.java b/Auxiliary/RecipeManagers/CastingRecipes/Items/ElementUnitRecipe.java index d160559c4..20e582e7b 100644 --- a/Auxiliary/RecipeManagers/CastingRecipes/Items/ElementUnitRecipe.java +++ b/Auxiliary/RecipeManagers/CastingRecipes/Items/ElementUnitRecipe.java @@ -55,4 +55,9 @@ public final boolean canBeSimpleAutomated() { return true; } + @Override + public boolean canGiveDoubleOutput() { + return true; + } + } diff --git a/Auxiliary/RecipeManagers/CastingRecipes/Items/HighCoreRecipe.java b/Auxiliary/RecipeManagers/CastingRecipes/Items/HighCoreRecipe.java index 7a6d4601c..be65ff036 100644 --- a/Auxiliary/RecipeManagers/CastingRecipes/Items/HighCoreRecipe.java +++ b/Auxiliary/RecipeManagers/CastingRecipes/Items/HighCoreRecipe.java @@ -72,4 +72,9 @@ public final boolean canBeSimpleAutomated() { return true; } + @Override + public boolean canGiveDoubleOutput() { + return true; + } + } diff --git a/Auxiliary/RecipeManagers/CastingRecipes/Items/IridescentChunkRecipe.java b/Auxiliary/RecipeManagers/CastingRecipes/Items/IridescentChunkRecipe.java index 142823b7a..6ba6d3194 100644 --- a/Auxiliary/RecipeManagers/CastingRecipes/Items/IridescentChunkRecipe.java +++ b/Auxiliary/RecipeManagers/CastingRecipes/Items/IridescentChunkRecipe.java @@ -40,4 +40,9 @@ public final boolean canBeSimpleAutomated() { return true; } + @Override + public boolean canGiveDoubleOutput() { + return true; + } + } diff --git a/Auxiliary/RecipeManagers/CastingRecipes/Items/LowCoreRecipe.java b/Auxiliary/RecipeManagers/CastingRecipes/Items/LowCoreRecipe.java index a6f2906ce..cf4c212d3 100644 --- a/Auxiliary/RecipeManagers/CastingRecipes/Items/LowCoreRecipe.java +++ b/Auxiliary/RecipeManagers/CastingRecipes/Items/LowCoreRecipe.java @@ -54,4 +54,9 @@ public final boolean canBeSimpleAutomated() { return true; } + @Override + public boolean canGiveDoubleOutput() { + return true; + } + } diff --git a/Auxiliary/RecipeManagers/CastingRecipes/Items/LumenChunkRecipe.java b/Auxiliary/RecipeManagers/CastingRecipes/Items/LumenChunkRecipe.java index dc2a531d8..6ae901b06 100644 --- a/Auxiliary/RecipeManagers/CastingRecipes/Items/LumenChunkRecipe.java +++ b/Auxiliary/RecipeManagers/CastingRecipes/Items/LumenChunkRecipe.java @@ -1,8 +1,8 @@ /******************************************************************************* * @author Reika Kalseki - * + * * Copyright 2017 - * + * * All rights reserved. * Distribution of the software in any form is only allowed with * explicit, prior permission from the owner. @@ -52,4 +52,9 @@ public boolean canBeStacked() { return true; } + @Override + public boolean canGiveDoubleOutput() { + return true; + } + } diff --git a/Auxiliary/RecipeManagers/CastingRecipes/Items/LumenCoreRecipe.java b/Auxiliary/RecipeManagers/CastingRecipes/Items/LumenCoreRecipe.java index aa7b31140..3b242e70f 100644 --- a/Auxiliary/RecipeManagers/CastingRecipes/Items/LumenCoreRecipe.java +++ b/Auxiliary/RecipeManagers/CastingRecipes/Items/LumenCoreRecipe.java @@ -1,8 +1,8 @@ /******************************************************************************* * @author Reika Kalseki - * + * * Copyright 2017 - * + * * All rights reserved. * Distribution of the software in any form is only allowed with * explicit, prior permission from the owner. @@ -39,4 +39,9 @@ public LumenCoreRecipe(ItemStack out, ItemStack main) { this.addAuraRequirement(CrystalElement.BLUE, 60000); } + @Override + public boolean canGiveDoubleOutput() { + return false; + } + } diff --git a/Auxiliary/RecipeManagers/CastingRecipes/Items/RawCrystalRecipe.java b/Auxiliary/RecipeManagers/CastingRecipes/Items/RawCrystalRecipe.java index 2766d1168..c8970b661 100644 --- a/Auxiliary/RecipeManagers/CastingRecipes/Items/RawCrystalRecipe.java +++ b/Auxiliary/RecipeManagers/CastingRecipes/Items/RawCrystalRecipe.java @@ -31,4 +31,9 @@ public boolean canBeSimpleAutomated() { return true; } + @Override + public boolean canGiveDoubleOutput() { + return true; + } + } diff --git a/Auxiliary/RecipeManagers/CastingRecipes/Special/BeeConversionRecipe.java b/Auxiliary/RecipeManagers/CastingRecipes/Special/BeeConversionRecipe.java index 694caee24..42baf7b62 100644 --- a/Auxiliary/RecipeManagers/CastingRecipes/Special/BeeConversionRecipe.java +++ b/Auxiliary/RecipeManagers/CastingRecipes/Special/BeeConversionRecipe.java @@ -149,4 +149,9 @@ public boolean isModded() { return true; } + @Override + public boolean canGiveDoubleOutput() { + return true; + } + } diff --git a/Auxiliary/RecipeManagers/PoolRecipes.java b/Auxiliary/RecipeManagers/PoolRecipes.java index e3fe976fe..4f236d7bc 100644 --- a/Auxiliary/RecipeManagers/PoolRecipes.java +++ b/Auxiliary/RecipeManagers/PoolRecipes.java @@ -35,6 +35,7 @@ import Reika.ChromatiCraft.Magic.Progression.ProgressStage; import Reika.ChromatiCraft.Registry.ChromaBlocks; import Reika.ChromatiCraft.Registry.ChromaItems; +import Reika.ChromatiCraft.Registry.Chromabilities; import Reika.DragonAPI.ModList; import Reika.DragonAPI.ASM.DependentMethodStripper.ModDependent; import Reika.DragonAPI.Instantiable.Data.Collections.OneWayCollections.OneWayList; @@ -161,6 +162,9 @@ public void makePoolRecipe(EntityItem ei, PoolRecipe pr, int ether, int x, int y pr.makeFrom(li); ReikaEntityHelper.decrEntityItemStack(ei, 1); int n = pr.allowDoubling() && ReikaRandomHelper.doWithChance(BlockActiveChroma.getDoublingChance(ether)) ? 2 : 1; + EntityPlayer ep = ReikaItemHelper.getDropper(ei); + if (Chromabilities.DOUBLECRAFT.enabledOn(ep)) + n *= 2; int n2 = n*pr.getOutput().stackSize; for (int i = 0; i < n2; i++) { EntityItem newitem = ReikaItemHelper.dropItem(ei, ReikaItemHelper.getSizedItemStack(pr.getOutput(), 1)); @@ -174,7 +178,7 @@ public void makePoolRecipe(EntityItem ei, PoolRecipe pr, int ether, int x, int y ei.worldObj.setBlock(x, y, z, Blocks.air); } ReikaWorldHelper.causeAdjacentUpdates(ei.worldObj, x, y, z); - ProgressStage.ALLOY.stepPlayerTo(ReikaItemHelper.getDropper(ei)); + ProgressStage.ALLOY.stepPlayerTo(ep); } public void loadCustomPoolRecipes() { diff --git a/Resources/machines.xml b/Resources/machines.xml index 7c8f956ff..ceab7c4a4 100644 --- a/Resources/machines.xml +++ b/Resources/machines.xml @@ -820,7 +820,7 @@ - The limitations of that digital storage system's ability to handle many discrete forms of items have become troublesome once again. As soon as you delved into breeding bees, trees, and butterflies, you were quickly inundated with products in every genetic combination you can think of. Not helping is the time your butterfly enclosure sprung a leak and the escapees proceeded to cross-pollinate every tree and plant in sight. Two dozen storage drives for Apple Oak pollen alone is not acceptable, but on the bright side, you have encountered a similar problem to this before, and might have something of a solution... + The limitations of that digital storage system's ability to handle many discrete forms of items have become troublesome once again. As soon as you delved into breeding bees, trees, and butterflies, you were quickly inundated with products in every genetic combination conceivable. Not helping is the time your butterfly enclosure sprung a leak and the escapees proceeded to cross-pollinate every tree and plant in sight. Two dozen storage drives for Apple Oak pollen alone is not acceptable, but on the bright side, you have encountered a similar problem to this before, and might have something of a solution... Stores any variants of one "species format" like pollen, princesses, or larvae diff --git a/TileEntity/Acquisition/TileEntityItemFabricator.java b/TileEntity/Acquisition/TileEntityItemFabricator.java index 556b0f118..8a833e460 100644 --- a/TileEntity/Acquisition/TileEntityItemFabricator.java +++ b/TileEntity/Acquisition/TileEntityItemFabricator.java @@ -12,6 +12,7 @@ import org.apache.commons.lang3.tuple.ImmutableTriple; import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -31,10 +32,12 @@ import Reika.ChromatiCraft.Magic.ElementTagCompound; import Reika.ChromatiCraft.Magic.Network.CrystalNetworker; import Reika.ChromatiCraft.Registry.ChromaTiles; +import Reika.ChromatiCraft.Registry.Chromabilities; import Reika.ChromatiCraft.Registry.CrystalElement; import Reika.ChromatiCraft.TileEntity.AOE.Effect.TileEntityAccelerator; import Reika.DragonAPI.Instantiable.InertItem; import Reika.DragonAPI.Libraries.ReikaInventoryHelper; +import Reika.DragonAPI.Libraries.ReikaPlayerAPI; import Reika.DragonAPI.Libraries.MathSci.ReikaMathLibrary; import Reika.DragonAPI.Libraries.Registry.ReikaItemHelper; @@ -208,7 +211,11 @@ private void craft(World world, int x, int y, int z) { ((IFluidHandler)te).fill(ForgeDirection.UP, new FluidStack(((FluidRecipe)recipe).fluid, 1000), true); } else { - ReikaInventoryHelper.addOrSetStack(recipe.output.copy(), inv, 1); + int n = 1; + EntityPlayer ep = this.getPlacer(); + if (ep != null && !ReikaPlayerAPI.isFake(ep) && Chromabilities.DOUBLECRAFT.enabledOn(ep)) + n = 2; + ReikaInventoryHelper.addOrSetStack(recipe.output.copy(), inv, n); } energy.subtract(recipe.energy); progress = 0; diff --git a/TileEntity/Processing/TileEntityGlowFire.java b/TileEntity/Processing/TileEntityGlowFire.java index 0f9266b43..63c5b6441 100644 --- a/TileEntity/Processing/TileEntityGlowFire.java +++ b/TileEntity/Processing/TileEntityGlowFire.java @@ -42,6 +42,7 @@ import Reika.ChromatiCraft.Registry.ChromaPackets; import Reika.ChromatiCraft.Registry.ChromaSounds; import Reika.ChromatiCraft.Registry.ChromaTiles; +import Reika.ChromatiCraft.Registry.Chromabilities; import Reika.ChromatiCraft.Registry.CrystalElement; import Reika.ChromatiCraft.Render.Particle.EntityBlurFX; import Reika.ChromatiCraft.Render.Particle.EntityFloatingSeedsFX; @@ -166,11 +167,15 @@ public boolean craft() { if (energy.isEmpty()) return false; ItemStack in = inv[0]; + ItemStack out = in.copy(); + EntityPlayer ep = this.getPlacer(); + if (ep != null && !ReikaPlayerAPI.isFake(ep) && Chromabilities.DOUBLECRAFT.enabledOn(ep)) + out.stackSize *= 2; inv[0] = null; boolean flag = true; boolean flag2 = false; while(flag) { - this.dropItem(in); + this.dropItem(out); flag = this.craftAndDrop(in); flag2 |= flag; } diff --git a/TileEntity/Recipe/TileEntityCastingTable.java b/TileEntity/Recipe/TileEntityCastingTable.java index dd67e8bee..9327cd647 100644 --- a/TileEntity/Recipe/TileEntityCastingTable.java +++ b/TileEntity/Recipe/TileEntityCastingTable.java @@ -63,6 +63,7 @@ import Reika.ChromatiCraft.Registry.ChromaSounds; import Reika.ChromatiCraft.Registry.ChromaStructures; import Reika.ChromatiCraft.Registry.ChromaTiles; +import Reika.ChromatiCraft.Registry.Chromabilities; import Reika.ChromatiCraft.Registry.CrystalElement; import Reika.ChromatiCraft.Render.BotaniaPetalShower; import Reika.ChromatiCraft.Render.Particle.EntityFloatingSeedsFX; @@ -923,6 +924,8 @@ private void craft() { count--; ItemStack toadd = ReikaItemHelper.getSizedItemStack(out, activeRecipe.getOutput().stackSize); + if (Chromabilities.DOUBLECRAFT.enabledOn(craftingPlayer)) + toadd.stackSize *= 2; NBTTagCompound NBTout = NBTin != null ? (NBTTagCompound)NBTin.copy() : null; if (NBTout != null) { ReikaNBTHelper.combineNBT(NBTout, toadd.stackTagCompound); diff --git a/TileEntity/Recipe/TileEntityChromaCrafter.java b/TileEntity/Recipe/TileEntityChromaCrafter.java index 0d761a2fa..febfc146e 100644 --- a/TileEntity/Recipe/TileEntityChromaCrafter.java +++ b/TileEntity/Recipe/TileEntityChromaCrafter.java @@ -15,6 +15,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EntityFX; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; @@ -40,6 +41,7 @@ import Reika.ChromatiCraft.Registry.ChromaBlocks; import Reika.ChromatiCraft.Registry.ChromaSounds; import Reika.ChromatiCraft.Registry.ChromaTiles; +import Reika.ChromatiCraft.Registry.Chromabilities; import Reika.ChromatiCraft.Registry.CrystalElement; import Reika.ChromatiCraft.Render.Particle.EntityChromaFluidFX; import Reika.ChromatiCraft.TileEntity.Auxiliary.TileEntityFocusCrystal; @@ -53,6 +55,7 @@ import Reika.DragonAPI.Libraries.ReikaAABBHelper; import Reika.DragonAPI.Libraries.ReikaInventoryHelper; import Reika.DragonAPI.Libraries.ReikaNBTHelper; +import Reika.DragonAPI.Libraries.ReikaPlayerAPI; import Reika.DragonAPI.Libraries.Java.ReikaRandomHelper; import Reika.DragonAPI.Libraries.MathSci.ReikaPhysicsHelper; import Reika.DragonAPI.Libraries.Registry.ReikaItemHelper; @@ -240,6 +243,9 @@ private void craft() { out.stackSize *= 2; hasEtherBerries -= TileEntityChroma.ETHER_SATURATION; } + EntityPlayer ep = this.getPlacer(); + if (ep != null && !ReikaPlayerAPI.isFake(ep) && Chromabilities.DOUBLECRAFT.enabledOn(ep)) + out.stackSize *= 2; //recipeItems.clear(); //hasEtherBerries = false; ReikaInventoryHelper.addOrSetStack(out, inv, 1); diff --git a/TileEntity/Recipe/TileEntityItemInfuser.java b/TileEntity/Recipe/TileEntityItemInfuser.java index 4df701591..94b2da512 100644 --- a/TileEntity/Recipe/TileEntityItemInfuser.java +++ b/TileEntity/Recipe/TileEntityItemInfuser.java @@ -1,6 +1,7 @@ package Reika.ChromatiCraft.TileEntity.Recipe; import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; @@ -9,10 +10,12 @@ import Reika.ChromatiCraft.Registry.ChromaBlocks; import Reika.ChromatiCraft.Registry.ChromaStructures; import Reika.ChromatiCraft.Registry.ChromaTiles; +import Reika.ChromatiCraft.Registry.Chromabilities; import Reika.ChromatiCraft.Registry.CrystalElement; import Reika.ChromatiCraft.Render.Particle.EntityChromaFluidFX; import Reika.DragonAPI.Instantiable.Data.BlockStruct.FilledBlockArray; import Reika.DragonAPI.Instantiable.Data.Immutable.Coordinate; +import Reika.DragonAPI.Libraries.ReikaPlayerAPI; import Reika.DragonAPI.Libraries.Java.ReikaRandomHelper; import Reika.DragonAPI.Libraries.Registry.ReikaItemHelper; @@ -55,8 +58,12 @@ protected boolean isReady() { @Override protected void onCraft() { - inv[0] = ReikaItemHelper.getSizedItemStack(ChromaStacks.iridCrystal, inv[0].stackSize); - ProgressStage.INFUSE.stepPlayerTo(this.getCraftingPlayer()); + int n = inv[0].stackSize; + EntityPlayer ep = this.getCraftingPlayer(); + if (!ReikaPlayerAPI.isFake(ep) && Chromabilities.DOUBLECRAFT.enabledOn(ep)) + n *= 2; + inv[0] = ReikaItemHelper.getSizedItemStack(ChromaStacks.iridCrystal, n); + ProgressStage.INFUSE.stepPlayerTo(ep); } @Override diff --git a/World/BiomeEnderForest.java b/World/BiomeEnderForest.java index d48cb0662..686ccc866 100644 --- a/World/BiomeEnderForest.java +++ b/World/BiomeEnderForest.java @@ -1,8 +1,8 @@ /******************************************************************************* * @author Reika Kalseki - * + * * Copyright 2017 - * + * * All rights reserved. * Distribution of the software in any form is only allowed with * explicit, prior permission from the owner. @@ -20,13 +20,20 @@ import net.minecraft.world.biome.BiomeDecorator; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenForest; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; import Reika.ChromatiCraft.Block.Worldgen.BlockDecoFlower.Flowers; import Reika.ChromatiCraft.Registry.ChromaBlocks; import Reika.ChromatiCraft.Registry.ChromaOptions; +import Reika.DragonAPI.Instantiable.Data.WeightedRandom; public class BiomeEnderForest extends BiomeGenForest { + private final WorldGenAbstractTree enderOakLarge = new EnderOakGenerator(3, 7, 5, 15, 6, 0.15F, 4, 0.15F); + private final WorldGenAbstractTree enderOakSmall = new EnderOakGenerator(2, 4, 3, 5, 3, 0, 0, 0.1F); + + private final WeightedRandom treeTypes = new WeightedRandom(); + public BiomeEnderForest(int id) { super(id, 0); //thin the trees a little @@ -43,6 +50,11 @@ public BiomeEnderForest(int id) { spawnableMonsterList.add(new SpawnListEntry(EntityCreeper.class, 1, 1, 4)); spawnableMonsterList.add(new SpawnListEntry(EntitySpider.class, 1, 1, 4)); spawnableMonsterList.add(new SpawnListEntry(EntitySkeleton.class, 1, 1, 4)); + + treeTypes.addEntry(worldGeneratorTrees, 20); + treeTypes.addEntry(worldGeneratorBigTree, 4); + treeTypes.addEntry(enderOakSmall, 50); + treeTypes.addEntry(enderOakLarge, 10); } @Override @@ -117,4 +129,10 @@ public void plantFlower(World world, Random rand, int x, int y, int z) { } } + @Override + public WorldGenAbstractTree func_150567_a(Random rand) { + treeTypes.setRNG(rand); + return treeTypes.getRandomEntry(); + } + } diff --git a/World/EnderOakGenerator.java b/World/EnderOakGenerator.java new file mode 100644 index 000000000..07d362643 --- /dev/null +++ b/World/EnderOakGenerator.java @@ -0,0 +1,249 @@ +package Reika.ChromatiCraft.World; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; + +import Reika.DragonAPI.Instantiable.Data.Immutable.Coordinate; +import Reika.DragonAPI.Instantiable.Data.Maps.MultiMap; +import Reika.DragonAPI.Instantiable.Data.Maps.MultiMap.CollectionType; +import Reika.DragonAPI.Libraries.Java.ReikaRandomHelper; +import Reika.DragonAPI.Libraries.MathSci.ReikaPhysicsHelper; +import Reika.DragonAPI.Libraries.Registry.ReikaTreeHelper; +import Reika.DragonAPI.Libraries.World.ReikaWorldHelper; + +public class EnderOakGenerator extends WorldGenAbstractTree { + + public final int minTrunkBaseHeight; + public final int maxTrunkBaseHeight; + public final int minFoliageHeight; + public final int maxFoliageHeight; + public final int maxFoliageRadius; + public final float branchChancePerLevel; + public final int maxBranchLength; + public final float columnChancePerLeaf; + + public EnderOakGenerator(int h0, int h1, int f0, int f1, int fr, float b, int bl, float c) { + super(false); + minTrunkBaseHeight = h0; + maxTrunkBaseHeight = h1; + minFoliageHeight = f0; + maxFoliageHeight = f1; + maxFoliageRadius = fr; + branchChancePerLevel = b; + maxBranchLength = bl; + columnChancePerLeaf = c; + } + + @Override + public boolean generate(World world, Random rand, int x, int y, int z) { + int trunk = ReikaRandomHelper.getRandomBetween(minTrunkBaseHeight, maxTrunkBaseHeight, rand); + int leaf = ReikaRandomHelper.getRandomBetween(minFoliageHeight, maxFoliageHeight, rand); + Tree tree = new Tree(trunk, leaf); + tree.calculate(world, rand, x, y, z); + if (tree.canPlace(world)) { + tree.place(world); + return true; + } + return false; + } + + private class Tree { + + private final HashSet logs = new HashSet(); + private final MultiMap leaves = new MultiMap(CollectionType.HASHSET); + + private final HashMap branches = new HashMap(); + + private final int trunkHeight; + private final int leafHeight; + private final int totalHeight; + + private int lowestLeafY = 999; + private int currentRadius = 0; + private float currentRadiusExponent = 0.5F; + + private Tree(int ht, int hl) { + trunkHeight = ht; + leafHeight = hl; + totalHeight = ht+hl; + } + + private void calculate(World world, Random rand, int x, int y, int z) { + for (int h = 0; h <= totalHeight; h++) { + Coordinate core = new Coordinate(x, y+h, z); + if (h == totalHeight) + leaves.addValue(core.yCoord, core); + else + logs.add(core); + if (h > trunkHeight && h < totalHeight) { + this.generateLayer(world, rand, x, y, z, h, core); + } + } + if (branchChancePerLevel > 0) { + for (int yl : leaves.keySet()) { + if (rand.nextFloat() < branchChancePerLevel) { + Coordinate c = new Coordinate(x, yl, z); + branches.put(c, new Branch(c, rand.nextFloat()*360, (float)ReikaRandomHelper.getRandomPlusMinus(0F, 30F, rand))); + } + } + if (!branches.isEmpty()) { + for (Branch b : branches.values()) { + b.calculate(world, rand); + logs.addAll(b.leaves); + Collection li = new ArrayList(b.leaves); + li.removeAll(logs); + for (Coordinate c : li) { + leaves.addValue(c.yCoord, c); + } + } + } + } + if (columnChancePerLeaf > 0) { + Collection li = leaves.get(lowestLeafY); + for (Coordinate c : li) { + if (rand.nextFloat() < columnChancePerLeaf) { + for (int y2 = lowestLeafY; y2 >= 0; y2--) { + if (this.canReplace(world, c.xCoord, y2, c.zCoord)) { + Coordinate c2 = new Coordinate(c.xCoord, y2, c.zCoord); + leaves.addValue(c.yCoord, c2); + } + } + } + } + } + } + + private void generateLayer(World world, Random rand, int x, int y, int z, int h, Coordinate core) { + this.permuteRadius(rand); + int r = currentRadius+2; + for (int i = -r; i <= r; i++) { + for (int k = -r; k <= r; k++) { + double ia = Math.signum(i)*Math.pow(Math.abs(i), 1D/currentRadiusExponent); + double ka = Math.signum(k)*Math.pow(Math.abs(k), 1D/currentRadiusExponent); + double d = Math.pow(ia+ka, currentRadiusExponent); + if (d <= currentRadius) { + Coordinate c = new Coordinate(x+i, core.yCoord, z+k); + leaves.addValue(c.yCoord, c); + lowestLeafY = Math.min(lowestLeafY, c.yCoord); + } + } + } + } + + private void permuteRadius(Random rand) { + if (currentRadius == 0 || rand.nextInt(3) > 0) { + boolean incr = currentRadius < maxFoliageRadius; + boolean decr = currentRadius > 1; + if (incr && decr) { + currentRadius += rand.nextBoolean() ? 1 : -1; + } + else if (incr) { + currentRadius++; + } + else if (decr) { + currentRadius--; + } + } + if (rand.nextInt(2) == 0) { + boolean incr = currentRadiusExponent < 0.65F; + boolean decr = currentRadiusExponent > 0.35F; + int sign = 0; + if (incr && decr) { + sign = rand.nextBoolean() ? 1 : -1; + } + else if (incr) { + sign = 1; + } + else if (decr) { + sign = -1; + } + currentRadiusExponent += sign*ReikaRandomHelper.getRandomBetween(0.025, 0.1, rand); + } + currentRadius = MathHelper.clamp_int(currentRadius, 0, maxFoliageRadius); + currentRadiusExponent = MathHelper.clamp_float(currentRadiusExponent, 0.35F, 0.65F); + } + + private boolean canPlace(World world) { + for (Coordinate c : logs) { + boolean canPlace = this.canReplace(world, c.xCoord, c.yCoord, c.zCoord); + if (!canPlace) + return false; + } + int minLeaves = (int)(leaves.totalSize()*0.75); + int placeable = 0; + for (Coordinate c : leaves.allValues(false)) { + boolean canPlace = this.canReplace(world, c.xCoord, c.yCoord, c.zCoord); + if (canPlace) + placeable++; + } + return placeable >= minLeaves; + } + + private boolean canReplace(World world, int x, int y, int z) { + if (ReikaWorldHelper.softBlocks(world, x, y, z)) + return true; + Block b = world.getBlock(x, y, z); + return b.canBeReplacedByLeaves(world, x, y, z) || b.isLeaves(world, x, y, z); + } + + private void place(World world) { + for (Coordinate c : logs) { + c.setBlock(world, ReikaTreeHelper.OAK.getLogID(), ReikaTreeHelper.OAK.getBaseLogMeta(), 2); + } + for (Coordinate c : leaves.allValues(false)) { + c.setBlock(world, ReikaTreeHelper.OAK.getLeafID(), ReikaTreeHelper.OAK.getBaseLeafMeta(), 2); + } + } + + private class Branch { + + private final Coordinate root; + + private final HashSet logs = new HashSet(); + private final HashSet leaves = new HashSet(); + + private final double xStep; + private final double yStep; + private final double zStep; + + private Branch(Coordinate c, float phi, float theta) { + root = c; + double[] xyz = ReikaPhysicsHelper.polarToCartesian(1, theta, phi); + xStep = xyz[0]; + yStep = xyz[1]; + zStep = xyz[2]; + } + + private void calculate(World world, Random rand) { + int l = ReikaRandomHelper.getRandomBetween(2, maxBranchLength); + for (double d = 0.5; d <= l; d += 0.5) { + double dx = root.xCoord+0.5+xStep*d; + double dy = root.yCoord+0.5+yStep*d; + double dz = root.zCoord+0.5+zStep*d; + Coordinate core = new Coordinate(dx, dy, dz); + logs.add(core); + int n = ReikaRandomHelper.getRandomBetween(8, 20, rand); + for (int i = 0; i < n; i++) { + double dx2 = ReikaRandomHelper.getRandomPlusMinus(dx, 1.5); + double dy2 = ReikaRandomHelper.getRandomPlusMinus(dy, 1.5); + double dz2 = ReikaRandomHelper.getRandomPlusMinus(dz, 1.5); + Coordinate c = new Coordinate(dx2, dy2, dz2); + if (!logs.contains(c)) + leaves.add(c); + } + } + } + + } + + } + +}