Skip to content

Commit

Permalink
Added anarchy mode config option
Browse files Browse the repository at this point in the history
  • Loading branch information
Chicken-Bones committed Aug 27, 2015
1 parent aea1567 commit bfb9596
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/codechicken/enderstorage/EnderStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class EnderStorage
public static Item personalItem;
public static boolean disableVanillaEnderChest;
public static boolean removeVanillaRecipe;
public static boolean anarchyMode;

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
Expand All @@ -52,6 +53,7 @@ public void init(FMLInitializationEvent event) {
loadPersonalItem();
disableVanillaEnderChest = config.getTag("disable-vanilla").setComment("Set to true to make the vanilla enderchest unplaceable.").getBooleanValue(true);
removeVanillaRecipe = config.getTag("disable-vanilla_recipe").setComment("Set to true to make the vanilla enderchest uncraftable.").getBooleanValue(false);
anarchyMode = config.getTag("anarchy-mode").setComment("Causes chests to lose personal settings and drop the diamond on break").getBooleanValue(false);

EnderStorageManager.loadConfig(config);
EnderStorageManager.registerPlugin(new EnderItemStoragePlugin());
Expand Down
8 changes: 5 additions & 3 deletions src/codechicken/enderstorage/common/BlockEnderStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;

import codechicken.lib.raytracer.RayTracer;
import codechicken.lib.raytracer.IndexedCuboid6;
Expand Down Expand Up @@ -109,8 +108,11 @@ public ArrayList<ItemStack> getDrops(World world, int i, int j, int k, int meta,
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();

TileFrequencyOwner tile = (TileFrequencyOwner) world.getTileEntity(i, j, k);
if (tile != null)
ret.add(createItem(meta, tile.freq, tile.owner));
if (tile != null) {
ret.add(createItem(meta, tile.freq, EnderStorage.anarchyMode ? "global" : tile.owner));
if(EnderStorage.anarchyMode && !tile.owner.equals("global"))
ret.add(EnderStorage.getPersonalItem());
}

return ret;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.List;

import codechicken.enderstorage.EnderStorage;
import codechicken.lib.render.SpriteSheetManager;
import codechicken.lib.render.SpriteSheetManager.SpriteSheet;
import codechicken.enderstorage.api.EnderStorageManager;
Expand Down Expand Up @@ -51,7 +52,12 @@ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world,
stack.setItemDamage(chest.freq);
if(!stack.hasTagCompound())
stack.setTagCompound(new NBTTagCompound());
stack.getTagCompound().setString("owner", chest.owner);

if (!EnderStorage.anarchyMode || chest.owner.equals(player.getCommandSenderName()))
stack.getTagCompound().setString("owner", chest.owner);
else
stack.getTagCompound().setString("owner", "global");

return true;
}
return false;
Expand Down

0 comments on commit bfb9596

Please sign in to comment.