Skip to content

Commit

Permalink
More general fixes
Browse files Browse the repository at this point in the history
Fixed amethyst clusters being pushable by pistons
Disable composter functionality temporarily
Move inventory dropping and spectator mode to mixin config, made the default for avoid dropping items false for now.
Added config options for Amethyst geode generation
Remove full grass path option
Remove more unused amethyst debug code (this was used by the spam prints, which are already gone)
Fixed geodes not generating if 1.8 stone generation was turned off
  • Loading branch information
Roadhog360 committed Jul 2, 2022
1 parent d916e66 commit a7a76f4
Show file tree
Hide file tree
Showing 12 changed files with 99 additions and 79 deletions.
104 changes: 53 additions & 51 deletions src/main/java/ganymedes01/etfuturum/EtFuturum.java
Original file line number Diff line number Diff line change
Expand Up @@ -571,57 +571,59 @@ public void onLoadComplete(FMLLoadCompleteEvent e){
}
}

registerComposting(ImmutableList.of(
new ItemStack(ModItems.beetroot_seeds),
new ItemStack(Blocks.tallgrass, 1, 1),
new ItemStack(Blocks.leaves, 1, OreDictionary.WILDCARD_VALUE),
new ItemStack(Items.melon_seeds),
new ItemStack(Items.pumpkin_seeds),
"treeSapling",
"treeLeaves",
new ItemStack(Items.wheat_seeds),
new ItemStack(ModItems.sweet_berries)
), 30);

registerComposting(ImmutableList.of(
new ItemStack(Blocks.cactus),
new ItemStack(Items.melon),
new ItemStack(Items.reeds),
new ItemStack(Blocks.double_plant, 1, 2),
new ItemStack(Blocks.vine)
), 50);

registerComposting(ImmutableList.of(
new ItemStack(Items.apple),
new ItemStack(ModItems.beetroot),
"cropCarrot",
new ItemStack(Blocks.cocoa),
new ItemStack(Blocks.tallgrass, 1, 2),
new ItemStack(Blocks.double_plant, 1, 3),
BlockFlower.class,
BlockLilyPad.class,
new ItemStack(Blocks.melon_block),
new ItemStack(Blocks.brown_mushroom),
new ItemStack(Blocks.red_mushroom),
new ItemStack(Items.nether_wart),
"cropPotato",
new ItemStack(Blocks.pumpkin),
"cropWheat"
), 65);

registerComposting(ImmutableList.of(
new ItemStack(Items.baked_potato),
new ItemStack(Items.bread),
new ItemStack(Items.cookie),
new ItemStack(Blocks.hay_block),
new ItemStack(Blocks.red_mushroom_block, 1, OreDictionary.WILDCARD_VALUE),
new ItemStack(Blocks.brown_mushroom_block, 1, OreDictionary.WILDCARD_VALUE)
), 85);

registerComposting(ImmutableList.of(
new ItemStack(Items.cake),
new ItemStack(Items.pumpkin_pie)
), 100);
// if(ConfigBlocksItems.enableComposter) {
// registerComposting(ImmutableList.of(
// new ItemStack(ModItems.beetroot_seeds),
// new ItemStack(Blocks.tallgrass, 1, 1),
// new ItemStack(Blocks.leaves, 1, OreDictionary.WILDCARD_VALUE),
// new ItemStack(Items.melon_seeds),
// new ItemStack(Items.pumpkin_seeds),
// "treeSapling",
// "treeLeaves",
// new ItemStack(Items.wheat_seeds),
// new ItemStack(ModItems.sweet_berries)
// ), 30);
//
// registerComposting(ImmutableList.of(
// new ItemStack(Blocks.cactus),
// new ItemStack(Items.melon),
// new ItemStack(Items.reeds),
// new ItemStack(Blocks.double_plant, 1, 2),
// new ItemStack(Blocks.vine)
// ), 50);
//
// registerComposting(ImmutableList.of(
// new ItemStack(Items.apple),
// new ItemStack(ModItems.beetroot),
// "cropCarrot",
// new ItemStack(Blocks.cocoa),
// new ItemStack(Blocks.tallgrass, 1, 2),
// new ItemStack(Blocks.double_plant, 1, 3),
// BlockFlower.class,
// BlockLilyPad.class,
// new ItemStack(Blocks.melon_block),
// new ItemStack(Blocks.brown_mushroom),
// new ItemStack(Blocks.red_mushroom),
// new ItemStack(Items.nether_wart),
// "cropPotato",
// new ItemStack(Blocks.pumpkin),
// "cropWheat"
// ), 65);
//
// registerComposting(ImmutableList.of(
// new ItemStack(Items.baked_potato),
// new ItemStack(Items.bread),
// new ItemStack(Items.cookie),
// new ItemStack(Blocks.hay_block),
// new ItemStack(Blocks.red_mushroom_block, 1, OreDictionary.WILDCARD_VALUE),
// new ItemStack(Blocks.brown_mushroom_block, 1, OreDictionary.WILDCARD_VALUE)
// ), 85);
//
// registerComposting(ImmutableList.of(
// new ItemStack(Items.cake),
// new ItemStack(Items.pumpkin_pie)
// ), 100);
// }

