This commit is contained in:
Ellpeck 2016-07-07 17:59:45 +02:00
parent aae29bbfdc
commit 346dbf2ccd
24 changed files with 97 additions and 102 deletions

View file

@ -15,7 +15,10 @@ import de.ellpeck.actuallyadditions.mod.achievement.TheAchievements;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
import de.ellpeck.actuallyadditions.mod.util.*;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.Block;
import net.minecraft.block.BlockPistonBase;
import net.minecraft.block.SoundType;

View file

@ -58,9 +58,12 @@ public class BlockGiantChest extends BlockContainerBase{
@Override
public TileEntity createNewTileEntity(World world, int par2){
switch(this.type){
case 1: return new TileEntityGiantChestMedium();
case 2: return new TileEntityGiantChestLarge();
default: return new TileEntityGiantChest();
case 1:
return new TileEntityGiantChestMedium();
case 2:
return new TileEntityGiantChestLarge();
default:
return new TileEntityGiantChest();
}
}

View file

@ -12,10 +12,8 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityShockSuppressor;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;

View file

@ -91,10 +91,10 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
public GuiButton buttonViewOnline;
public GuiTextField searchField;
public boolean shouldSaveDataNextClose;
public String bookletName;
private int ticksElapsed;
private boolean mousePressed;
private int hisNameIsAt;
public String bookletName;
public GuiBooklet(GuiScreen parentScreen, boolean tryOpenMainPage, boolean saveOnClose){
this.xSize = 146;

View file

@ -24,9 +24,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiBookletStand extends GuiBooklet{
private GuiButton buttonSetPage;
private final TileEntityBookletStand theStand;
private GuiButton buttonSetPage;
public GuiBookletStand(TileEntityBase theStand){
super(null, false, false);

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.config;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.client.event.ConfigChangedEvent;

View file

@ -44,6 +44,18 @@ public class CommonEvents{
MinecraftForge.EVENT_BUS.register(this);
}
public static void checkAchievements(ItemStack gotten, EntityPlayer player, InitAchievements.Type type){
for(TheAchievements ach : TheAchievements.values()){
if(ach.type == type){
if(gotten != null && ach.chieve.theItemStack != null && gotten.getItem() == ach.chieve.theItemStack.getItem()){
if(gotten.getItemDamage() == ach.chieve.theItemStack.getItemDamage()){
player.addStat(ach.chieve, 1);
}
}
}
}
}
@SubscribeEvent
public void livingDeathEvent(LivingDeathEvent event){
if(event.getEntityLiving().worldObj != null && !event.getEntityLiving().worldObj.isRemote && event.getEntityLiving() instanceof EntityPlayer){
@ -90,18 +102,6 @@ public class CommonEvents{
}
}
public static void checkAchievements(ItemStack gotten, EntityPlayer player, InitAchievements.Type type){
for(TheAchievements ach : TheAchievements.values()){
if(ach.type == type){
if(gotten != null && ach.chieve.theItemStack != null && gotten.getItem() == ach.chieve.theItemStack.getItem()){
if(gotten.getItemDamage() == ach.chieve.theItemStack.getItemDamage()){
player.addStat(ach.chieve, 1);
}
}
}
}
}
@SubscribeEvent
public void onCraftedEvent(PlayerEvent.ItemCraftedEvent event){
checkAchievements(event.crafting, event.player, InitAchievements.Type.CRAFTING);

View file

@ -12,10 +12,6 @@ package de.ellpeck.actuallyadditions.mod.gen;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.*;

View file

@ -54,8 +54,8 @@ import java.util.Set;
public class ItemDrill extends ItemEnergy{
private static final int ENERGY_USE = 100;
public static final int HARVEST_LEVEL = 4;
private static final int ENERGY_USE = 100;
public ItemDrill(String name){
super(500000, 5000, name);

View file

@ -10,14 +10,11 @@
package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.monster.EntitySpider;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;

View file

@ -15,7 +15,6 @@ import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLivingBase;

View file

@ -14,17 +14,13 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.monster.EntitySpider;
import net.minecraft.entity.passive.EntityBat;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
@ -51,6 +47,57 @@ public class ItemWingsOfTheBats extends ItemBase{
MinecraftForge.EVENT_BUS.register(this);
}
/**
* Checks if the Player is winged
*
* @param player The Player
* @return Winged?
*/
public static boolean isPlayerWinged(EntityPlayer player){
return WINGED_PLAYERS.contains(player.getUniqueID()+(player.worldObj.isRemote ? "-Remote" : ""));
}
/**
* Same as above, but Remote Checking is done automatically
*/
public static void removeWingsFromPlayer(EntityPlayer player){
removeWingsFromPlayer(player, player.worldObj.isRemote);
}
/**
* Removes the Player from the List of Players that have Wings
*
* @param player The Player
* @param worldRemote If the World the Player is in is remote
*/
public static void removeWingsFromPlayer(EntityPlayer player, boolean worldRemote){
WINGED_PLAYERS.remove(player.getUniqueID()+(worldRemote ? "-Remote" : ""));
}
/**
* Adds the Player to the List of Players that have Wings
*
* @param player The Player
*/
public static void addWingsToPlayer(EntityPlayer player){
WINGED_PLAYERS.add(player.getUniqueID()+(player.worldObj.isRemote ? "-Remote" : ""));
}
/**
* Checks if the Player has Wings in its Inventory
*
* @param player The Player
* @return The Wings
*/
public static ItemStack getWingItem(EntityPlayer player){
for(int i = 0; i < player.inventory.getSizeInventory(); i++){
if(player.inventory.getStackInSlot(i) != null && player.inventory.getStackInSlot(i).getItem() instanceof ItemWingsOfTheBats){
return player.inventory.getStackInSlot(i);
}
}
return null;
}
@SubscribeEvent
public void onLogOutEvent(PlayerEvent.PlayerLoggedOutEvent event){
//Remove Player from Wings' Fly Permission List
@ -104,58 +151,6 @@ public class ItemWingsOfTheBats extends ItemBase{
}
}
/**
* Checks if the Player is winged
*
* @param player The Player
* @return Winged?
*/
public static boolean isPlayerWinged(EntityPlayer player){
return WINGED_PLAYERS.contains(player.getUniqueID()+(player.worldObj.isRemote ? "-Remote" : ""));
}
/**
* Same as above, but Remote Checking is done automatically
*/
public static void removeWingsFromPlayer(EntityPlayer player){
removeWingsFromPlayer(player, player.worldObj.isRemote);
}
/**
* Removes the Player from the List of Players that have Wings
*
* @param player The Player
* @param worldRemote If the World the Player is in is remote
*/
public static void removeWingsFromPlayer(EntityPlayer player, boolean worldRemote){
WINGED_PLAYERS.remove(player.getUniqueID()+(worldRemote ? "-Remote" : ""));
}
/**
* Adds the Player to the List of Players that have Wings
*
* @param player The Player
*/
public static void addWingsToPlayer(EntityPlayer player){
WINGED_PLAYERS.add(player.getUniqueID()+(player.worldObj.isRemote ? "-Remote" : ""));
}
/**
* Checks if the Player has Wings in its Inventory
*
* @param player The Player
* @return The Wings
*/
public static ItemStack getWingItem(EntityPlayer player){
for(int i = 0; i < player.inventory.getSizeInventory(); i++){
if(player.inventory.getStackInSlot(i) != null && player.inventory.getStackInSlot(i).getItem() instanceof ItemWingsOfTheBats){
return player.inventory.getStackInSlot(i);
}
}
return null;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.EPIC;

View file

@ -15,7 +15,6 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
@ -23,7 +22,6 @@ import net.minecraft.item.ItemSeedFood;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class ItemFoodSeed extends ItemSeedFood{

View file

@ -16,6 +16,7 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -39,14 +40,29 @@ public class LensDisruption extends Lens{
if(!stack.hasTagCompound() || !stack.getTagCompound().getBoolean(ModUtil.MOD_ID+"DisruptedAlready")){
ItemStack newStack = null;
while(newStack == null || newStack.getItem() == null){
boolean done = false;
while(!done){
if(Util.RANDOM.nextBoolean()){
newStack = new ItemStack(Item.REGISTRY.getRandomObject(Util.RANDOM));
}
else{
newStack = new ItemStack(Block.REGISTRY.getRandomObject(Util.RANDOM));
}
if(newStack != null){
Item newItem = newStack.getItem();
if(newItem != null){
CreativeTabs[] tabs = newItem.getCreativeTabs();
for(CreativeTabs tab : tabs){
if(tab != null){
done = true;
break;
}
}
}
}
}
newStack.stackSize = stack.stackSize;
if(!newStack.hasTagCompound()){

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.jei.crusher;
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;

View file

@ -10,7 +10,6 @@
package de.ellpeck.actuallyadditions.mod.misc.special;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

View file

@ -16,7 +16,6 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
import de.ellpeck.actuallyadditions.mod.network.PacketServerToClient;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import de.ellpeck.actuallyadditions.mod.util.compat.TeslaUtil;
import net.minecraft.block.state.IBlockState;
@ -41,10 +40,10 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
public abstract class TileEntityBase extends TileEntity implements ITickable{
public static boolean teslaLoaded;
public final String name;
public boolean isRedstonePowered;
public boolean isPulseMode;
protected int ticksElapsed;
public final String name;
public TileEntityBase(String name){
this.name = name;

View file

@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.util.Util;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;

View file

@ -27,6 +27,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class TileEntityFluidCollector extends TileEntityBase implements net.minecraftforge.fluids.IFluidHandler{
public boolean isPlacer;
public final FluidTank tank = new FluidTank(8*Util.BUCKET){
@Override
public boolean canFill(){
@ -38,7 +39,6 @@ public class TileEntityFluidCollector extends TileEntityBase implements net.mine
return !TileEntityFluidCollector.this.isPlacer;
}
};
public boolean isPlacer;
private int lastTankAmount;
private int currentTime;

View file

@ -16,8 +16,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.wrapper.SidedInvWrapper;

View file

@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.tile;
import cofh.api.energy.IEnergyReceiver;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.misc.LaserRelayConnectionHandler;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;

View file

@ -36,8 +36,8 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
public int currentTime;
public int range;
public boolean isBreaker;
private int oldRange;
public int side;
private int oldRange;
public TileEntityPhantomPlacer(int slots, String name){
super(slots, name);

View file

@ -23,8 +23,8 @@ import java.util.UUID;
public class TileEntityPlayerInterface extends TileEntityInventoryBase implements IEnergyReceiver, IEnergyDisplay{
public static final int DEFAULT_RANGE = 32;
public UUID connectedPlayer;
private final EnergyStorage storage = new EnergyStorage(30000);
public UUID connectedPlayer;
private int oldEnergy;
private int range;

View file

@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.util;
import net.minecraft.item.EnumRarity;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.oredict.OreDictionary;