Skip to content

Commit

Permalink
OK SMARTASS INTERPRETER JUST HAVE IT ALL
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Roadhog360 committed Dec 19, 2023
1 parent 48372cd commit aef5968
Show file tree
Hide file tree
Showing 23 changed files with 162 additions and 354 deletions.
4 changes: 4 additions & 0 deletions src/main/java/ganymedes01/etfuturum/EtFuturumMixinPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ public List<String> 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");
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/ganymedes01/etfuturum/ModBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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()),
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ganymedes01/etfuturum/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/ganymedes01/etfuturum/api/BeePlantRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

Expand All @@ -41,15 +41,15 @@ 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) {
BEE_CROPS.remove(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) {
Expand Down
23 changes: 0 additions & 23 deletions src/main/java/ganymedes01/etfuturum/blocks/BlockAncientDebris.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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);
}
}

}
23 changes: 0 additions & 23 deletions src/main/java/ganymedes01/etfuturum/blocks/BlockNetherite.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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);
}
}

}
Original file line number Diff line number Diff line change
@@ -1,34 +1,11 @@
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 {

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);
}
}

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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");
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/ganymedes01/etfuturum/core/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;

Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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_) {
Expand All @@ -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<EntityItem> 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
Expand Down
Loading

0 comments on commit aef5968

Please sign in to comment.