// if(ConfigurationHandler.enableNewNether)
// DimensionProviderNether.init(); // Come back to
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/ganymedes01/etfuturum/EtFuturumMixinPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,23 +111,23 @@ public List<String> getMixins() {
mixins.add("MixinEntity");
}

if(ConfigFunctions.enableSpectatorMode) {
if(ConfigMixins.enableSpectatorMode) {
mixins.add("MixinGameType");
mixins.add("MixinEntity_Spectator");
mixins.add("MixinWorld_Spectator");
mixins.add("MixinEntityPlayer_Spectator");
mixins.add("MixinNetHandlerPlayServer");
}

if(ConfigFunctions.avoidDroppingItemsWhenClosing) {
if(ConfigMixins.avoidDroppingItemsWhenClosing) {
mixins.add("MixinEntityPlayerMP");
}

if(side == MixinEnvironment.Side.CLIENT) {
if(ConfigMixins.furnaceCrackle) {
mixins.add("client.MixinBlockFurnace");
}
if(ConfigFunctions.enableSpectatorMode) {
if(ConfigMixins.enableSpectatorMode) {
mixins.add("client.MixinEntityRenderer");
mixins.add("client.MixinEntityPlayer");
mixins.add("client.MixinWorldRenderer_Spectator");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public BlockAmethystCluster(int type) {
this.type = type;
}

public int getMobilityFlag()
{
return 1;
}

public int getLightValue(IBlockAccess world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/ganymedes01/etfuturum/blocks/BlockComposter.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ganymedes01.etfuturum.EtFuturum;
import ganymedes01.etfuturum.ModBlocks.ISubBlocksBlock;
import ganymedes01.etfuturum.configuration.configs.ConfigBlocksItems;
import ganymedes01.etfuturum.core.utils.Utils;
import ganymedes01.etfuturum.items.block.ItemDecorationWorkbench;
import ganymedes01.etfuturum.lib.Reference;
import ganymedes01.etfuturum.lib.RenderIDs;
import net.minecraft.block.Block;
Expand All @@ -18,12 +20,13 @@
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;

public class BlockComposter extends Block implements IConfigurable {
public class BlockComposter extends Block implements IConfigurable, ISubBlocksBlock {

@SideOnly(Side.CLIENT)
private IIcon topIcon;
Expand Down Expand Up @@ -167,4 +170,9 @@ public boolean isEnabled() {
return ConfigBlocksItems.enableComposter;
}

@Override
public Class<? extends ItemBlock> getItemBlockClass() {
return ItemDecorationWorkbench.class;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ public class ConfigFunctions extends ConfigBase {
public static boolean enableNetheriteFlammable;
public static boolean enableExtraBurnableBlocks;
public static boolean enableUpdatedHarvestLevels;
public static boolean enableSpectatorMode;
public static boolean avoidDroppingItemsWhenClosing;
public static boolean dropVehiclesTogether;
public static String[] extraDropRawOres = new String[] {"oreCopper", "oreTin"};

Expand Down Expand Up @@ -156,8 +154,6 @@ protected void syncConfigOptions() {
enableHayBaleFalls = cfg.getBoolean("enableHayBaleFalls", catChanges, true, "If true, fall damage on a hay bale will be reduced");
enableHoeMining = cfg.getBoolean("enableHoeMining", catChanges, true, "Allows blocks like hay bales, leaves etc to mine faster with hoes");
hayBaleReducePercent = cfg.getInt("hayBaleReducePercent", catChanges, 20, 0, 99, "If enableHayBaleFalls is true, what percent should we keep for the fall damage?");
enableSpectatorMode = cfg.getBoolean("enableSpectatorMode", catChanges, true, "Enable spectator mode");
avoidDroppingItemsWhenClosing = cfg.getBoolean("avoidDroppingItemsWhenClosing", catChanges, true, "Experimental: avoid dropping items when closing an inventory, like in modern versions");

//settings
enableNetheriteFlammable = cfg.getBoolean("enableNetheriteFlammable", catSettings, false, "Set to true to disable the fireproof item entity Netherite/ancient debris etc uses");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public class ConfigMixins extends ConfigBase {

public static final String PATH = ConfigBase.configDir + File.separator + "mixins.cfg";
public static final ConfigMixins configInstance = new ConfigMixins(new File(Launch.minecraftHome, PATH));
public static boolean avoidDroppingItemsWhenClosing;
public static boolean enableSpectatorMode;

public ConfigMixins(File file) {
super(file);
Expand All @@ -41,12 +43,15 @@ public ConfigMixins(File file) {
@Override
protected void syncConfigOptions() {
Configuration cfg = configInstance;

endPortalFix = cfg.getBoolean("endPortalFix", catBackport, true, "Makes the End Portal block (the actual portal, not the frame) have an item icon, proper hitbox and will not instantly destroy itself in other dimensions.\nModified classes: net.minecraft.block.BlockEndPortal");
fenceWallConnectFix = cfg.getBoolean("fenceWallConnectFix", catBackport, true, "Makes vanilla fences connect to modded ones of the same material. Might have connection issue with mods that don't reference BlockFence super code. \nModified classes: net.minecraft.block.BlockFence net.minecraft.block.BlockWall");
if(EtFuturumMixinPlugin.side == MixinEnvironment.Side.CLIENT) {
furnaceCrackle = cfg.getBoolean("furnaceCrackle", catBackport, true, "(Client only) Allows vanilla furnaces to have crackling sounds.");
furnaceCrackle = cfg.getBoolean("furnaceCrackle", catBackport, true, "(Client only) Allows vanilla furnaces to have crackling sounds.\nModified Client Classes: net.minecraft.block.BlockFurnace");
}

endPortalFix = cfg.getBoolean("endPortalFix", catBackport, true, "Makes the End Portal block (the actual portal, not the frame) have an item icon, proper hitbox and will not instantly destroy itself in other dimensions.\nModified classes: net.minecraft.block.BlockEndPortal");
fenceWallConnectFix = cfg.getBoolean("fenceWallConnectFix", catBackport, true, "Makes vanilla fences connect to modded ones of the same material. Might have connection issue with mods that don't reference BlockFence super code.\nModified classes: net.minecraft.block.BlockFence net.minecraft.block.BlockWall");
avoidDroppingItemsWhenClosing = cfg.getBoolean("avoidDroppingItemsWhenClosing", catBackport, false, "Experimental: avoid dropping items when closing an inventory, like in modern versions.\nModified Classes: net.minecraft.entity.player.EntityPlayerMP");
enableSpectatorMode = cfg.getBoolean("enableSpectatorMode", catBackport, true, "VERY EXPERIMENTAL!\nModified Classes: net.minecraft.world.WorldSettings.GameType net.minecraft.entity.Entity net.minecraft.world.World net.minecraft.entity.player.EntityPlayer net.minecraft.network.NetHandlerPlayServer\nModified Client Classes: net.minecraft.client.renderer.EntityRenderer net.minecraft.entity.player.EntityPlayer net.minecraft.client.renderer.WorldRenderer");

stepHeightFix = cfg.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");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public class ConfigWorld extends ConfigBase {
public static boolean enableCoarseDirtReplacement;
public static boolean enableAmethystGeodes;
public static int buddingAmethystMode;
public static int amethystRarity;
public static int amethystMaxY;
public static int[] amethystDimensionBlacklist;

public static final String catClient = "client";
public static final String catGeneration = "generation";
Expand Down Expand Up @@ -104,9 +107,12 @@ protected void syncConfigOptions() {
enableCoarseDirtReplacement = cfg.getBoolean("enableCoarseDirtReplacement", catGeneration, true, "Replaces coarse dirt in biomes it (dirt:1) generates in such as shattered savannas or mesa plateaus.");
enableAmethystGeodes = cfg.getBoolean("enableAmethystGeodes", catGeneration, true, "");
buddingAmethystMode = cfg.getInt("buddingAmethystMode", catGeneration, 0, 0, 2, "0 = Budding amethyst cannot be obtained at all even with silk touch. When using this option, attempting to push them using a piston will break it.\n1 = Budding amethyst will drop if you use a silk touch pickaxe.\n2 = Budding amethyst does not need silk touch, just a pickaxe.");
Property amethystBlacklistProp = cfg.get(catGeneration, "amethystDimensionBlacklist", new int[] {-1, 1});
amethystBlacklistProp.comment = "What dimensions should we ban amethyst geodes from generating in?";
amethystDimensionBlacklist = amethystBlacklistProp.getIntList();
amethystRarity = cfg.getInt("amethystRarity", catGeneration, 53, 1, 128, "How rare should amethyst geodes be? 1/x chance per chunk, 1 means a geode every chunk");
amethystMaxY = cfg.getInt("amethystMaxY", catGeneration, 50, 9, 255, "Max Y level amethyst geodes should attempt to generate at");


fullGrassPath = cfg.getBoolean("fullGrassPath", catMisc, false, "Set to true if you're having issues with stepping over grass paths. Temporary option until fixes are implemented to 1.7's stepping system.");
tileReplacementMode = cfg.getInt("tileReplacementMode", catMisc, 0, -1, 1, "Replace old Brewing Stands/Enchanting Tables/Daylight Sensors/Beacons with new one on the fly.\n-1 = Disabled, no conversion even if the replacement tile entities are on\n0 = Convert the vanilla tile entities to their Et Futurum versions\n1 = Convert Et Futurum replacement tile entities back to default ones. Useful if you want to turn those off.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@ public void loadWorldEvent(WorldEvent.Load event)
@SubscribeEvent
public void onItemToss(ItemTossEvent event)
{
if(ConfigFunctions.avoidDroppingItemsWhenClosing && event.player instanceof EntityPlayerMP && playersClosedContainers.contains(event.player)) {
if(ConfigMixins.avoidDroppingItemsWhenClosing && event.player instanceof EntityPlayerMP && playersClosedContainers.contains(event.player)) {
if(event.player.inventory.addItemStackToInventory(event.entityItem.getEntityItem())) {
event.setCanceled(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import ganymedes01.etfuturum.client.gui.inventory.GuiSmoker;
import ganymedes01.etfuturum.configuration.configs.ConfigBlocksItems;
import ganymedes01.etfuturum.configuration.configs.ConfigEntities;
import ganymedes01.etfuturum.configuration.configs.ConfigFunctions;
import ganymedes01.etfuturum.configuration.configs.ConfigMixins;
import ganymedes01.etfuturum.configuration.configs.ConfigTweaks;
import ganymedes01.etfuturum.core.handlers.ServerEventHandler;
import ganymedes01.etfuturum.core.handlers.WorldEventHandler;
Expand Down Expand Up @@ -65,7 +65,7 @@ public void registerEvents() {
FMLCommonHandler.instance().bus().register(WorldEventHandler.INSTANCE);
MinecraftForge.TERRAIN_GEN_BUS.register(WorldEventHandler.INSTANCE);

if(ConfigFunctions.enableSpectatorMode) {
if(ConfigMixins.enableSpectatorMode) {
FMLCommonHandler.instance().bus().register(SpectatorMode.INSTANCE);
MinecraftForge.EVENT_BUS.register(SpectatorMode.INSTANCE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ganymedes01.etfuturum.configuration.configs.ConfigFunctions;
import ganymedes01.etfuturum.configuration.configs.ConfigMixins;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
Expand Down Expand Up @@ -44,7 +44,7 @@ public boolean isEntityApplicable(Entity p_82704_1_) {
}
public static WorldSettings.GameType SPECTATOR_GAMETYPE = null;
public static void init() {
if(ConfigFunctions.enableSpectatorMode)
if(ConfigMixins.enableSpectatorMode)
SPECTATOR_GAMETYPE = EnumHelperClient.addGameType("spectator", 3, "Spectator");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkPro
generateOre(stoneGenerator, world, rand, chunkX, chunkZ, 1, 0, 80);
}
}
if(ConfigBlocksItems.enableAmethyst) {
x = chunkX * 16 + rand.nextInt(16) + 8;
z = chunkZ * 16 + rand.nextInt(16) + 8;
if(ConfigWorld.enableAmethystGeodes && rand.nextInt(53) == 0) {
new WorldGenAmethystGeode().generate(world, rand, x, rand.nextInt(52) + 9, z);
}
}

if(ConfigBlocksItems.enableAmethyst && !ArrayUtils.contains(ConfigWorld.amethystDimensionBlacklist, world.provider.dimensionId)) {
x = chunkX * 16 + rand.nextInt(16) + 8;
z = chunkZ * 16 + rand.nextInt(16) + 8;
if(ConfigWorld.enableAmethystGeodes && rand.nextInt(ConfigWorld.amethystRarity) == 0) {
new WorldGenAmethystGeode().generate(world, rand, x, rand.nextInt(ConfigWorld.amethystMaxY) - 8, z);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,13 @@ public boolean generate(World world, Random random, int x, int y, int z) {
int holeSize = random.nextFloat() < .95F ? random.nextInt(3) + 5 : -1;
float holeTheta = 0;
float holePhi = 0;
int attempts = 1;
if(holeSize != -1) {
holeTheta = (float) (Math.acos(1 - 2 * random.nextFloat()) - Math.PI/2);
holePhi = (float) (random.nextFloat() * Math.PI * 2);
radius = size - (random.nextFloat() * 2 + 0.5F) + (random.nextFloat() * 0);
holeX = Math.round(radius * MathHelper.cos(holePhi) * MathHelper.cos(holeTheta));
holeY = Math.round(radius * MathHelper.sin(holeTheta));
holeZ = Math.round(radius * MathHelper.sin(holePhi) * MathHelper.cos(holeTheta));
attempts++;
}

// if(holeSize > -1) {
Expand Down

0 comments on commit a7a76f4

Please sign in to comment.