Made XP created by solidified XP not be picked up by the solidifier

This commit is contained in:
Ellpeck 2016-11-07 17:48:02 +01:00
parent 9282462a9a
commit cc554241f7
3 changed files with 11 additions and 5 deletions

View file

@ -12,7 +12,7 @@ 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 de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.player.EntityPlayer;
@ -53,18 +53,23 @@ public class ItemSolidifiedExperience extends ItemBase{
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){
if(!world.isRemote){
int amount;
if(!player.isSneaking()){
world.spawnEntityInWorld(new EntityXPOrb(world, player.posX+0.5, player.posY+0.5, player.posZ+0.5, SOLID_XP_AMOUNT));
amount = SOLID_XP_AMOUNT;
if(!player.capabilities.isCreativeMode){
stack.stackSize--;
}
}
else{
world.spawnEntityInWorld(new EntityXPOrb(world, player.posX+0.5, player.posY+0.5, player.posZ+0.5, SOLID_XP_AMOUNT*stack.stackSize));
amount = SOLID_XP_AMOUNT*stack.stackSize;
if(!player.capabilities.isCreativeMode){
stack.stackSize = 0;
}
}
EntityXPOrb orb = new EntityXPOrb(world, player.posX+0.5, player.posY+0.5, player.posZ+0.5, amount);
orb.getEntityData().setBoolean(ModUtil.MOD_ID+"FromSolidified", true);
world.spawnEntityInWorld(orb);
}
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
}

View file

@ -14,6 +14,7 @@ package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.ItemSolidifiedExperience;
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@ -139,7 +140,7 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
List<EntityXPOrb> orbs = this.worldObj.getEntitiesWithinAABB(EntityXPOrb.class, new AxisAlignedBB(this.pos.getX()-range, this.pos.getY()-range, this.pos.getZ()-range, this.pos.getX()+1+range, this.pos.getY()+1+range, this.pos.getZ()+1+range));
if(orbs != null && !orbs.isEmpty()){
for(EntityXPOrb orb : orbs){
if(orb != null && !orb.isDead){
if(orb != null && !orb.isDead && !orb.getEntityData().getBoolean(ModUtil.MOD_ID+"FromSolidified")){
this.singlePointAmount += orb.getXpValue();
orb.setDead();

View file

@ -798,7 +798,7 @@ booklet.actuallyadditions.chapter.esd.name=ESDs
booklet.actuallyadditions.chapter.esd.text.1=The <item>ESD<r> is a block that works <imp>similar to a Hopper<r> but has <imp>a lot more functionality<r>. <n>You can choose the sides to input and output and you can <imp>precisely configure<r> the range of slots to look at! <n>For more precise information about <item>ESDs<r>, craft one and <imp>hover over the elements in their GUI<r>! <n><n><i>Its actual name is
booklet.actuallyadditions.chapter.xpSolidifier.name=Experience Solidifier
booklet.actuallyadditions.chapter.xpSolidifier.text.1=The <item>Experience Solidifer<r> uses the player's experience and turns it into <item>Solidified Experience<r> which can later be used by <imp>right-clicking<r> (or sneak-right-clicking!) to get the experience back. <n>Additionally, you can put <item>Solidified Experience<r> into the solidifier, and, when not powered by redstone, it will <imp>pick up any XP Orbs<r> that are on the ground nearby and turn them into <item>Solidified Experience<r>, provided it has enough stored up internally. <n><item>Solidified Experience<r> is also sometimes dropped from mobs.
booklet.actuallyadditions.chapter.xpSolidifier.text.1=The <item>Experience Solidifer<r> uses the player's experience and turns it into <item>Solidified Experience<r> which can later be used by <imp>right-clicking<r> (or sneak-right-clicking to use a full stack!) to get the experience back. <n>Additionally, you can put <item>Solidified Experience<r> into the solidifier, and it will <imp>pick up any XP Orbs<r> that are on the ground and turn them into <item>Solidified Experience<r>, provided they weren't created by it. <n><item>Solidified Experience<r> is also sometimes dropped from mobs.
booklet.actuallyadditions.chapter.greenhouseGlass.name=Greenhouse Glass
booklet.actuallyadditions.chapter.greenhouseGlass.text.1=<item>Greenhouse Glass<r> is a very effective way to <imp>speed up the growth of your plants<r>! When placed anywhere above the plant, as long as there are no blocks below obstructing the path, and there is sunlight above the glass, it will <imp>significantly speed up the growth of the plant<r>! <n>It obviously has to be daytime, too. Thought that was obvious.