From aef5968a71be261fc3f72f2848a6c2ba5e8cab5a Mon Sep 17 00:00:00 2001 From: Roadhog360 Date: Tue, 19 Dec 2023 10:39:22 -0600 Subject: [PATCH] OK SMARTASS INTERPRETER JUST HAVE IT ALL OH THIS IS MISSING OH THAT IS MISSING WHO FUCKING CARES JUST COMPILE IT ANYWAYS AND IGNORE THE ONE GODDAMN MISSING FUNCTION UNTIL I COMMIT THE CODE People be like "oh just use branches" "just commit a bit at a time" I TRY THAT AND THIS SHIT IS WHAT FUCKING HAPPENS build failed build fauileldd sdfbsfogdiuhaeraipiz[p It just leads to build failures So when people tell me to use branches to confuse my code or make more """""organized""""" commits I link them to this message. Yes I'm tilted Let's see Gradle fail this one too because it likes to be an asshole - Add soul fire gen through WorldGenSoulFire and apply it to NetherChunkProvider, so soul fire appears on soul soil when enabled - Due to failures with forge's custom item entity system, it has been removed and replaced with a mixin. Bugs include custom item-entities jittering when first spawned in and /give not dispensing the item into the player's inventory. It's clear the custom item entity system was NOT thoroughly tested by Forge. Old uninflammable items that exist in the world will be converted to the regular item entities automatically. - A system to add/remove items via the config or mod code will be added in the future, as well as adjusting their buoyancy - Add a biome list helper function to Utils.java, to make it easier to create biome lists with certain blacklists --- .../etfuturum/EtFuturumMixinPlugin.java | 4 + .../java/ganymedes01/etfuturum/ModBlocks.java | 6 +- .../java/ganymedes01/etfuturum/ModItems.java | 2 +- .../etfuturum/api/BeePlantRegistry.java | 6 +- .../etfuturum/blocks/BlockAncientDebris.java | 23 ---- .../etfuturum/blocks/BlockNetherite.java | 23 ---- .../blocks/BlockNetheriteStairs.java | 23 ---- .../itemblocks/ItemBlockUninflammable.java | 27 ----- .../configuration/configs/ConfigMixins.java | 2 + .../etfuturum/core/utils/Utils.java | 14 +++ .../entities/EntityItemUninflammable.java | 108 ++---------------- .../items/BaseUninflammableItem.java | 35 ------ .../etfuturum/items/ItemNetheriteIngot.java | 2 +- .../items/equipment/ItemEFRArmour.java | 15 --- .../etfuturum/items/equipment/ItemEFRAxe.java | 17 --- .../etfuturum/items/equipment/ItemEFRHoe.java | 17 --- .../items/equipment/ItemEFRPickaxe.java | 16 --- .../items/equipment/ItemEFRSpade.java | 17 --- .../items/equipment/ItemEFRSword.java | 17 --- .../uninflammableitem/MixinEntityItem.java | 82 +++++++++++++ .../world/EtFuturumWorldGenerator.java | 26 ++--- .../generate/decorate/WorldGenSoulFire.java | 29 +++++ .../nether/dimension/NetherChunkProvider.java | 5 +- 23 files changed, 162 insertions(+), 354 deletions(-) delete mode 100644 src/main/java/ganymedes01/etfuturum/blocks/itemblocks/ItemBlockUninflammable.java delete mode 100644 src/main/java/ganymedes01/etfuturum/items/BaseUninflammableItem.java create mode 100644 src/main/java/ganymedes01/etfuturum/mixins/uninflammableitem/MixinEntityItem.java create mode 100644 src/main/java/ganymedes01/etfuturum/world/generate/decorate/WorldGenSoulFire.java diff --git a/src/main/java/ganymedes01/etfuturum/EtFuturumMixinPlugin.java b/src/main/java/ganymedes01/etfuturum/EtFuturumMixinPlugin.java index f1ee7cde2..3a7125dc6 100644 --- a/src/main/java/ganymedes01/etfuturum/EtFuturumMixinPlugin.java +++ b/src/main/java/ganymedes01/etfuturum/EtFuturumMixinPlugin.java @@ -214,6 +214,10 @@ public List getMixins() { mixins.add("singlelevel.MixinEnchantment"); } + if (ConfigMixins.fireproofItems) { + mixins.add("uninflammableitem.MixinEntityItem"); + } + if (side == MixinEnvironment.Side.CLIENT) { if (ConfigMixins.dustUnderFallingBlocks) { mixins.add("blockfallingparticles.client.MixinBlockFalling"); diff --git a/src/main/java/ganymedes01/etfuturum/ModBlocks.java b/src/main/java/ganymedes01/etfuturum/ModBlocks.java index a47781856..657a51a04 100644 --- a/src/main/java/ganymedes01/etfuturum/ModBlocks.java +++ b/src/main/java/ganymedes01/etfuturum/ModBlocks.java @@ -40,8 +40,8 @@ public enum ModBlocks { CHORUS_FLOWER(ConfigBlocksItems.enableChorusFruit, new BlockChorusFlower()), BONE(ConfigBlocksItems.enableBoneBlock, new BlockBone()), RED_NETHERBRICK(ConfigBlocksItems.enableNewNetherBricks, new BlockNewNetherBrick()), //Also contains chiseled and cracked nether bricks - ANCIENT_DEBRIS(ConfigBlocksItems.enableNetherite, new BlockAncientDebris(), ItemBlockUninflammable.class), - NETHERITE_BLOCK(ConfigBlocksItems.enableNetherite, new BlockNetherite(), ItemBlockUninflammable.class), + ANCIENT_DEBRIS(ConfigBlocksItems.enableNetherite, new BlockAncientDebris()), + NETHERITE_BLOCK(ConfigBlocksItems.enableNetherite, new BlockNetherite()), NETHER_GOLD_ORE(ConfigBlocksItems.enableNetherGold, new BlockOreNetherGold()), BLUE_ICE(ConfigBlocksItems.enableBlueIce, new BlockBlueIce()), SMOOTH_STONE(ConfigBlocksItems.enableSmoothStone, new BaseBlock(Material.rock).setUnlocalizedNameWithPrefix("smooth_stone") @@ -450,7 +450,7 @@ public enum ModBlocks { //Creative-only stuff - NETHERITE_STAIRS(ConfigBlocksItems.enableNetherite, new BlockNetheriteStairs(), ItemBlockUninflammable.class), + NETHERITE_STAIRS(ConfigBlocksItems.enableNetherite, new BlockNetheriteStairs()), END_GATEWAY(Reference.TESTING, new BlockEndGateway()), LIGHT(ConfigBlocksItems.enableLightBlock, new BlockLight()), BARRIER(ConfigBlocksItems.enableBarrier, new BlockBarrier()), diff --git a/src/main/java/ganymedes01/etfuturum/ModItems.java b/src/main/java/ganymedes01/etfuturum/ModItems.java index 4de0bfe25..e30a99238 100644 --- a/src/main/java/ganymedes01/etfuturum/ModItems.java +++ b/src/main/java/ganymedes01/etfuturum/ModItems.java @@ -39,7 +39,7 @@ public enum ModItems { NUGGET_IRON(ConfigBlocksItems.enableIronNugget, new BaseItem("iron_nugget")), RAW_ORE(ConfigBlocksItems.enableRawOres, new BaseSubtypesItem("raw_copper", "raw_iron", "raw_gold").setNames("raw_ore")), //modded_raw_ore(true, new ItemRawOre(true)), - NETHERITE_SCRAP(ConfigBlocksItems.enableNetherite, new BaseUninflammableItem("netherite_scrap")), + NETHERITE_SCRAP(ConfigBlocksItems.enableNetherite, new BaseItem("netherite_scrap")), NETHERITE_INGOT(ConfigBlocksItems.enableNetherite, new ItemNetheriteIngot()), NETHERITE_HELMET(ConfigBlocksItems.enableNetherite, new ItemEFRArmour(ModMaterials.NETHERITE_ARMOUR, 0, ConfigBlocksItems.netheriteHelmetDurability)), NETHERITE_CHESTPLATE(ConfigBlocksItems.enableNetherite, new ItemEFRArmour(ModMaterials.NETHERITE_ARMOUR, 1, ConfigBlocksItems.netheriteChestplateDurability)), diff --git a/src/main/java/ganymedes01/etfuturum/api/BeePlantRegistry.java b/src/main/java/ganymedes01/etfuturum/api/BeePlantRegistry.java index 84e84bc10..b6aac8b16 100644 --- a/src/main/java/ganymedes01/etfuturum/api/BeePlantRegistry.java +++ b/src/main/java/ganymedes01/etfuturum/api/BeePlantRegistry.java @@ -29,7 +29,7 @@ public static void addFlower(Block block, int meta) { throw new IllegalArgumentException("BlockDoublePlant can't have meta greater than 7, 8 and above are used by the top half. Bees will go to the top half if the bottom meta is valid."); } if (ModRecipes.validateItems(block)) { - BEE_FLOWERS.add(new RegistryMapping<>(block, meta)); + BEE_FLOWERS.add(RegistryMapping.getKeyFor(block, meta)); } } @@ -41,7 +41,7 @@ public static void addCrop(Block block) { } public static void removeFlower(Block block, int meta) { - BEE_FLOWERS.remove(new RegistryMapping<>(block, meta)); + BEE_FLOWERS.remove(RegistryMapping.getKeyFor(block, meta)); } public static void removeCrop(Block block) { @@ -49,7 +49,7 @@ public static void removeCrop(Block block) { } public static boolean isFlower(Block block, int meta) { - return BEE_FLOWERS.contains(new RegistryMapping<>(block, meta)); + return BEE_FLOWERS.contains(RegistryMapping.getKeyFor(block, meta)); } public static boolean isCrop(Block block) { diff --git a/src/main/java/ganymedes01/etfuturum/blocks/BlockAncientDebris.java b/src/main/java/ganymedes01/etfuturum/blocks/BlockAncientDebris.java index d29c85416..ddc6f8393 100644 --- a/src/main/java/ganymedes01/etfuturum/blocks/BlockAncientDebris.java +++ b/src/main/java/ganymedes01/etfuturum/blocks/BlockAncientDebris.java @@ -5,14 +5,10 @@ import ganymedes01.etfuturum.EtFuturum; import ganymedes01.etfuturum.client.sound.ModSounds; import ganymedes01.etfuturum.core.utils.Utils; -import ganymedes01.etfuturum.entities.EntityItemUninflammable; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import net.minecraft.world.World; public class BlockAncientDebris extends Block { @@ -42,23 +38,4 @@ public void registerBlockIcons(IIconRegister register) { blockIcon = register.registerIcon(this.getTextureName() + "_side"); iconTop = register.registerIcon(this.getTextureName() + "_top"); } - - @Override - protected void dropBlockAsItem(World world, int x, int y, int z, ItemStack stack) { - // do not drop items while restoring blockstates, prevents item dupe - if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops") && !world.restoringBlockSnapshots) { - if (captureDrops.get()) { - capturedDrops.get().add(stack); - return; - } - float f = 0.7F; - double d0 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D; - double d1 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D; - double d2 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D; - EntityItem entityitem = new EntityItemUninflammable(world, x + d0, y + d1, z + d2, stack); - entityitem.delayBeforeCanPickup = 10; - world.spawnEntityInWorld(entityitem); - } - } - } diff --git a/src/main/java/ganymedes01/etfuturum/blocks/BlockNetherite.java b/src/main/java/ganymedes01/etfuturum/blocks/BlockNetherite.java index b93ee41c6..a5b42153f 100644 --- a/src/main/java/ganymedes01/etfuturum/blocks/BlockNetherite.java +++ b/src/main/java/ganymedes01/etfuturum/blocks/BlockNetherite.java @@ -3,13 +3,9 @@ import ganymedes01.etfuturum.EtFuturum; import ganymedes01.etfuturum.client.sound.ModSounds; import ganymedes01.etfuturum.core.utils.Utils; -import ganymedes01.etfuturum.entities.EntityItemUninflammable; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; public class BlockNetherite extends Block { @@ -28,23 +24,4 @@ public BlockNetherite() { public boolean isBeaconBase(IBlockAccess world, int x, int y, int z, int bX, int bY, int bZ) { return true; } - - @Override - protected void dropBlockAsItem(World world, int x, int y, int z, ItemStack stack) { - // do not drop items while restoring blockstates, prevents item dupe - if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops") && !world.restoringBlockSnapshots) { - if (captureDrops.get()) { - capturedDrops.get().add(stack); - return; - } - float f = 0.7F; - double d0 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D; - double d1 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D; - double d2 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D; - EntityItem entityitem = new EntityItemUninflammable(world, x + d0, y + d1, z + d2, stack); - entityitem.delayBeforeCanPickup = 10; - world.spawnEntityInWorld(entityitem); - } - } - } diff --git a/src/main/java/ganymedes01/etfuturum/blocks/BlockNetheriteStairs.java b/src/main/java/ganymedes01/etfuturum/blocks/BlockNetheriteStairs.java index 287532dc9..fc0a0cb8f 100644 --- a/src/main/java/ganymedes01/etfuturum/blocks/BlockNetheriteStairs.java +++ b/src/main/java/ganymedes01/etfuturum/blocks/BlockNetheriteStairs.java @@ -1,10 +1,6 @@ package ganymedes01.etfuturum.blocks; import ganymedes01.etfuturum.ModBlocks; -import ganymedes01.etfuturum.entities.EntityItemUninflammable; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; public class BlockNetheriteStairs extends BaseStairs { @@ -12,23 +8,4 @@ public BlockNetheriteStairs() { super(ModBlocks.NETHERITE_BLOCK.get(), 0); setUnlocalizedNameWithPrefix("netherite"); } - - @Override - protected void dropBlockAsItem(World world, int x, int y, int z, ItemStack stack) { - // do not drop items while restoring blockstates, prevents item dupe - if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops") && !world.restoringBlockSnapshots) { - if (captureDrops.get()) { - capturedDrops.get().add(stack); - return; - } - float f = 0.7F; - double d0 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D; - double d1 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D; - double d2 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D; - EntityItem entityitem = new EntityItemUninflammable(world, x + d0, y + d1, z + d2, stack); - entityitem.delayBeforeCanPickup = 10; - world.spawnEntityInWorld(entityitem); - } - } - } diff --git a/src/main/java/ganymedes01/etfuturum/blocks/itemblocks/ItemBlockUninflammable.java b/src/main/java/ganymedes01/etfuturum/blocks/itemblocks/ItemBlockUninflammable.java deleted file mode 100644 index c4d55e0bc..000000000 --- a/src/main/java/ganymedes01/etfuturum/blocks/itemblocks/ItemBlockUninflammable.java +++ /dev/null @@ -1,27 +0,0 @@ -package ganymedes01.etfuturum.blocks.itemblocks; - -import ganymedes01.etfuturum.configuration.configs.ConfigFunctions; -import ganymedes01.etfuturum.items.BaseUninflammableItem; -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public class ItemBlockUninflammable extends ItemBlock { - - public ItemBlockUninflammable(Block block) { - super(block); - } - - @Override - public boolean hasCustomEntity(ItemStack stack) { - return !ConfigFunctions.enableNetheriteFlammable; - } - - @Override - public Entity createEntity(World world, Entity location, ItemStack itemstack) { - return BaseUninflammableItem.createUninflammableItem(world, location); - } - -} diff --git a/src/main/java/ganymedes01/etfuturum/configuration/configs/ConfigMixins.java b/src/main/java/ganymedes01/etfuturum/configuration/configs/ConfigMixins.java index 79d7f4949..7bf5d152d 100644 --- a/src/main/java/ganymedes01/etfuturum/configuration/configs/ConfigMixins.java +++ b/src/main/java/ganymedes01/etfuturum/configuration/configs/ConfigMixins.java @@ -41,6 +41,7 @@ public class ConfigMixins extends ConfigBase { public static boolean soulFire; public static boolean interpolatedTextures; public static boolean hideSingleLevelEnchants; + public static boolean fireproofItems; static final String catBackport = "backported features"; static final String catOptimization = "optimizations"; @@ -96,6 +97,7 @@ protected void syncConfigOptions() { enableElytra = getBoolean("enableElytra", catBackport, true, "A port of Backlytra with various fixes. The original author of this is unascribed: https://legacy.curseforge.com/minecraft/mc-mods/backlytra\nIf you're getting crash related to the DataWatcher, try changing \"elytraDataWatcherFlag\" in functions.cfg and don't open an issue if changing that value fixes it.\nModified Classes: net.minecraft.entity.EntityLivingBase net.minecraft.entity.player.EntityPlayer net.minecraft.entity.EntityTrackerEntry net.minecraft.network.NetHandlerPlayServer\nModified Client Classes: net.minecraft.client.entity.AbstractClientPlayer net.minecraft.client.entity.EntityPlayerSP net.minecraft.client.model.ModelBiped net.minecraft.client.renderer.entity.RenderPlayer"); betterPistons = getBoolean("betterPistons", catBackport, true, "A port of Back in Slime, similar to how the elytra is a port of Backlytra. Allows pistons to interact with slime blocks. The original author of this is DonBruce64: https://legacy.curseforge.com/minecraft/mc-mods/back-in-slime-slime-blocks-for-1-7.\nModified Classes: net.minecraft.block.BlockPistonBase"); soulFire = getBoolean("soulFire", catBackport, true, "Is not a new block, but rather a mixin for fire. Allows fire to stay ignited on soul soil. Does double damage when standing in it, and does not spread to other blocks.\nEven if this is off fire can still stay ignited on soul soil, but do be mindful that fire will spread from soul soil if this option is disabled.\nModified Classes: net.minecraft.block.BlockFire net.minecraft.entity.Entity\nModified Client Classes: net.minecraft.client.renderer.RenderBlocks"); + fireproofItems = getBoolean("fireproofItems", catBackport, true, "Some items such as Netherite will not burn in fire and will float to the surface of lava."); stepHeightFix = getBoolean("stepHeightFix", catFixes, true, "Makes the player able to step up even if a block would be above their head at the destination.\nModified classes: net.minecraft.entity.Entity"); arrowFallingFix = getBoolean("arrowFallingFix", catFixes, true, "Prevents arrows from falling off of blocks too easily\nModified classes: net.minecraft.entity.EntityArrow"); diff --git a/src/main/java/ganymedes01/etfuturum/core/utils/Utils.java b/src/main/java/ganymedes01/etfuturum/core/utils/Utils.java index 13dfb27ec..15a522926 100644 --- a/src/main/java/ganymedes01/etfuturum/core/utils/Utils.java +++ b/src/main/java/ganymedes01/etfuturum/core/utils/Utils.java @@ -13,8 +13,11 @@ import net.minecraft.util.*; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraftforge.common.BiomeDictionary; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.oredict.OreDictionary; +import org.apache.commons.lang3.ArrayUtils; import java.util.*; @@ -433,4 +436,15 @@ public static long hashPos(int x, int y, int z) { public static long cantor(long a, long b) { return (a + b + 1) * (a + b) / 2 + b; } + + public static BiomeGenBase[] excludeBiomesFromTypesWithDefaults(BiomeGenBase[] list, BiomeDictionary.Type... typesBlacklist) { + return excludeBiomesFromTypes(list, ArrayUtils.addAll(typesBlacklist, BiomeDictionary.Type.NETHER, BiomeDictionary.Type.END, BiomeDictionary.Type.DEAD, BiomeDictionary.Type.SPOOKY, BiomeDictionary.Type.WASTELAND)); + } + + public static BiomeGenBase[] excludeBiomesFromTypes(BiomeGenBase[] list, BiomeDictionary.Type... typesBlacklist) { + for (BiomeDictionary.Type typeToBlacklist : typesBlacklist) { + list = ArrayUtils.removeElements(list, BiomeDictionary.getBiomesForType(typeToBlacklist)); + } + return list; + } } \ No newline at end of file diff --git a/src/main/java/ganymedes01/etfuturum/entities/EntityItemUninflammable.java b/src/main/java/ganymedes01/etfuturum/entities/EntityItemUninflammable.java index 01a47786a..19e06efed 100644 --- a/src/main/java/ganymedes01/etfuturum/entities/EntityItemUninflammable.java +++ b/src/main/java/ganymedes01/etfuturum/entities/EntityItemUninflammable.java @@ -1,17 +1,15 @@ package ganymedes01.etfuturum.entities; -import ganymedes01.etfuturum.configuration.configs.ConfigFunctions; -import net.minecraft.block.material.Material; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; -import net.minecraft.util.MathHelper; import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.entity.item.ItemExpireEvent; - -import java.util.Iterator; +@Deprecated +/** + * No longer used in favor of a mixin. + */ public class EntityItemUninflammable extends EntityItem { public EntityItemUninflammable(World p_i1711_1_) { @@ -33,96 +31,12 @@ protected void dealFireDamage(int p_70081_1_) { @Override public void onUpdate() { - if (isBurning()) - extinguish(); - - ItemStack stack = this.getDataWatcher().getWatchableObjectItemStack(10); - if (stack != null && stack.getItem() != null) { - if (stack.getItem().onEntityItemUpdate(this)) { - return; - } - } - - if (this.getEntityItem() == null) { - this.setDead(); - } else if (ConfigFunctions.enableNetheriteFlammable) { - EntityItem item = new EntityItem(this.worldObj); - item.copyDataFrom(this, true); - item.delayBeforeCanPickup = this.delayBeforeCanPickup; - item.copyLocationAndAnglesFrom(this); - item.worldObj.spawnEntityInWorld(item); - this.setDead(); - } else { - onEntityUpdate(); - - if (this.delayBeforeCanPickup > 0) { - --this.delayBeforeCanPickup; - } - - boolean inlava = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)) - .getMaterial() == Material.lava; - this.prevPosX = this.posX; - this.prevPosY = this.posY; - this.prevPosZ = this.posZ; - this.noClip = this.func_145771_j(this.posX, (this.boundingBox.minY + this.boundingBox.maxY) / 2.0D, this.posZ); - if (inlava) { - this.moveEntity(this.motionX, this.motionY + 0.036D, this.motionZ); - } else { - this.motionY -= 0.03999999910593033D; - this.moveEntity(this.motionX, this.motionY, this.motionZ); - } - boolean flag = (int) this.prevPosX != (int) this.posX || (int) this.prevPosY != (int) this.posY || (int) this.prevPosZ != (int) this.posZ; - - if (flag || this.ticksExisted % 25 == 0) { - if (!this.worldObj.isRemote) { - this.searchForOtherItemsNearby(); - } - } - - float f = 0.98F; - - if (this.onGround) { - f = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)).slipperiness * 0.98F; - } - - this.motionX *= f; - this.motionY *= 0.9800000190734863D; - this.motionZ *= f; - - if (this.onGround) { - this.motionY *= -0.5D; - } - - ++this.age; - - ItemStack item = getDataWatcher().getWatchableObjectItemStack(10); - - if (!this.worldObj.isRemote && this.age >= lifespan) { - if (item != null) { - ItemExpireEvent event = new ItemExpireEvent(this, (item.getItem() == null ? 6000 : item.getItem().getEntityLifespan(item, worldObj))); - if (MinecraftForge.EVENT_BUS.post(event)) { - lifespan += event.extraLife; - } else { - this.setDead(); - } - } else { - this.setDead(); - } - } - - if (item != null && item.stackSize <= 0) { - this.setDead(); - } - } - } - - private void searchForOtherItemsNearby() { - Iterator iterator = this.worldObj.getEntitiesWithinAABB(EntityItem.class, this.boundingBox.expand(0.5D, 0.0D, 0.5D)).iterator(); - - while (iterator.hasNext()) { - EntityItem entityitem = iterator.next(); - this.combineItems(entityitem); - } + EntityItem item = new EntityItem(worldObj, posX, posY, posZ, getEntityItem()); + NBTTagCompound comp = new NBTTagCompound(); + writeToNBT(comp); + item.readEntityFromNBT(comp); + worldObj.onEntityAdded(item); + setDead(); } @Override diff --git a/src/main/java/ganymedes01/etfuturum/items/BaseUninflammableItem.java b/src/main/java/ganymedes01/etfuturum/items/BaseUninflammableItem.java deleted file mode 100644 index 58086e083..000000000 --- a/src/main/java/ganymedes01/etfuturum/items/BaseUninflammableItem.java +++ /dev/null @@ -1,35 +0,0 @@ -package ganymedes01.etfuturum.items; - -import ganymedes01.etfuturum.configuration.configs.ConfigFunctions; -import ganymedes01.etfuturum.entities.EntityItemUninflammable; -import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public class BaseUninflammableItem extends BaseItem { - - public BaseUninflammableItem(String names) { - super(names); - } - - @Override - public boolean hasCustomEntity(ItemStack stack) { - return !ConfigFunctions.enableNetheriteFlammable; - } - - @Override - public Entity createEntity(World world, Entity location, ItemStack itemstack) { - return createUninflammableItem(world, location); - } - - public static Entity createUninflammableItem(World world, Entity location) { - if (ConfigFunctions.enableNetheriteFlammable) - return null; - EntityItemUninflammable entity = new EntityItemUninflammable(world); - entity.copyDataFrom(location, true); - entity.copyLocationAndAnglesFrom(location); - entity.delayBeforeCanPickup = ((EntityItem) location).delayBeforeCanPickup; - return entity; - } -} diff --git a/src/main/java/ganymedes01/etfuturum/items/ItemNetheriteIngot.java b/src/main/java/ganymedes01/etfuturum/items/ItemNetheriteIngot.java index 1d8cd2e6f..b278b9832 100644 --- a/src/main/java/ganymedes01/etfuturum/items/ItemNetheriteIngot.java +++ b/src/main/java/ganymedes01/etfuturum/items/ItemNetheriteIngot.java @@ -2,7 +2,7 @@ import net.minecraft.item.ItemStack; -public class ItemNetheriteIngot extends BaseUninflammableItem { +public class ItemNetheriteIngot extends BaseItem { public ItemNetheriteIngot() { super("netherite_ingot"); diff --git a/src/main/java/ganymedes01/etfuturum/items/equipment/ItemEFRArmour.java b/src/main/java/ganymedes01/etfuturum/items/equipment/ItemEFRArmour.java index e8d449f18..f830141d3 100644 --- a/src/main/java/ganymedes01/etfuturum/items/equipment/ItemEFRArmour.java +++ b/src/main/java/ganymedes01/etfuturum/items/equipment/ItemEFRArmour.java @@ -4,16 +4,13 @@ import cpw.mods.fml.relauncher.SideOnly; import ganymedes01.etfuturum.EtFuturum; import ganymedes01.etfuturum.ModItems; -import ganymedes01.etfuturum.configuration.configs.ConfigFunctions; import ganymedes01.etfuturum.core.utils.Utils; -import ganymedes01.etfuturum.items.BaseUninflammableItem; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; -import net.minecraft.world.World; import net.minecraftforge.common.ISpecialArmor; public class ItemEFRArmour extends ItemArmor implements ISpecialArmor { @@ -50,18 +47,6 @@ public String getArmorTexture(ItemStack stack, Entity entity, int slot, String t return this.armorType == 2 ? "textures/models/armor/" + wearingType + "_layer_2.png" : "textures/models/armor/" + wearingType + "_layer_1.png"; } - @Override - public boolean hasCustomEntity(ItemStack stack) { - return getUnlocalizedName().contains("netherite") && !ConfigFunctions.enableNetheriteFlammable; - } - - @Override - public Entity createEntity(World world, Entity location, ItemStack itemstack) { - if (!getUnlocalizedName().contains("netherite")) - return null; - return BaseUninflammableItem.createUninflammableItem(world, location); - } - @Override public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { ItemEFRArmour armorItem = (ItemEFRArmour) armor.getItem(); diff --git a/src/main/java/ganymedes01/etfuturum/items/equipment/ItemEFRAxe.java b/src/main/java/ganymedes01/etfuturum/items/equipment/ItemEFRAxe.java index 18ba6aaee..7f571d0b3 100644 --- a/src/main/java/ganymedes01/etfuturum/items/equipment/ItemEFRAxe.java +++ b/src/main/java/ganymedes01/etfuturum/items/equipment/ItemEFRAxe.java @@ -2,13 +2,9 @@ import ganymedes01.etfuturum.EtFuturum; import ganymedes01.etfuturum.ModItems; -import ganymedes01.etfuturum.configuration.configs.ConfigFunctions; import ganymedes01.etfuturum.core.utils.Utils; -import ganymedes01.etfuturum.items.BaseUninflammableItem; -import net.minecraft.entity.Entity; import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemStack; -import net.minecraft.world.World; public class ItemEFRAxe extends ItemAxe { @@ -24,17 +20,4 @@ public ItemEFRAxe(ToolMaterial material, int durabilityOverride) { public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) { return ModItems.NETHERITE_INGOT.get() == par2ItemStack.getItem() || super.getIsRepairable(par1ItemStack, par2ItemStack); } - - @Override - public boolean hasCustomEntity(ItemStack stack) { - return getUnlocalizedName().contains("netherite") && !ConfigFunctions.enableNetheriteFlammable; - } - - @Override - public Entity createEntity(World world, Entity location, ItemStack itemstack) { - if (!getUnlocalizedName().contains("netherite")) - return null; - return BaseUninflammableItem.createUninflammableItem(world, location); - } - } diff --git a/src/main/java/ganymedes01/etfuturum/items/equipment/ItemEFRHoe.java b/src/main/java/ganymedes01/etfuturum/items/equipment/ItemEFRHoe.java index fd8fa8bc6..18950798e 100644 --- a/src/main/java/ganymedes01/etfuturum/items/equipment/ItemEFRHoe.java +++ b/src/main/java/ganymedes01/etfuturum/items/equipment/ItemEFRHoe.java @@ -2,13 +2,9 @@ import ganymedes01.etfuturum.EtFuturum; import ganymedes01.etfuturum.ModItems; -import ganymedes01.etfuturum.configuration.configs.ConfigFunctions; import ganymedes01.etfuturum.core.utils.Utils; -import ganymedes01.etfuturum.items.BaseUninflammableItem; -import net.minecraft.entity.Entity; import net.minecraft.item.ItemHoe; import net.minecraft.item.ItemStack; -import net.minecraft.world.World; public class ItemEFRHoe extends ItemHoe { @@ -24,17 +20,4 @@ public ItemEFRHoe(ToolMaterial material, int durabilityOverride) { public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) { return ModItems.NETHERITE_INGOT.get() == par2ItemStack.getItem() || super.getIsRepairable(par1ItemStack, par2ItemStack); } - - @Override - public boolean hasCustomEntity(ItemStack stack) { - return getUnlocalizedName().contains("netherite") && !ConfigFunctions.enableNetheriteFlammable; - } - - @Override - public Entity createEntity(World world, Entity location, ItemStack itemstack) { - if (!getUnlocalizedName().contains("netherite")) - return null; - return BaseUninflammableItem.createUninflammableItem(world, location); - } - } diff --git a/src/main/java/ganymedes01/etfuturum/items/equipment/ItemEFRPickaxe.java b/src/main/java/ganymedes01/etfuturum/items/equipment/ItemEFRPickaxe.java index 95d3389c4..fea4e1222 100644 --- a/src/main/java/ganymedes01/etfuturum/items/equipment/ItemEFRPickaxe.java +++ b/src/main/java/ganymedes01/etfuturum/items/equipment/ItemEFRPickaxe.java @@ -2,13 +2,9 @@ import ganymedes01.etfuturum.EtFuturum; import ganymedes01.etfuturum.ModItems; -import ganymedes01.etfuturum.configuration.configs.ConfigFunctions; import ganymedes01.etfuturum.core.utils.Utils; -import ganymedes01.etfuturum.items.BaseUninflammableItem; -import net.minecraft.entity.Entity; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; -import net.minecraft.world.World; public class ItemEFRPickaxe extends ItemPickaxe { @@ -24,16 +20,4 @@ public ItemEFRPickaxe(ToolMaterial material, int durabilityOverride) { public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) { return ModItems.NETHERITE_INGOT.get() == par2ItemStack.getItem() || super.getIsRepairable(par1ItemStack, par2ItemStack); } - - @Override - public boolean hasCustomEntity(ItemStack stack) { - return getUnlocalizedName().contains("netherite") && !ConfigFunctions.enableNetheriteFlammable; - } - - @Override - public Entity createEntity(World world, Entity location, ItemStack itemstack) { - if (!getUnlocalizedName().contains("netherite")) - return null; - return BaseUninflammableItem.createUninflammableItem(world, location); - } } diff --git a/src/main/java/ganymedes01/etfuturum/items/equipment/ItemEFRSpade.java b/src/main/java/ganymedes01/etfuturum/items/equipment/ItemEFRSpade.java index fa6f52658..91abe6f78 100644 --- a/src/main/java/ganymedes01/etfuturum/items/equipment/ItemEFRSpade.java +++ b/src/main/java/ganymedes01/etfuturum/items/equipment/ItemEFRSpade.java @@ -2,13 +2,9 @@ import ganymedes01.etfuturum.EtFuturum; import ganymedes01.etfuturum.ModItems; -import ganymedes01.etfuturum.configuration.configs.ConfigFunctions; import ganymedes01.etfuturum.core.utils.Utils; -import ganymedes01.etfuturum.items.BaseUninflammableItem; -import net.minecraft.entity.Entity; import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemStack; -import net.minecraft.world.World; public class ItemEFRSpade extends ItemSpade { @@ -24,17 +20,4 @@ public ItemEFRSpade(ToolMaterial material, int durabilityOverride) { public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) { return ModItems.NETHERITE_INGOT.get() == par2ItemStack.getItem() || super.getIsRepairable(par1ItemStack, par2ItemStack); } - - @Override - public boolean hasCustomEntity(ItemStack stack) { - return getUnlocalizedName().contains("netherite") && !ConfigFunctions.enableNetheriteFlammable; - } - - @Override - public Entity createEntity(World world, Entity location, ItemStack itemstack) { - if (!getUnlocalizedName().contains("netherite")) - return null; - return BaseUninflammableItem.createUninflammableItem(world, location); - } - } diff --git a/src/main/java/ganymedes01/etfuturum/items/equipment/ItemEFRSword.java b/src/main/java/ganymedes01/etfuturum/items/equipment/ItemEFRSword.java index 9f51938d7..77b601397 100644 --- a/src/main/java/ganymedes01/etfuturum/items/equipment/ItemEFRSword.java +++ b/src/main/java/ganymedes01/etfuturum/items/equipment/ItemEFRSword.java @@ -2,13 +2,9 @@ import ganymedes01.etfuturum.EtFuturum; import ganymedes01.etfuturum.ModItems; -import ganymedes01.etfuturum.configuration.configs.ConfigFunctions; import ganymedes01.etfuturum.core.utils.Utils; -import ganymedes01.etfuturum.items.BaseUninflammableItem; -import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; -import net.minecraft.world.World; public class ItemEFRSword extends ItemSword { @@ -24,17 +20,4 @@ public ItemEFRSword(ToolMaterial material, int durabilityOverride) { public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) { return ModItems.NETHERITE_INGOT.get() == par2ItemStack.getItem() || super.getIsRepairable(par1ItemStack, par2ItemStack); } - - @Override - public boolean hasCustomEntity(ItemStack stack) { - return getUnlocalizedName().contains("netherite") && !ConfigFunctions.enableNetheriteFlammable; - } - - @Override - public Entity createEntity(World world, Entity location, ItemStack itemstack) { - if (!getUnlocalizedName().contains("netherite")) - return null; - return BaseUninflammableItem.createUninflammableItem(world, location); - } - } diff --git a/src/main/java/ganymedes01/etfuturum/mixins/uninflammableitem/MixinEntityItem.java b/src/main/java/ganymedes01/etfuturum/mixins/uninflammableitem/MixinEntityItem.java new file mode 100644 index 000000000..fc19a0026 --- /dev/null +++ b/src/main/java/ganymedes01/etfuturum/mixins/uninflammableitem/MixinEntityItem.java @@ -0,0 +1,82 @@ +package ganymedes01.etfuturum.mixins.uninflammableitem; + +import ganymedes01.etfuturum.EtFuturum; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import java.util.List; + +@Mixin(EntityItem.class) +public abstract class MixinEntityItem extends Entity { + + @Shadow + public abstract ItemStack getEntityItem(); + + public MixinEntityItem(World p_i1582_1_) { + super(p_i1582_1_); + } + + private void makeImmuneToFire(ItemStack stack) { + if (stack != null) { + List tags = EtFuturum.getOreStrings(stack); + if (getEntityItem().getUnlocalizedName().contains("netherite") + || tags.contains("oreDebris") || tags.contains("scrapDebris") + || tags.contains("ingotNetherite") || tags.contains("blockNetherite")) { + this.isImmuneToFire = true; + this.fireResistance = Integer.MAX_VALUE; + } else if (isImmuneToFire) { + this.isImmuneToFire = false; + this.fireResistance = 1; + } + } + } + + @Inject(method = "onUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;onUpdate()V")) + private void applyFireImmunity(CallbackInfo ci) { + if (ticksExisted == 1) { + makeImmuneToFire(getEntityItem()); + } + } + + @Redirect(method = "onUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/item/EntityItem;moveEntity(DDD)V")) + private void floatLava(EntityItem instance, double mx, double my, double mz) { + double buoyancy = 0; + if (isImmuneToFire && this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)).getMaterial() == Material.lava) { + motionY += 0.04D; //Cancels the gravity applied to the item + my += 0.04D; //Also do this; I want to use the variables for compatibility sake + buoyancy = 0.3D; + } + moveEntity(mx, my + buoyancy, mz); + } + + @Redirect(method = "onUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;getBlock(III)Lnet/minecraft/block/Block;")) + private Block noFizzBounce(World instance, int x, int y, int z) { //Returns AIR so the check for lava is false; we do this to remove the fizzing and bouncing + return isImmuneToFire ? Blocks.air : worldObj.getBlock(x, y, z); + } + + @Override + public boolean isBurning() { + return !isImmuneToFire && super.isBurning(); + } + + @Inject(method = "attackEntityFrom", at = @At(value = "HEAD"), cancellable = true) + public void attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_, CallbackInfoReturnable cir) { + if (isImmuneToFire && p_70097_1_.isFireDamage()) { + cir.setReturnValue(false); + } + } +} diff --git a/src/main/java/ganymedes01/etfuturum/world/EtFuturumWorldGenerator.java b/src/main/java/ganymedes01/etfuturum/world/EtFuturumWorldGenerator.java index 046b5c850..71430c860 100644 --- a/src/main/java/ganymedes01/etfuturum/world/EtFuturumWorldGenerator.java +++ b/src/main/java/ganymedes01/etfuturum/world/EtFuturumWorldGenerator.java @@ -5,6 +5,7 @@ import ganymedes01.etfuturum.blocks.BlockChorusFlower; import ganymedes01.etfuturum.compat.ModsList; import ganymedes01.etfuturum.configuration.configs.ConfigWorld; +import ganymedes01.etfuturum.core.utils.Utils; import ganymedes01.etfuturum.world.end.dimension.WorldProviderEFREnd; import ganymedes01.etfuturum.world.generate.WorldGenDeepslateLayerBlob; import ganymedes01.etfuturum.world.generate.WorldGenMinableCustom; @@ -94,27 +95,27 @@ public void postInit() { } } fossilBiomesArray = ArrayUtils.addAll(fossilBiomesArray, BiomeDictionary.getBiomesForType(Type.SWAMP)); - fossilBiomesArray = excludeBiomesFromTypes(fossilBiomesArray, Type.NETHER, Type.END); + fossilBiomesArray = Utils.excludeBiomesFromTypes(fossilBiomesArray, Type.NETHER, Type.END); fossilBiomes = Arrays.asList(fossilBiomesArray); fossilGen = new WorldGenFossil(); } if (ModBlocks.SWEET_BERRY_BUSH.isEnabled()) { - berryBushBiomes = Arrays.asList(excludeBiomesFromTypesWithDefaults(BiomeDictionary.getBiomesForType(Type.CONIFEROUS))); + berryBushBiomes = Arrays.asList(Utils.excludeBiomesFromTypesWithDefaults(BiomeDictionary.getBiomesForType(Type.CONIFEROUS))); berryBushGen = new WorldGenFlowers(ModBlocks.SWEET_BERRY_BUSH.get()); ((WorldGenFlowers) berryBushGen).func_150550_a(ModBlocks.SWEET_BERRY_BUSH.get(), 3); } if (ModBlocks.LILY_OF_THE_VALLEY.isEnabled()) { BiomeGenBase[] lilyValleyBiomeArray = BiomeDictionary.getBiomesForType(Type.FOREST); - lilyValleyBiomeArray = excludeBiomesFromTypes(lilyValleyBiomeArray, Type.JUNGLE, Type.DRY, Type.HOT, Type.SNOWY, Type.COLD); + lilyValleyBiomeArray = Utils.excludeBiomesFromTypes(lilyValleyBiomeArray, Type.JUNGLE, Type.DRY, Type.HOT, Type.SNOWY, Type.COLD); lilyValleyBiomes = Arrays.asList(lilyValleyBiomeArray); lilyValleyGen = new WorldGenFlowers(ModBlocks.LILY_OF_THE_VALLEY.get()); } if (ModBlocks.CORNFLOWER.isEnabled()) { BiomeGenBase[] cornflowerBiomeArray = BiomeDictionary.getBiomesForType(Type.PLAINS); - cornflowerBiomeArray = excludeBiomesFromTypes(cornflowerBiomeArray, Type.SAVANNA, Type.SNOWY, Type.SAVANNA); + cornflowerBiomeArray = Utils.excludeBiomesFromTypes(cornflowerBiomeArray, Type.SAVANNA, Type.SNOWY, Type.SAVANNA); cornflowerBiomeArray = ArrayUtils.add(cornflowerBiomeArray, BiomeGenBase.getBiome(BiomeGenBase.forest.biomeID + 128)); cornflowerBiomes = Arrays.asList(cornflowerBiomeArray); cornflowerGen = new WorldGenFlowers(ModBlocks.CORNFLOWER.get()); @@ -132,12 +133,12 @@ public void postInit() { BiomeDictionary.registerBiomeType(BiomeGenBase.getBiome(151), Type.JUNGLE); } bambooGen = new WorldGenBamboo(ModBlocks.BAMBOO.get()); - bambooBiomes = Arrays.asList(excludeBiomesFromTypesWithDefaults(BiomeDictionary.getBiomesForType(Type.JUNGLE))); + bambooBiomes = Arrays.asList(Utils.excludeBiomesFromTypesWithDefaults(BiomeDictionary.getBiomesForType(Type.JUNGLE))); } if (ModBlocks.CHERRY_LOG.isEnabled() && ModBlocks.LEAVES.isEnabled()) { BiomeGenBase[] cherryBiomeArray = BiomeDictionary.getBiomesForType(Type.MOUNTAIN); - cherryBiomeArray = excludeBiomesFromTypesWithDefaults(cherryBiomeArray, Type.SNOWY, Type.HOT, Type.SANDY, Type.MESA, Type.SPARSE); + cherryBiomeArray = Utils.excludeBiomesFromTypesWithDefaults(cherryBiomeArray, Type.SNOWY, Type.HOT, Type.SANDY, Type.MESA, Type.SPARSE); cherryBiomes = Arrays.asList(cherryBiomeArray); cherryTreeGen = new WorldGenCherryTrees(false); } @@ -154,17 +155,6 @@ public void postInit() { } - private static BiomeGenBase[] excludeBiomesFromTypesWithDefaults(BiomeGenBase[] list, BiomeDictionary.Type... typesBlacklist) { - return excludeBiomesFromTypes(list, ArrayUtils.addAll(typesBlacklist, Type.NETHER, Type.END, Type.DEAD, Type.SPOOKY, Type.WASTELAND)); - } - - private static BiomeGenBase[] excludeBiomesFromTypes(BiomeGenBase[] list, BiomeDictionary.Type... typesBlacklist) { - for (BiomeDictionary.Type typeToBlacklist : typesBlacklist) { - list = ArrayUtils.removeElements(list, BiomeDictionary.getBiomesForType(typeToBlacklist)); - } - return list; - } - @Override public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { if (!isFlatWorld(chunkGenerator) || world.getWorldInfo().getGeneratorOptions().contains("decoration")) { @@ -175,7 +165,7 @@ public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkPro x = (chunkX << 4) + rand.nextInt(16) + 8; z = (chunkZ << 4) + rand.nextInt(16) + 8; if (ConfigWorld.amethystRarity == 1 || rand.nextInt(ConfigWorld.amethystRarity) == 0) { - amethystGen.generate(world, rand, x, MathHelper.getRandomIntegerInRange(rand, 6, ConfigWorld.amethystMaxY), z); + amethystGen.generate(world, rand, x, MathHelper.getRandomIntegerInRange(rand, 5, ConfigWorld.amethystMaxY - 5), z); } } diff --git a/src/main/java/ganymedes01/etfuturum/world/generate/decorate/WorldGenSoulFire.java b/src/main/java/ganymedes01/etfuturum/world/generate/decorate/WorldGenSoulFire.java new file mode 100644 index 000000000..2cc61b34a --- /dev/null +++ b/src/main/java/ganymedes01/etfuturum/world/generate/decorate/WorldGenSoulFire.java @@ -0,0 +1,29 @@ +package ganymedes01.etfuturum.world.generate.decorate; + + +import ganymedes01.etfuturum.ModBlocks; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenerator; + +import java.util.Random; + +public class WorldGenSoulFire extends WorldGenerator { + private static final String __OBFID = "CL_00000412"; + + public WorldGenSoulFire() { + } + + public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int p_76484_4_, int p_76484_5_) { + for (int l = 0; l < 64; ++l) { + int i1 = p_76484_3_ + p_76484_2_.nextInt(8) - p_76484_2_.nextInt(8); + int j1 = p_76484_4_ + p_76484_2_.nextInt(4) - p_76484_2_.nextInt(4); + int k1 = p_76484_5_ + p_76484_2_.nextInt(8) - p_76484_2_.nextInt(8); + if (p_76484_1_.isAirBlock(i1, j1, k1) && p_76484_1_.getBlock(i1, j1 - 1, k1) == (ModBlocks.SOUL_SOIL.isEnabled() ? ModBlocks.SOUL_SOIL.get() : Blocks.soul_sand)) { + p_76484_1_.setBlock(i1, j1, k1, Blocks.fire, 0, 2); + } + } + + return true; + } +} diff --git a/src/main/java/ganymedes01/etfuturum/world/nether/dimension/NetherChunkProvider.java b/src/main/java/ganymedes01/etfuturum/world/nether/dimension/NetherChunkProvider.java index 41c67922b..b705124ab 100644 --- a/src/main/java/ganymedes01/etfuturum/world/nether/dimension/NetherChunkProvider.java +++ b/src/main/java/ganymedes01/etfuturum/world/nether/dimension/NetherChunkProvider.java @@ -4,6 +4,8 @@ import ganymedes01.etfuturum.ModBlocks; import ganymedes01.etfuturum.compat.ExternalContent; import ganymedes01.etfuturum.compat.ModsList; +import ganymedes01.etfuturum.configuration.configs.ConfigMixins; +import ganymedes01.etfuturum.world.generate.decorate.WorldGenSoulFire; import ganymedes01.etfuturum.world.generate.feature.WorldGenBasaltGlowstone; import ganymedes01.etfuturum.world.nether.biome.NetherBiomeBase; import ganymedes01.etfuturum.world.nether.biome.utils.NetherBiomeManager; @@ -77,6 +79,7 @@ public class NetherChunkProvider implements IChunkProvider { private final WorldGenerator glowstone2Gen = new WorldGenGlowStone2(); private final WorldGenerator basaltGlowstoneGen = new WorldGenBasaltGlowstone(); private final WorldGenerator fireGen = new WorldGenFire(); + private final WorldGenerator soulFireGen = new WorldGenSoulFire(); private final WorldGenerator lavaGen = new WorldGenHellLava(Blocks.flowing_lava, false); public NetherChunkProvider(World par1World, long par2) { @@ -562,7 +565,7 @@ public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) { k1 = k + hellRNG.nextInt(16) + 8; l1 = hellRNG.nextInt(120) + 4; i2 = l + hellRNG.nextInt(16) + 8; - fireGen.generate(worldObj, hellRNG, k1, l1, i2); + (biome == NetherBiomeManager.soulSandValley && ConfigMixins.soulFire ? soulFireGen : fireGen).generate(worldObj, hellRNG, k1, l1, i2); } }