More progress
This commit is contained in:
parent
00d6f8eb46
commit
d80afb18f0
|
@ -21,7 +21,6 @@ import WayofTime.bloodmagic.annot.Handler;
|
|||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.util.helper.LogHelper;
|
||||
import WayofTime.bloodmagic.client.gui.GuiHandler;
|
||||
import WayofTime.bloodmagic.command.CommandBloodMagic;
|
||||
import WayofTime.bloodmagic.compat.ICompatibility;
|
||||
import WayofTime.bloodmagic.network.BloodMagicPacketHandler;
|
||||
import WayofTime.bloodmagic.proxy.CommonProxy;
|
||||
|
|
|
@ -189,7 +189,7 @@ public class AlchemyArrayEffectAttractor extends AlchemyArrayEffect
|
|||
{
|
||||
if (ent instanceof EntitySlime)
|
||||
{
|
||||
ent.faceEntity(getTarget(ent.worldObj, pos), 10.0F, 20.0F);
|
||||
ent.faceEntity(getTarget(ent.getEntityWorld(), pos), 10.0F, 20.0F);
|
||||
} else if (ent instanceof EntitySilverfish)
|
||||
{
|
||||
if (counter < 10)
|
||||
|
@ -197,7 +197,7 @@ public class AlchemyArrayEffectAttractor extends AlchemyArrayEffect
|
|||
return;
|
||||
}
|
||||
EntitySilverfish sf = (EntitySilverfish) ent;
|
||||
Path pathentity = getPathEntityToEntity(ent, getTarget(ent.worldObj, pos), getRange());
|
||||
Path pathentity = getPathEntityToEntity(ent, getTarget(ent.getEntityWorld(), pos), getRange());
|
||||
sf.getNavigator().setPath(pathentity, sf.getAIMoveSpeed());
|
||||
} else if (ent instanceof EntityBlaze)
|
||||
{
|
||||
|
@ -221,7 +221,7 @@ public class AlchemyArrayEffectAttractor extends AlchemyArrayEffect
|
|||
// ent.setAttackTarget(target);
|
||||
} else if (ent instanceof EntityEnderman)
|
||||
{
|
||||
((EntityEnderman) ent).setAttackTarget(getTarget(ent.worldObj, pos));
|
||||
ent.setAttackTarget(getTarget(ent.getEntityWorld(), pos));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -234,7 +234,7 @@ public class AlchemyArrayEffectAttractor extends AlchemyArrayEffect
|
|||
if (distance > 2)
|
||||
{
|
||||
EntityMob mod = (EntityMob) ent;
|
||||
mod.faceEntity(getTarget(ent.worldObj, pos), 180, 0);
|
||||
mod.faceEntity(getTarget(ent.getEntityWorld(), pos), 180, 0);
|
||||
mod.moveEntityWithHeading(0, 0.3f);
|
||||
if (mod.posY < pos.getY())
|
||||
{
|
||||
|
@ -248,12 +248,12 @@ public class AlchemyArrayEffectAttractor extends AlchemyArrayEffect
|
|||
|
||||
public Path getPathEntityToEntity(Entity entity, Entity targetEntity, float range)
|
||||
{
|
||||
int targX = MathHelper.floor_double(targetEntity.posX);
|
||||
int targY = MathHelper.floor_double(targetEntity.posY + 1.0D);
|
||||
int targZ = MathHelper.floor_double(targetEntity.posZ);
|
||||
int targX = MathHelper.floor(targetEntity.posX);
|
||||
int targY = MathHelper.floor(targetEntity.posY + 1.0D);
|
||||
int targZ = MathHelper.floor(targetEntity.posZ);
|
||||
|
||||
PathFinder pf = new PathFinder(new WalkNodeProcessor());
|
||||
return pf.findPath(targetEntity.worldObj, (EntityLiving) entity, new BlockPos(targX, targY, targZ), range);
|
||||
return pf.findPath(targetEntity.getEntityWorld(), (EntityLiving) entity, new BlockPos(targX, targY, targZ), range);
|
||||
}
|
||||
|
||||
private boolean trackMob(BlockPos pos, EntityLiving ent)
|
||||
|
@ -261,7 +261,7 @@ public class AlchemyArrayEffectAttractor extends AlchemyArrayEffect
|
|||
//TODO: Figure out if this crud is needed
|
||||
if (useSetTarget(ent))
|
||||
{
|
||||
((EntityMob) ent).setAttackTarget(getTarget(ent.worldObj, pos));
|
||||
ent.setAttackTarget(getTarget(ent.getEntityWorld(), pos));
|
||||
return true;
|
||||
} else if (useSpecialCase(ent))
|
||||
{
|
||||
|
@ -328,7 +328,7 @@ public class AlchemyArrayEffectAttractor extends AlchemyArrayEffect
|
|||
}
|
||||
|
||||
cancelCurrentTasks(ent);
|
||||
ent.tasks.addTask(0, new AttractTask(ent, getTarget(ent.worldObj, pos), pos));
|
||||
ent.tasks.addTask(0, new AttractTask(ent, getTarget(ent.getEntityWorld(), pos), pos));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -364,13 +364,13 @@ public class AlchemyArrayEffectAttractor extends AlchemyArrayEffect
|
|||
{
|
||||
if (ent instanceof EntitySlime)
|
||||
{
|
||||
ent.faceEntity(getTarget(ent.worldObj, pos), 10.0F, 20.0F);
|
||||
ent.faceEntity(getTarget(ent.getEntityWorld(), pos), 10.0F, 20.0F);
|
||||
// ent.setAttackTarget(getTarget(ent.worldObj, pos));
|
||||
return true;
|
||||
} else if (ent instanceof EntitySilverfish)
|
||||
{
|
||||
EntitySilverfish es = (EntitySilverfish) ent;
|
||||
Path pathentity = getPathEntityToEntity(ent, getTarget(ent.worldObj, pos), getRange());
|
||||
Path pathentity = getPathEntityToEntity(ent, getTarget(ent.getEntityWorld(), pos), getRange());
|
||||
es.getNavigator().setPath(pathentity, es.getAIMoveSpeed());
|
||||
return true;
|
||||
} else if (ent instanceof EntityBlaze)
|
||||
|
@ -439,7 +439,7 @@ public class AlchemyArrayEffectAttractor extends AlchemyArrayEffect
|
|||
{
|
||||
boolean res = false;
|
||||
//TODO:
|
||||
TileEntity te = mob.worldObj.getTileEntity(coord);
|
||||
TileEntity te = mob.getEntityWorld().getTileEntity(coord);
|
||||
if (te instanceof TileAlchemyArray)
|
||||
{
|
||||
res = true;
|
||||
|
|
|
@ -40,7 +40,7 @@ public class AlchemyArrayEffectBinding extends AlchemyArrayEffectCrafting
|
|||
ItemStack output = outputStack.copy();
|
||||
EntityItem outputEntity = new EntityItem(tile.getWorld(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, output);
|
||||
|
||||
tile.getWorld().spawnEntityInWorld(outputEntity);
|
||||
tile.getWorld().spawnEntity(outputEntity);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class AlchemyArrayEffectBinding extends AlchemyArrayEffectCrafting
|
|||
double dispZ = -distance * Math.cos(angle);
|
||||
|
||||
EntityLightningBolt lightning = new EntityLightningBolt(world, pos.getX() + dispX, pos.getY(), pos.getZ() + dispZ, true);
|
||||
world.spawnEntityInWorld(lightning);
|
||||
world.spawnEntity(lightning);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ public class AlchemyArrayEffectSkeletonTurret extends AlchemyArrayEffect
|
|||
{
|
||||
boolean res = false;
|
||||
//TODO:
|
||||
TileEntity te = mob.worldObj.getTileEntity(coord);
|
||||
TileEntity te = mob.getEntityWorld().getTileEntity(coord);
|
||||
if (te instanceof TileAlchemyArray)
|
||||
{
|
||||
res = true;
|
||||
|
|
|
@ -354,7 +354,7 @@ public class BloodAltar implements IFluidHandler
|
|||
|
||||
ItemStack input = tileAltar.getStackInSlot(0);
|
||||
|
||||
if (input != null)
|
||||
if (!input.isEmpty())
|
||||
{
|
||||
// Do recipes
|
||||
AltarRecipe recipe = AltarRecipeRegistry.getRecipeForInput(input);
|
||||
|
@ -364,7 +364,7 @@ public class BloodAltar implements IFluidHandler
|
|||
{
|
||||
this.isActive = true;
|
||||
this.recipe = recipe;
|
||||
this.result = recipe.getOutput() == null ? null : new ItemStack(recipe.getOutput().getItem(), 1, recipe.getOutput().getMetadata());
|
||||
this.result = recipe.getOutput().isEmpty() ? ItemStack.EMPTY : new ItemStack(recipe.getOutput().getItem(), 1, recipe.getOutput().getMetadata());
|
||||
this.liquidRequired = recipe.getSyphon();
|
||||
this.canBeFilled = recipe.isFillable();
|
||||
this.consumptionRate = recipe.getConsumeRate();
|
||||
|
@ -442,7 +442,7 @@ public class BloodAltar implements IFluidHandler
|
|||
|
||||
ItemStack input = tileAltar.getStackInSlot(0);
|
||||
|
||||
if (input == null)
|
||||
if (input.isEmpty())
|
||||
return;
|
||||
|
||||
World world = tileAltar.getWorld();
|
||||
|
@ -454,7 +454,7 @@ public class BloodAltar implements IFluidHandler
|
|||
if (!canBeFilled)
|
||||
{
|
||||
boolean hasOperated = false;
|
||||
int stackSize = input.stackSize;
|
||||
int stackSize = input.getCount();
|
||||
|
||||
if (totalCharge > 0)
|
||||
{
|
||||
|
@ -480,7 +480,7 @@ public class BloodAltar implements IFluidHandler
|
|||
if (internalCounter % 4 == 0 && world instanceof WorldServer)
|
||||
{
|
||||
WorldServer server = (WorldServer) world;
|
||||
server.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 1, 0.2, 0, 0.2, 0, new int[0]);
|
||||
server.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 1, 0.2, 0, 0.2, 0);
|
||||
}
|
||||
|
||||
} else if (!hasOperated && progress > 0)
|
||||
|
@ -490,7 +490,7 @@ public class BloodAltar implements IFluidHandler
|
|||
if (internalCounter % 2 == 0 && world instanceof WorldServer)
|
||||
{
|
||||
WorldServer server = (WorldServer) world;
|
||||
server.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 1, 0.1, 0, 0.1, 0, new int[0]);
|
||||
server.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 1, 0.1, 0, 0.1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -500,8 +500,8 @@ public class BloodAltar implements IFluidHandler
|
|||
{
|
||||
ItemStack result = this.result;
|
||||
|
||||
if (result != null)
|
||||
result.stackSize *= stackSize;
|
||||
if (!result.isEmpty())
|
||||
result.setCount(result.getCount() * stackSize);
|
||||
|
||||
MinecraftForge.EVENT_BUS.post(new AltarCraftedEvent(recipe, result));
|
||||
tileAltar.setInventorySlotContents(0, result);
|
||||
|
@ -510,7 +510,7 @@ public class BloodAltar implements IFluidHandler
|
|||
if (world instanceof WorldServer)
|
||||
{
|
||||
WorldServer server = (WorldServer) world;
|
||||
server.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 40, 0.3, 0, 0.3, 0, new int[0]);
|
||||
server.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 40, 0.3, 0, 0.3, 0);
|
||||
}
|
||||
|
||||
this.cooldownAfterCrafting = 30;
|
||||
|
@ -521,7 +521,7 @@ public class BloodAltar implements IFluidHandler
|
|||
{
|
||||
ItemStack returnedItem = tileAltar.getStackInSlot(0);
|
||||
|
||||
if (returnedItem == null || !(returnedItem.getItem() instanceof IBloodOrb))
|
||||
if (returnedItem.isEmpty() || !(returnedItem.getItem() instanceof IBloodOrb))
|
||||
return;
|
||||
|
||||
IBloodOrb item = (IBloodOrb) (returnedItem.getItem());
|
||||
|
@ -546,7 +546,7 @@ public class BloodAltar implements IFluidHandler
|
|||
if (drain > 0 && internalCounter % 4 == 0 && world instanceof WorldServer)
|
||||
{
|
||||
WorldServer server = (WorldServer) world;
|
||||
server.spawnParticle(EnumParticleTypes.SPELL_WITCH, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 1, 0, 0, 0, 0.001, new int[] {});
|
||||
server.spawnParticle(EnumParticleTypes.SPELL_WITCH, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 1, 0, 0, 0, 0.001);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -758,7 +758,7 @@ public class BloodAltar implements IFluidHandler
|
|||
|
||||
public void setActive()
|
||||
{
|
||||
if (tileAltar.getStackInSlot(0) == null)
|
||||
if (tileAltar.getStackInSlot(0).isEmpty())
|
||||
{
|
||||
isActive = false;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -51,14 +52,15 @@ public class ItemStackWrapper
|
|||
this(blockStack.getBlock(), 1, blockStack.getMeta());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static ItemStackWrapper getHolder(ItemStack stack)
|
||||
{
|
||||
if (stack == null)
|
||||
if (stack.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ItemStackWrapper(stack.getItem(), stack.stackSize, stack.getItemDamage());
|
||||
return new ItemStackWrapper(stack.getItem(), stack.getCount(), stack.getItemDamage());
|
||||
}
|
||||
|
||||
public ItemStack toStack()
|
||||
|
|
|
@ -47,7 +47,7 @@ public class AlchemyArrayEffectCrafting extends AlchemyArrayEffect
|
|||
|
||||
EntityItem outputEntity = new EntityItem(tile.getWorld(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, output);
|
||||
|
||||
tile.getWorld().spawnEntityInWorld(outputEntity);
|
||||
tile.getWorld().spawnEntity(outputEntity);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -67,19 +67,19 @@ public class CompressionRegistry
|
|||
for (int slot = 0; slot < itemHandler.getSlots(); slot++)
|
||||
{
|
||||
inventory[slot] = itemHandler.extractItem(slot, 64, true);
|
||||
copyInventory[slot] = ItemStack.copyItemStack(inventory[slot]);
|
||||
copyInventory[slot] = inventory[slot].copy();
|
||||
}
|
||||
|
||||
for (CompressionHandler handler : compressionRegistry)
|
||||
{
|
||||
ItemStack stack = handler.compressInventory(copyInventory, world);
|
||||
if (stack != null)
|
||||
if (!stack.isEmpty())
|
||||
{
|
||||
for (int slot = 0; slot < itemHandler.getSlots(); slot++)
|
||||
{
|
||||
if (inventory[slot] != null && !ItemStack.areItemStacksEqual(inventory[slot], copyInventory[slot]))
|
||||
{
|
||||
itemHandler.extractItem(slot, inventory[slot].stackSize, false);
|
||||
itemHandler.extractItem(slot, inventory[slot].getCount(), false);
|
||||
if (copyInventory[slot] != null)
|
||||
{
|
||||
itemHandler.insertItem(slot, copyInventory[slot], false);
|
||||
|
@ -92,7 +92,7 @@ public class CompressionRegistry
|
|||
}
|
||||
}
|
||||
|
||||
return Pair.of(null, false);
|
||||
return Pair.of(ItemStack.EMPTY, false);
|
||||
}
|
||||
|
||||
public static int getItemThreshold(ItemStack stack)
|
||||
|
@ -110,6 +110,6 @@ public class CompressionRegistry
|
|||
|
||||
public static boolean areItemStacksEqual(ItemStack stack, ItemStack compressedStack)
|
||||
{
|
||||
return stack.isItemEqual(compressedStack) && (stack.getTagCompound() == null ? compressedStack.getTagCompound() == null : stack.getTagCompound().equals(compressedStack.getTagCompound()));
|
||||
return stack.isItemEqual(compressedStack) && (stack.getTagCompound() == null ? !compressedStack.hasTagCompound() : stack.getTagCompound().equals(compressedStack.getTagCompound()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,24 +29,25 @@ public class ItemSigilToggleable extends ItemSigil implements IActivatable
|
|||
@Override
|
||||
public boolean getActivated(ItemStack stack)
|
||||
{
|
||||
return stack != null && NBTHelper.checkNBT(stack).getTagCompound().getBoolean(Constants.NBT.ACTIVATED);
|
||||
return !stack.isEmpty() && NBTHelper.checkNBT(stack).getTagCompound().getBoolean(Constants.NBT.ACTIVATED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack setActivatedState(ItemStack stack, boolean activated)
|
||||
{
|
||||
if (stack != null)
|
||||
if (!stack.isEmpty())
|
||||
{
|
||||
NBTHelper.checkNBT(stack).getTagCompound().setBoolean(Constants.NBT.ACTIVATED, activated);
|
||||
return stack;
|
||||
}
|
||||
|
||||
return null;
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return ActionResult.newResult(EnumActionResult.FAIL, stack);
|
||||
|
||||
|
@ -55,16 +56,16 @@ public class ItemSigilToggleable extends ItemSigil implements IActivatable
|
|||
if (player.isSneaking())
|
||||
setActivatedState(stack, !getActivated(stack));
|
||||
if (getActivated(stack) && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()))
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
return (NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()) && onSigilUse(stack, player, world, pos, side, hitX, hitY, hitZ)) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
|
||||
return (NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()) && onSigilUse(player.getHeldItem(hand), player, world, pos, side, hitX, hitY, hitZ)) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
public boolean onSigilUse(ItemStack itemStack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
|
|
|
@ -1,206 +0,0 @@
|
|||
package WayofTime.bloodmagic.api.network;
|
||||
|
||||
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.event.AddToNetworkEvent;
|
||||
import WayofTime.bloodmagic.api.event.SoulNetworkEvent;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldSavedData;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@Getter
|
||||
@Deprecated
|
||||
/**
|
||||
* Deprecated in favor of new system in {@link WayofTime.bloodmagic.api.saving.BMWorldSavedData} and
|
||||
* {@link WayofTime.bloodmagic.api.saving.SoulNetwork}
|
||||
*/
|
||||
public class SoulNetwork extends WorldSavedData
|
||||
{
|
||||
@Nullable
|
||||
private final EntityPlayer player;
|
||||
private int currentEssence;
|
||||
private int orbTier;
|
||||
|
||||
public SoulNetwork(String name)
|
||||
{
|
||||
super(name);
|
||||
|
||||
currentEssence = 0;
|
||||
orbTier = 0;
|
||||
player = PlayerHelper.getPlayerFromUUID(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
currentEssence = nbttagcompound.getInteger(Constants.NBT.CURRENT_ESSENCE);
|
||||
orbTier = nbttagcompound.getInteger(Constants.NBT.ORB_TIER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
nbttagcompound.setInteger(Constants.NBT.CURRENT_ESSENCE, currentEssence);
|
||||
nbttagcompound.setInteger(Constants.NBT.ORB_TIER, orbTier);
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
public int addLifeEssence(int toAdd, int maximum)
|
||||
{
|
||||
AddToNetworkEvent event = new AddToNetworkEvent(mapName, toAdd, maximum);
|
||||
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
return 0;
|
||||
|
||||
if (FMLCommonHandler.instance().getMinecraftServerInstance() == null)
|
||||
return 0;
|
||||
|
||||
World world = FMLCommonHandler.instance().getMinecraftServerInstance().worldServers[0];
|
||||
SoulNetwork data = (SoulNetwork) world.loadItemData(SoulNetwork.class, event.ownerNetwork);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
data = new SoulNetwork(event.ownerNetwork);
|
||||
world.setItemData(event.ownerNetwork, data);
|
||||
}
|
||||
|
||||
int currEss = data.getCurrentEssence();
|
||||
|
||||
if (currEss >= event.maximum)
|
||||
return 0;
|
||||
|
||||
int newEss = Math.min(event.maximum, currEss + event.addedAmount);
|
||||
if (event.getResult() != Event.Result.DENY)
|
||||
data.setCurrentEssence(newEss);
|
||||
|
||||
markDirty();
|
||||
|
||||
return newEss - currEss;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to syphon LP from the network
|
||||
*
|
||||
* @param syphon
|
||||
* - The amount of LP to syphon
|
||||
*
|
||||
* @return The amount of LP syphoned
|
||||
*/
|
||||
public int syphon(int syphon)
|
||||
{
|
||||
if (getCurrentEssence() >= syphon)
|
||||
{
|
||||
setCurrentEssence(getCurrentEssence() - syphon);
|
||||
return syphon;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Syphons from the network of the owner. If not enough LP is found, it will
|
||||
* instead take away from the user's health.
|
||||
*
|
||||
* Always returns false on the client side.
|
||||
*
|
||||
* @param user
|
||||
* - The Player to syphon from
|
||||
* @param toSyphon
|
||||
* - The amount of LP to syphon
|
||||
*
|
||||
* @return - Whether the action should be performed.
|
||||
*/
|
||||
public boolean syphonAndDamage(EntityPlayer user, int toSyphon)
|
||||
{
|
||||
if (user != null)
|
||||
{
|
||||
if (user.worldObj.isRemote)
|
||||
return false;
|
||||
|
||||
if (!Strings.isNullOrEmpty(mapName))
|
||||
{
|
||||
SoulNetworkEvent.ItemDrainNetworkEvent event = new SoulNetworkEvent.ItemDrainNetworkEvent(user, mapName, null, toSyphon);
|
||||
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
return false;
|
||||
|
||||
int drainAmount = syphon(event.syphon);
|
||||
|
||||
if (drainAmount <= 0 || event.shouldDamage)
|
||||
hurtPlayer(user, event.syphon);
|
||||
|
||||
return event.getResult() != Event.Result.DENY;
|
||||
}
|
||||
|
||||
int amount = syphon(toSyphon);
|
||||
hurtPlayer(user, toSyphon - amount);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void hurtPlayer(EntityPlayer user, float syphon)
|
||||
{
|
||||
if (user != null)
|
||||
{
|
||||
if (syphon < 100 && syphon > 0)
|
||||
{
|
||||
if (!user.capabilities.isCreativeMode)
|
||||
{
|
||||
user.hurtResistantTime = 0;
|
||||
user.attackEntityFrom(BloodMagicAPI.getDamageSource(), 1.0F);
|
||||
}
|
||||
|
||||
} else if (syphon >= 100)
|
||||
{
|
||||
if (!user.capabilities.isCreativeMode)
|
||||
{
|
||||
for (int i = 0; i < ((syphon + 99) / 100); i++)
|
||||
{
|
||||
user.hurtResistantTime = 0;
|
||||
user.attackEntityFrom(BloodMagicAPI.getDamageSource(), 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void causeNauseaToPlayer()
|
||||
{
|
||||
if (getPlayer() != null)
|
||||
{
|
||||
getPlayer().addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 99));
|
||||
}
|
||||
}
|
||||
|
||||
public SoulNetwork setCurrentEssence(int currentEssence)
|
||||
{
|
||||
this.currentEssence = currentEssence;
|
||||
markDirty();
|
||||
return this;
|
||||
}
|
||||
|
||||
public SoulNetwork setOrbTier(int orbTier)
|
||||
{
|
||||
this.orbTier = orbTier;
|
||||
markDirty();
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package WayofTime.bloodmagic.api.network;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -25,9 +25,9 @@ public class AlchemyTableCustomRecipe extends AlchemyTableRecipe
|
|||
@Override
|
||||
protected ItemStack getContainerItem(ItemStack stack)
|
||||
{
|
||||
if (stack == null)
|
||||
if (stack.isEmpty())
|
||||
{
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
ItemStack copyStack = stack.copy();
|
||||
|
@ -42,10 +42,10 @@ public class AlchemyTableCustomRecipe extends AlchemyTableRecipe
|
|||
return copyStack.getItem().getContainerItem(copyStack);
|
||||
}
|
||||
|
||||
copyStack.stackSize--;
|
||||
if (copyStack.stackSize <= 0)
|
||||
copyStack.shrink(1);
|
||||
if (copyStack.isEmpty())
|
||||
{
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
return copyStack;
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import lombok.Getter;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -15,7 +16,7 @@ import net.minecraftforge.oredict.OreDictionary;
|
|||
public class AlchemyTableRecipe
|
||||
{
|
||||
protected ItemStack output = null;
|
||||
protected ArrayList<ItemStack> input = new ArrayList<ItemStack>();
|
||||
protected ArrayList<Object> input = new ArrayList<Object>();
|
||||
@Getter
|
||||
protected int lpDrained;
|
||||
@Getter
|
||||
|
@ -103,13 +104,12 @@ public class AlchemyTableRecipe
|
|||
if (slot != null)
|
||||
{
|
||||
boolean inRecipe = false;
|
||||
Iterator<Object> req = required.iterator();
|
||||
|
||||
while (req.hasNext())
|
||||
for (Object aRequired : required)
|
||||
{
|
||||
boolean match = false;
|
||||
|
||||
Object next = req.next();
|
||||
Object next = aRequired;
|
||||
|
||||
if (next instanceof ItemStack)
|
||||
{
|
||||
|
@ -148,9 +148,9 @@ public class AlchemyTableRecipe
|
|||
*
|
||||
* @return The recipes input vales.
|
||||
*/
|
||||
public ArrayList<ItemStack> getInput()
|
||||
public List<Object> getInput()
|
||||
{
|
||||
return this.input;
|
||||
return ImmutableList.copyOf(input);
|
||||
}
|
||||
|
||||
public ItemStack[] getRemainingItems(ItemStack[] inventory)
|
||||
|
@ -166,9 +166,9 @@ public class AlchemyTableRecipe
|
|||
|
||||
protected ItemStack getContainerItem(ItemStack stack)
|
||||
{
|
||||
if (stack == null)
|
||||
if (stack.isEmpty())
|
||||
{
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
ItemStack copyStack = stack.copy();
|
||||
|
@ -178,10 +178,10 @@ public class AlchemyTableRecipe
|
|||
return copyStack.getItem().getContainerItem(copyStack);
|
||||
}
|
||||
|
||||
copyStack.stackSize--;
|
||||
if (copyStack.stackSize <= 0)
|
||||
copyStack.shrink(1);
|
||||
if (copyStack.isEmpty())
|
||||
{
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
return copyStack;
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -17,7 +18,7 @@ public class LivingArmourDowngradeRecipe
|
|||
{
|
||||
protected LivingArmourUpgrade upgrade = null;
|
||||
protected ItemStack keyStack = null;
|
||||
protected ArrayList<Object> input = new ArrayList<Object>();
|
||||
protected List<Object> input = new ArrayList<Object>();
|
||||
|
||||
public LivingArmourDowngradeRecipe(LivingArmourUpgrade upgrade, ItemStack keyStack, Object... recipe)
|
||||
{
|
||||
|
@ -77,20 +78,17 @@ public class LivingArmourDowngradeRecipe
|
|||
|
||||
ArrayList<Object> required = new ArrayList<Object>(input);
|
||||
|
||||
for (int x = 0; x < checkedList.size(); x++)
|
||||
for (ItemStack slot : checkedList)
|
||||
{
|
||||
ItemStack slot = checkedList.get(x);
|
||||
|
||||
if (slot != null)
|
||||
{
|
||||
boolean inRecipe = false;
|
||||
Iterator<Object> req = required.iterator();
|
||||
|
||||
while (req.hasNext())
|
||||
for (Object aRequired : required)
|
||||
{
|
||||
boolean match = false;
|
||||
|
||||
Object next = req.next();
|
||||
Object next = aRequired;
|
||||
|
||||
if (next instanceof ItemStack)
|
||||
{
|
||||
|
@ -129,9 +127,9 @@ public class LivingArmourDowngradeRecipe
|
|||
*
|
||||
* @return The recipes input vales.
|
||||
*/
|
||||
public ArrayList<Object> getInput()
|
||||
public List<Object> getInput()
|
||||
{
|
||||
return this.input;
|
||||
return ImmutableList.copyOf(input);
|
||||
}
|
||||
|
||||
public ItemStack getKey()
|
||||
|
@ -144,14 +142,14 @@ public class LivingArmourDowngradeRecipe
|
|||
for (int i = 0; i < inv.getSlots(); i++)
|
||||
{
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
if (stack == null)
|
||||
if (stack.isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (stack.getItem().hasContainerItem(stack))
|
||||
{
|
||||
inv.extractItem(i, stack.stackSize, false);
|
||||
inv.extractItem(i, stack.getCount(), false);
|
||||
inv.insertItem(i, stack.getItem().getContainerItem(stack), false);
|
||||
} else
|
||||
{
|
||||
|
@ -162,9 +160,9 @@ public class LivingArmourDowngradeRecipe
|
|||
|
||||
protected ItemStack getContainerItem(ItemStack stack)
|
||||
{
|
||||
if (stack == null)
|
||||
if (stack.isEmpty())
|
||||
{
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
ItemStack copyStack = stack.copy();
|
||||
|
@ -174,10 +172,10 @@ public class LivingArmourDowngradeRecipe
|
|||
return copyStack.getItem().getContainerItem(copyStack);
|
||||
}
|
||||
|
||||
copyStack.stackSize--;
|
||||
if (copyStack.stackSize <= 0)
|
||||
copyStack.shrink(1);
|
||||
if (copyStack.isEmpty())
|
||||
{
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
return copyStack;
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.ShapedRecipes;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
@ -242,7 +243,7 @@ public class ShapedBloodOrbRecipe implements IRecipe
|
|||
// value of the item instead
|
||||
if (target instanceof Integer)
|
||||
{
|
||||
if (slot != null && slot.getItem() instanceof IBloodOrb)
|
||||
if (!slot.isEmpty() && slot.getItem() instanceof IBloodOrb)
|
||||
{
|
||||
IBloodOrb orb = (IBloodOrb) slot.getItem();
|
||||
if (orb.getOrbLevel(slot.getItemDamage()) < (Integer) target)
|
||||
|
@ -271,7 +272,7 @@ public class ShapedBloodOrbRecipe implements IRecipe
|
|||
{
|
||||
return false;
|
||||
}
|
||||
} else if (target == null && slot != null)
|
||||
} else if (target == null && !slot.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -292,7 +293,7 @@ public class ShapedBloodOrbRecipe implements IRecipe
|
|||
return this.input;
|
||||
}
|
||||
|
||||
public ItemStack[] getRemainingItems(InventoryCrafting inv)
|
||||
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv)
|
||||
{
|
||||
return ForgeHooks.defaultRecipeGetRemainingItems(inv);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,9 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -83,7 +85,7 @@ public class ShapelessBloodOrbRecipe implements IRecipe
|
|||
{
|
||||
output = recipe.getRecipeOutput();
|
||||
|
||||
for (ItemStack ingred : ((List<ItemStack>) recipe.recipeItems))
|
||||
for (ItemStack ingred : recipe.recipeItems)
|
||||
{
|
||||
Object finalObj = ingred;
|
||||
for (Entry<ItemStack, String> replace : replacements.entrySet())
|
||||
|
@ -126,7 +128,7 @@ public class ShapelessBloodOrbRecipe implements IRecipe
|
|||
{
|
||||
ItemStack slot = var1.getStackInSlot(x);
|
||||
|
||||
if (slot != null)
|
||||
if (!slot.isEmpty())
|
||||
{
|
||||
boolean inRecipe = false;
|
||||
Iterator<Object> req = required.iterator();
|
||||
|
@ -187,17 +189,9 @@ public class ShapelessBloodOrbRecipe implements IRecipe
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getRemainingItems(InventoryCrafting inv)
|
||||
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv)
|
||||
{
|
||||
ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];
|
||||
|
||||
for (int i = 0; i < aitemstack.length; ++i)
|
||||
{
|
||||
ItemStack itemstack = inv.getStackInSlot(i);
|
||||
aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack);
|
||||
}
|
||||
|
||||
return aitemstack;
|
||||
return ForgeHooks.defaultRecipeGetRemainingItems(inv);
|
||||
}
|
||||
|
||||
public int getTier()
|
||||
|
|
|
@ -78,7 +78,7 @@ public class SoulNetwork implements INBTSerializable<NBTTagCompound>
|
|||
{
|
||||
if (user != null)
|
||||
{
|
||||
if (user.worldObj.isRemote)
|
||||
if (user.getEntityWorld().isRemote)
|
||||
return false;
|
||||
|
||||
if (!Strings.isNullOrEmpty(playerId.toString()))
|
||||
|
|
|
@ -6,6 +6,7 @@ import WayofTime.bloodmagic.api.ritual.IRitualStone;
|
|||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -149,17 +150,17 @@ public class RitualHelper
|
|||
{
|
||||
if (world == null)
|
||||
return;
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if (block instanceof IRitualStone)
|
||||
((IRitualStone) block).setRuneType(world, pos, type);
|
||||
if (state.getBlock() instanceof IRitualStone)
|
||||
((IRitualStone) state.getBlock()).setRuneType(world, pos, type);
|
||||
else if (tile instanceof IRitualStone.Tile)
|
||||
((IRitualStone.Tile) tile).setRuneType(type);
|
||||
else if (tile != null && tile.hasCapability(RUNE_CAPABILITY, null))
|
||||
{
|
||||
tile.getCapability(RUNE_CAPABILITY, null).setRuneType(type);
|
||||
world.notifyBlockOfStateChange(pos, block);
|
||||
world.notifyBlockUpdate(pos, state, state, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package WayofTime.bloodmagic.block;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -27,7 +28,9 @@ import WayofTime.bloodmagic.registry.ModItems;
|
|||
import WayofTime.bloodmagic.tile.TileAlchemyArray;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
public class BlockAlchemyArray extends BlockContainer
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockAlchemyArray extends Block
|
||||
{
|
||||
protected static final AxisAlignedBB ARRAY_AABB = new AxisAlignedBB(0, 0, 0, 1, 0.1, 1);
|
||||
|
||||
|
@ -81,7 +84,7 @@ public class BlockAlchemyArray extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -99,7 +102,7 @@ public class BlockAlchemyArray extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
//TODO: Right click should rotate it
|
||||
TileAlchemyArray array = (TileAlchemyArray) world.getTileEntity(pos);
|
||||
|
@ -109,12 +112,12 @@ public class BlockAlchemyArray extends BlockContainer
|
|||
|
||||
ItemStack playerItem = player.getHeldItem(hand);
|
||||
|
||||
if (playerItem != null)
|
||||
if (!playerItem.isEmpty())
|
||||
{
|
||||
if (array.getStackInSlot(0) == null)
|
||||
if (array.getStackInSlot(0).isEmpty())
|
||||
{
|
||||
Utils.insertItemToTile(array, player, 0);
|
||||
} else if (array.getStackInSlot(0) != null)
|
||||
} else if (!array.getStackInSlot(0).isEmpty())
|
||||
{
|
||||
Utils.insertItemToTile(array, player, 1);
|
||||
array.attemptCraft();
|
||||
|
@ -140,12 +143,6 @@ public class BlockAlchemyArray extends BlockContainer
|
|||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileAlchemyArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
|
||||
{
|
||||
|
@ -155,4 +152,15 @@ public class BlockAlchemyArray extends BlockContainer
|
|||
|
||||
super.breakBlock(world, blockPos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileAlchemyArray();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,9 @@ import WayofTime.bloodmagic.BloodMagic;
|
|||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.tile.TileAlchemyTable;
|
||||
|
||||
public class BlockAlchemyTable extends BlockContainer
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockAlchemyTable extends Block
|
||||
{
|
||||
public static final PropertyBool INVISIBLE = PropertyBool.create("invisible");
|
||||
public static final PropertyEnum<EnumFacing> DIRECTION = PropertyEnum.<EnumFacing>create("direction", EnumFacing.class);
|
||||
|
@ -60,7 +62,7 @@ public class BlockAlchemyTable extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -107,17 +109,11 @@ public class BlockAlchemyTable extends BlockContainer
|
|||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] { DIRECTION, INVISIBLE });
|
||||
return new BlockStateContainer(this, DIRECTION, INVISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileAlchemyTable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
BlockPos position = pos;
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
@ -152,7 +148,18 @@ public class BlockAlchemyTable extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock)
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileAlchemyTable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos)
|
||||
{
|
||||
TileAlchemyTable tile = (TileAlchemyTable) world.getTileEntity(pos);
|
||||
if (tile != null)
|
||||
|
|
|
@ -7,8 +7,7 @@ import WayofTime.bloodmagic.altar.BloodAltar;
|
|||
import WayofTime.bloodmagic.api.altar.EnumAltarComponent;
|
||||
import WayofTime.bloodmagic.api.altar.IBloodAltar;
|
||||
import WayofTime.bloodmagic.api.iface.IDocumentedBlock;
|
||||
import WayofTime.bloodmagic.item.sigil.ItemSigilHolding;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -40,7 +39,9 @@ import WayofTime.bloodmagic.util.Utils;
|
|||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
public class BlockAltar extends BlockContainer implements IVariantProvider, IDocumentedBlock
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockAltar extends Block implements IVariantProvider, IDocumentedBlock
|
||||
{
|
||||
public BlockAltar()
|
||||
{
|
||||
|
@ -74,7 +75,7 @@ public class BlockAltar extends BlockContainer implements IVariantProvider, IDoc
|
|||
|
||||
if (world.getBlockState(pos.down()).getBlock() instanceof BlockBloodStoneBrick)
|
||||
{
|
||||
if (orbStack != null && orbStack.getItem() instanceof IBloodOrb && orbStack.getItem() instanceof IBindable)
|
||||
if (orbStack.getItem() instanceof IBloodOrb && orbStack.getItem() instanceof IBindable)
|
||||
{
|
||||
IBloodOrb bloodOrb = (IBloodOrb) orbStack.getItem();
|
||||
IBindable bindable = (IBindable) orbStack.getItem();
|
||||
|
@ -119,9 +120,9 @@ public class BlockAltar extends BlockContainer implements IVariantProvider, IDoc
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -131,13 +132,7 @@ public class BlockAltar extends BlockContainer implements IVariantProvider, IDoc
|
|||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileAltar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
TileAltar altar = (TileAltar) world.getTileEntity(pos);
|
||||
|
||||
|
@ -146,13 +141,10 @@ public class BlockAltar extends BlockContainer implements IVariantProvider, IDoc
|
|||
|
||||
ItemStack playerItem = player.inventory.getCurrentItem();
|
||||
|
||||
if (playerItem != null)
|
||||
if (playerItem.getItem() instanceof IAltarReader || playerItem.getItem() instanceof IAltarManipulator)
|
||||
{
|
||||
if (playerItem.getItem() instanceof IAltarReader || playerItem.getItem() instanceof IAltarManipulator)
|
||||
{
|
||||
playerItem.getItem().onItemRightClick(playerItem, world, player, hand);
|
||||
return true;
|
||||
}
|
||||
playerItem.getItem().onItemRightClick(world, player, hand);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Utils.insertItemToTile(altar, player))
|
||||
|
@ -178,6 +170,17 @@ public class BlockAltar extends BlockContainer implements IVariantProvider, IDoc
|
|||
super.breakBlock(world, blockPos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileAltar();
|
||||
}
|
||||
|
||||
// IVariantProvider
|
||||
|
||||
@Override
|
||||
|
|
|
@ -70,7 +70,7 @@ public class BlockBloodLight extends Block
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -97,12 +97,12 @@ public class BlockBloodLight extends Block
|
|||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand)
|
||||
{
|
||||
EntityPlayerSP playerSP = Minecraft.getMinecraft().thePlayer;
|
||||
EntityPlayerSP playerSP = Minecraft.getMinecraft().player;
|
||||
|
||||
if (rand.nextInt(3) != 0)
|
||||
{
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + 0.5D + rand.nextGaussian() / 8, pos.getY() + 0.5D, pos.getZ() + 0.5D + rand.nextGaussian() / 8, 0, 0, 0, 0);
|
||||
if (playerSP.getActiveItemStack() != null && playerSP.getActiveItemStack().getItem() == ModItems.SIGIL_BLOOD_LIGHT)
|
||||
if (!playerSP.getActiveItemStack().isEmpty() && playerSP.getActiveItemStack().getItem() == ModItems.SIGIL_BLOOD_LIGHT)
|
||||
{
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + 0.5D + rand.nextGaussian() / 8, pos.getY() + 0.5D, pos.getZ() + 0.5D + rand.nextGaussian() / 8, 0, 0, 0, 0);
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + 0.5D + rand.nextGaussian() / 8, pos.getY() + 0.5D, pos.getZ() + 0.5D + rand.nextGaussian() / 8, 0, 0, 0, 0);
|
||||
|
|
|
@ -52,7 +52,7 @@ public class BlockBloodTank extends BlockInteger implements IVariantProvider
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos)
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
return BOX;
|
||||
}
|
||||
|
@ -89,10 +89,11 @@ public class BlockBloodTank extends BlockInteger implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
ItemStack held = player.getHeldItem(hand);
|
||||
TileBloodTank fluidHandler = (TileBloodTank) world.getTileEntity(blockPos);
|
||||
if (FluidUtil.interactWithFluidHandler(heldItem, fluidHandler.getTank(), player))
|
||||
if (FluidUtil.interactWithFluidHandler(held, fluidHandler.getTank(), player).isSuccess())
|
||||
{
|
||||
world.checkLight(blockPos);
|
||||
world.updateComparatorOutputLevel(blockPos, this);
|
||||
|
|
|
@ -3,6 +3,7 @@ package WayofTime.bloodmagic.block;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -27,7 +28,9 @@ import WayofTime.bloodmagic.client.IVariantProvider;
|
|||
import WayofTime.bloodmagic.tile.TileDemonCrucible;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
public class BlockDemonCrucible extends BlockContainer implements IVariantProvider
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockDemonCrucible extends Block implements IVariantProvider
|
||||
{
|
||||
public BlockDemonCrucible()
|
||||
{
|
||||
|
@ -55,7 +58,7 @@ public class BlockDemonCrucible extends BlockContainer implements IVariantProvid
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -67,25 +70,17 @@ public class BlockDemonCrucible extends BlockContainer implements IVariantProvid
|
|||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileDemonCrucible();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
ItemStack heldItem = player.getHeldItem(hand);
|
||||
TileDemonCrucible crucible = (TileDemonCrucible) world.getTileEntity(pos);
|
||||
|
||||
if (crucible == null || player.isSneaking())
|
||||
return false;
|
||||
|
||||
if (heldItem != null)
|
||||
if (!(heldItem.getItem() instanceof IDiscreteDemonWill) && !(heldItem.getItem() instanceof IDemonWillGem))
|
||||
{
|
||||
if (!(heldItem.getItem() instanceof IDiscreteDemonWill) && !(heldItem.getItem() instanceof IDemonWillGem))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Utils.insertItemToTile(crucible, player);
|
||||
|
@ -104,6 +99,17 @@ public class BlockDemonCrucible extends BlockContainer implements IVariantProvid
|
|||
super.breakBlock(world, blockPos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileDemonCrucible();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pair<Integer, String>> getVariants()
|
||||
{
|
||||
|
|
|
@ -19,6 +19,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -31,7 +32,9 @@ import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
|||
import WayofTime.bloodmagic.item.ItemDemonCrystal;
|
||||
import WayofTime.bloodmagic.tile.TileDemonCrystal;
|
||||
|
||||
public class BlockDemonCrystal extends BlockContainer
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockDemonCrystal extends Block
|
||||
{
|
||||
public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 6);
|
||||
public static final PropertyEnum<EnumDemonWillType> TYPE = PropertyEnum.<EnumDemonWillType>create("type", EnumDemonWillType.class);
|
||||
|
@ -60,7 +63,7 @@ public class BlockDemonCrystal extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock)
|
||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos)
|
||||
{
|
||||
TileDemonCrystal tile = (TileDemonCrystal) world.getTileEntity(pos);
|
||||
EnumFacing placement = tile.getPlacement();
|
||||
|
@ -87,7 +90,7 @@ public class BlockDemonCrystal extends BlockContainer
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List<ItemStack> list)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, NonNullList<ItemStack> list)
|
||||
{
|
||||
for (int i = 0; i < EnumDemonWillType.values().length; i++)
|
||||
list.add(new ItemStack(this, 1, i));
|
||||
|
@ -112,7 +115,7 @@ public class BlockDemonCrystal extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -143,19 +146,13 @@ public class BlockDemonCrystal extends BlockContainer
|
|||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
return ((EnumDemonWillType) state.getValue(TYPE)).ordinal();
|
||||
return state.getValue(TYPE).ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] { TYPE, AGE, ATTACHED });
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileDemonCrystal();
|
||||
return new BlockStateContainer(this, TYPE, AGE, ATTACHED);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -191,7 +188,7 @@ public class BlockDemonCrystal extends BlockContainer
|
|||
break;
|
||||
}
|
||||
|
||||
stack.stackSize = crystalNumber;
|
||||
stack.setCount(crystalNumber);
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
@ -202,7 +199,7 @@ public class BlockDemonCrystal extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
|
@ -221,7 +218,18 @@ public class BlockDemonCrystal extends BlockContainer
|
|||
return true;
|
||||
}
|
||||
|
||||
// @Override
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileDemonCrystal();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public java.util.List<ItemStack> getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
// {
|
||||
// java.util.List<ItemStack> ret = super.getDrops(world, pos, state, fortune);
|
||||
|
|
|
@ -61,7 +61,7 @@ public class BlockDemonCrystallizer extends BlockContainer implements IVariantPr
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class BlockDemonPylon extends BlockContainer implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ import WayofTime.bloodmagic.api.Constants;
|
|||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.teleport.PortalLocation;
|
||||
import WayofTime.bloodmagic.api.teleport.TeleportQueue;
|
||||
import WayofTime.bloodmagic.block.base.BlockIntegerContainer;
|
||||
import WayofTime.bloodmagic.ritual.portal.LocationsHandler;
|
||||
import WayofTime.bloodmagic.ritual.portal.Teleports;
|
||||
import WayofTime.bloodmagic.tile.TileDimensionalPortal;
|
||||
|
|
|
@ -3,6 +3,7 @@ package WayofTime.bloodmagic.block;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -21,7 +22,9 @@ import WayofTime.bloodmagic.api.Constants;
|
|||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TileIncenseAltar;
|
||||
|
||||
public class BlockIncenseAltar extends BlockContainer implements IVariantProvider
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockIncenseAltar extends Block implements IVariantProvider
|
||||
{
|
||||
protected static final AxisAlignedBB AABB = new AxisAlignedBB(0.3F, 0F, 0.3F, 0.72F, 1F, 0.72F);
|
||||
|
||||
|
@ -61,7 +64,7 @@ public class BlockIncenseAltar extends BlockContainer implements IVariantProvide
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -72,12 +75,6 @@ public class BlockIncenseAltar extends BlockContainer implements IVariantProvide
|
|||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileIncenseAltar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
|
||||
{
|
||||
|
@ -88,6 +85,17 @@ public class BlockIncenseAltar extends BlockContainer implements IVariantProvide
|
|||
super.breakBlock(world, blockPos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileIncenseAltar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pair<Integer, String>> getVariants()
|
||||
{
|
||||
|
|
|
@ -41,7 +41,7 @@ public class BlockInputRoutingNode extends BlockRoutingNode
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (world.getTileEntity(pos) instanceof TileInputRoutingNode)
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@ package WayofTime.bloodmagic.block;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.block.base.BlockEnum;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
|
@ -19,13 +20,11 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.block.base.BlockEnumContainer;
|
||||
import WayofTime.bloodmagic.block.enums.EnumSubWillType;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TileInversionPillar;
|
||||
|
||||
public class BlockInversionPillar extends BlockEnumContainer<EnumSubWillType> implements IVariantProvider
|
||||
public class BlockInversionPillar extends BlockEnum<EnumSubWillType> implements IVariantProvider
|
||||
{
|
||||
public BlockInversionPillar()
|
||||
{
|
||||
|
@ -77,7 +76,7 @@ public class BlockInversionPillar extends BlockEnumContainer<EnumSubWillType> im
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public class BlockInversionPillarEnd extends BlockEnum<EnumInversionCap> impleme
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -31,14 +31,6 @@ public class BlockLifeEssence extends BlockFluidClassic
|
|||
BloodMagicAPI.setLifeEssence(getLifeEssence());
|
||||
}
|
||||
|
||||
// TODO - Remove after Forge fixes
|
||||
// Fix for BlockFluidBase not overriding this
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
return getBlockState().getBaseState().withProperty(LEVEL, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDisplace(IBlockAccess world, BlockPos blockPos)
|
||||
{
|
||||
|
|
|
@ -5,11 +5,13 @@ import java.util.List;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import WayofTime.bloodmagic.block.base.BlockEnum;
|
||||
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.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -31,14 +33,13 @@ import WayofTime.bloodmagic.BloodMagic;
|
|||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.altar.EnumAltarComponent;
|
||||
import WayofTime.bloodmagic.api.altar.IAltarComponent;
|
||||
import WayofTime.bloodmagic.block.base.BlockEnumContainer;
|
||||
import WayofTime.bloodmagic.block.enums.EnumMimic;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.registry.ModBlocks;
|
||||
import WayofTime.bloodmagic.tile.TileMimic;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
public class BlockMimic extends BlockEnumContainer<EnumMimic> implements IVariantProvider, IAltarComponent
|
||||
public class BlockMimic extends BlockEnum<EnumMimic> implements IVariantProvider, IAltarComponent
|
||||
{
|
||||
public static final int sentientMimicMeta = 4;
|
||||
|
||||
|
@ -56,7 +57,8 @@ public class BlockMimic extends BlockEnumContainer<EnumMimic> implements IVarian
|
|||
}
|
||||
|
||||
@Nullable
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, World world, BlockPos pos)
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
switch (this.getMetaFromState(state))
|
||||
{
|
||||
|
@ -65,10 +67,10 @@ public class BlockMimic extends BlockEnumContainer<EnumMimic> implements IVarian
|
|||
case 3:
|
||||
case 4:
|
||||
TileMimic tileMimic = (TileMimic) world.getTileEntity(pos);
|
||||
if (tileMimic != null && tileMimic.getStackInSlot(0) != null)
|
||||
if (tileMimic != null && !tileMimic.getStackInSlot(0).isEmpty())
|
||||
{
|
||||
Block mimicBlock = Block.getBlockFromItem(tileMimic.getStackInSlot(0).getItem());
|
||||
if (mimicBlock == null)
|
||||
if (mimicBlock == Blocks.AIR)
|
||||
{
|
||||
return FULL_BLOCK_AABB;
|
||||
}
|
||||
|
@ -93,10 +95,10 @@ public class BlockMimic extends BlockEnumContainer<EnumMimic> implements IVarian
|
|||
public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World world, BlockPos pos)
|
||||
{
|
||||
TileMimic tileMimic = (TileMimic) world.getTileEntity(pos);
|
||||
if (tileMimic != null && tileMimic.getStackInSlot(0) != null)
|
||||
if (tileMimic != null && !tileMimic.getStackInSlot(0).isEmpty())
|
||||
{
|
||||
Block mimicBlock = Block.getBlockFromItem(tileMimic.getStackInSlot(0).getItem());
|
||||
if (mimicBlock == null)
|
||||
if (mimicBlock == Blocks.AIR)
|
||||
{
|
||||
return FULL_BLOCK_AABB;
|
||||
}
|
||||
|
@ -147,14 +149,10 @@ public class BlockMimic extends BlockEnumContainer<EnumMimic> implements IVarian
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
TileMimic mimic = (TileMimic) world.getTileEntity(pos);
|
||||
|
||||
if (mimic == null)
|
||||
return false;
|
||||
|
||||
return mimic.onBlockActivated(world, pos, state, player, hand, heldItem, side);
|
||||
return mimic != null && mimic.onBlockActivated(world, pos, state, player, hand, player.getHeldItem(hand), side);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -165,7 +163,7 @@ public class BlockMimic extends BlockEnumContainer<EnumMimic> implements IVarian
|
|||
{
|
||||
TileMimic mimic = (TileMimic) tile;
|
||||
ItemStack stack = mimic.getStackInSlot(0);
|
||||
if (stack != null && stack.getItem() instanceof ItemBlock)
|
||||
if (stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
Block block = ((ItemBlock) stack.getItem()).getBlock();
|
||||
IBlockState mimicState = block.getStateFromMeta(stack.getItemDamage());
|
||||
|
@ -196,7 +194,7 @@ public class BlockMimic extends BlockEnumContainer<EnumMimic> implements IVarian
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -257,7 +255,7 @@ public class BlockMimic extends BlockEnumContainer<EnumMimic> implements IVarian
|
|||
{
|
||||
TileMimic mimic = (TileMimic) tile;
|
||||
ItemStack stack = mimic.getStackInSlot(0);
|
||||
if (stack != null && stack.getItem() instanceof ItemBlock)
|
||||
if (stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
Block block = ((ItemBlock) stack.getItem()).getBlock();
|
||||
if (block instanceof IAltarComponent)
|
||||
|
|
|
@ -12,6 +12,8 @@ import WayofTime.bloodmagic.BloodMagic;
|
|||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.tile.routing.TileOutputRoutingNode;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockOutputRoutingNode extends BlockRoutingNode
|
||||
{
|
||||
public BlockOutputRoutingNode()
|
||||
|
@ -21,12 +23,6 @@ public class BlockOutputRoutingNode extends BlockRoutingNode
|
|||
setUnlocalizedName(Constants.Mod.MODID + ".outputRouting");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileOutputRoutingNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
//TODO: Combine BlockOutputRoutingNode and BlockInputRoutingNode so they have the same superclass
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
|
@ -41,7 +37,7 @@ public class BlockOutputRoutingNode extends BlockRoutingNode
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (world.getTileEntity(pos) instanceof TileOutputRoutingNode)
|
||||
{
|
||||
|
@ -50,4 +46,15 @@ public class BlockOutputRoutingNode extends BlockRoutingNode
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileOutputRoutingNode();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -25,7 +26,9 @@ import WayofTime.bloodmagic.api.Constants;
|
|||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TilePhantomBlock;
|
||||
|
||||
public class BlockPhantom extends BlockContainer implements IVariantProvider
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockPhantom extends Block implements IVariantProvider
|
||||
{
|
||||
public BlockPhantom()
|
||||
{
|
||||
|
@ -54,7 +57,7 @@ public class BlockPhantom extends BlockContainer implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -86,8 +89,13 @@ public class BlockPhantom extends BlockContainer implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TilePhantomBlock(100);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ import WayofTime.bloodmagic.api.registry.RitualRegistry;
|
|||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
import WayofTime.bloodmagic.api.ritual.imperfect.ImperfectRitual;
|
||||
import WayofTime.bloodmagic.api.util.helper.RitualHelper;
|
||||
import WayofTime.bloodmagic.block.base.BlockEnumContainer;
|
||||
import WayofTime.bloodmagic.block.enums.EnumRitualController;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.registry.ModItems;
|
||||
|
|
|
@ -18,7 +18,7 @@ import WayofTime.bloodmagic.BloodMagic;
|
|||
import WayofTime.bloodmagic.tile.routing.TileMasterRoutingNode;
|
||||
import WayofTime.bloodmagic.tile.routing.TileRoutingNode;
|
||||
|
||||
public abstract class BlockRoutingNode extends BlockContainer
|
||||
public class BlockRoutingNode extends Block
|
||||
{
|
||||
protected static final AxisAlignedBB AABB = new AxisAlignedBB(0.378F, 0.378F, 0.378F, 0.625F, 0.625F, 0.625F);
|
||||
|
||||
|
@ -72,7 +72,7 @@ public abstract class BlockRoutingNode extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package WayofTime.bloodmagic.block;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -26,7 +27,9 @@ import WayofTime.bloodmagic.api.Constants;
|
|||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TileSoulForge;
|
||||
|
||||
public class BlockSoulForge extends BlockContainer implements IVariantProvider
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockSoulForge extends Block implements IVariantProvider
|
||||
{
|
||||
protected static final AxisAlignedBB AABB = new AxisAlignedBB(0.06F, 0.0F, 0.06F, 0.94F, 0.75F, 0.94F);
|
||||
|
||||
|
@ -67,7 +70,7 @@ public class BlockSoulForge extends BlockContainer implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -79,7 +82,7 @@ public class BlockSoulForge extends BlockContainer implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (world.getTileEntity(pos) instanceof TileSoulForge)
|
||||
player.openGui(BloodMagic.instance, Constants.Gui.SOUL_FORGE_GUI, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
|
@ -98,8 +101,13 @@ public class BlockSoulForge extends BlockContainer implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileSoulForge();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
import java.util.Random;
|
||||
|
||||
import WayofTime.bloodmagic.ConfigHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -27,7 +28,9 @@ import WayofTime.bloodmagic.api.Constants;
|
|||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TileSpectralBlock;
|
||||
|
||||
public class BlockSpectral extends BlockContainer implements IVariantProvider
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockSpectral extends Block implements IVariantProvider
|
||||
{
|
||||
protected static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
|
||||
|
||||
|
@ -63,7 +66,7 @@ public class BlockSpectral extends BlockContainer implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -112,8 +115,13 @@ public class BlockSpectral extends BlockContainer implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileSpectralBlock();
|
||||
}
|
||||
|
||||
|
|
|
@ -43,11 +43,11 @@ public class BlockTeleposer extends BlockContainer implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
ItemStack playerItem = heldItem;
|
||||
ItemStack playerItem = player.getHeldItem(hand);
|
||||
|
||||
if (playerItem != null && playerItem.getItem() instanceof ItemTelepositionFocus)
|
||||
if (playerItem.getItem() instanceof ItemTelepositionFocus)
|
||||
((ItemTelepositionFocus) playerItem.getItem()).setBlockPos(playerItem, world, pos);
|
||||
else if (world.getTileEntity(pos) instanceof TileTeleposer)
|
||||
player.openGui(BloodMagic.instance, Constants.Gui.TELEPOSER_GUI, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -69,7 +70,7 @@ public class BlockEnum<E extends Enum<E> & IStringSerializable> extends Block
|
|||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> subBlocks)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, NonNullList<ItemStack> subBlocks)
|
||||
{
|
||||
for (E type : types)
|
||||
subBlocks.add(new ItemStack(item, 1, type.ordinal()));
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
package WayofTime.bloodmagic.block.base;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class BlockEnumContainer<E extends Enum<E> & IStringSerializable> extends BlockEnum<E>
|
||||
{
|
||||
public BlockEnumContainer(Material material, Class<E> enumClass, String propName)
|
||||
{
|
||||
super(material, enumClass, propName);
|
||||
}
|
||||
|
||||
public BlockEnumContainer(Material material, Class<E> enumClass)
|
||||
{
|
||||
this(material, enumClass, "type");
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract boolean hasTileEntity(IBlockState state);
|
||||
|
||||
@Override
|
||||
public abstract TileEntity createTileEntity(World world, IBlockState state);
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
super.breakBlock(worldIn, pos, state);
|
||||
worldIn.removeTileEntity(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventReceived(IBlockState state, World worldIn, BlockPos pos, int eventID, int eventParam)
|
||||
{
|
||||
super.eventReceived(state, worldIn, pos, eventID, eventParam);
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventID, eventParam);
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ import net.minecraft.entity.EntityLivingBase;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -122,15 +123,17 @@ public class BlockEnumPillar<E extends Enum<E> & IStringSerializable> extends Bl
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack createStackedBlock(IBlockState state)
|
||||
protected ItemStack getSilkTouchDrop(IBlockState state)
|
||||
{
|
||||
return new ItemStack(this, 1, damageDropped(state));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand)
|
||||
{
|
||||
return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(BlockRotatedPillar.AXIS, facing.getAxis());
|
||||
return super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, hand).withProperty(BlockRotatedPillar.AXIS, facing.getAxis());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,10 +7,7 @@ import net.minecraft.block.state.IBlockState;
|
|||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -70,15 +67,15 @@ public class BlockEnumPillarCap<E extends Enum<E> & IStringSerializable> extends
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack createStackedBlock(IBlockState state)
|
||||
protected ItemStack getSilkTouchDrop(IBlockState state)
|
||||
{
|
||||
return new ItemStack(this, 1, damageDropped(state));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand)
|
||||
{
|
||||
return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(FACING, facing);
|
||||
return super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, hand).withProperty(FACING, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,10 +16,7 @@ import net.minecraft.entity.Entity;
|
|||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
|
@ -172,9 +169,9 @@ public class BlockEnumStairs<E extends Enum<E> & IStringSerializable> extends Bl
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand)
|
||||
{
|
||||
IBlockState state = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer);
|
||||
IBlockState state = super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, hand);
|
||||
state = state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(BlockStairs.SHAPE, BlockStairs.EnumShape.STRAIGHT);
|
||||
return facing != EnumFacing.DOWN && (facing == EnumFacing.UP || (double) hitY <= 0.5D) ? state.withProperty(BlockStairs.HALF, BlockStairs.EnumHalf.BOTTOM) : state.withProperty(BlockStairs.HALF, BlockStairs.EnumHalf.TOP);
|
||||
}
|
||||
|
@ -349,7 +346,7 @@ public class BlockEnumStairs<E extends Enum<E> & IStringSerializable> extends Bl
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack createStackedBlock(IBlockState state)
|
||||
protected ItemStack getSilkTouchDrop(IBlockState state)
|
||||
{
|
||||
return new ItemStack(this, 1, damageDropped(state));
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import net.minecraft.util.IStringSerializable;
|
|||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -54,7 +53,7 @@ public class BlockEnumWall<E extends Enum<E> & IStringSerializable> extends Bloc
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos)
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
blockState = blockState.getActualState(worldIn, pos);
|
||||
return CLIP_AABB_BY_INDEX[getAABBIndex(blockState)];
|
||||
|
@ -129,7 +128,7 @@ public class BlockEnumWall<E extends Enum<E> & IStringSerializable> extends Bloc
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack createStackedBlock(IBlockState state)
|
||||
protected ItemStack getSilkTouchDrop(IBlockState state)
|
||||
{
|
||||
return new ItemStack(this, 1, damageDropped(state));
|
||||
}
|
||||
|
|
|
@ -9,11 +9,10 @@ import net.minecraft.block.state.IBlockState;
|
|||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Creates a block that has multiple meta-based states.
|
||||
*
|
||||
|
@ -68,7 +67,7 @@ public class BlockInteger extends Block
|
|||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> subBlocks) {
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, NonNullList<ItemStack> subBlocks) {
|
||||
for (int i = 0; i < maxMeta; i++)
|
||||
subBlocks.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
package WayofTime.bloodmagic.block.base;
|
||||
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class BlockIntegerContainer extends BlockInteger implements ITileEntityProvider
|
||||
{
|
||||
public BlockIntegerContainer(Material material, int maxMeta, String propName)
|
||||
{
|
||||
super(material, maxMeta, propName);
|
||||
|
||||
this.isBlockContainer = true;
|
||||
}
|
||||
|
||||
public BlockIntegerContainer(Material material, int maxMeta)
|
||||
{
|
||||
this(material, maxMeta, "meta");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
super.breakBlock(worldIn, pos, state);
|
||||
worldIn.removeTileEntity(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventReceived(IBlockState state, World worldIn, BlockPos pos, int eventID, int eventParam)
|
||||
{
|
||||
super.eventReceived(state, worldIn, pos, eventID, eventParam);
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventID, eventParam);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
package WayofTime.bloodmagic.block.base;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -11,6 +9,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import WayofTime.bloodmagic.block.property.PropertyString;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
@ -79,7 +78,7 @@ public class BlockString extends Block
|
|||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> subBlocks)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, NonNullList<ItemStack> subBlocks)
|
||||
{
|
||||
for (int i = 0; i < maxMeta; i++)
|
||||
subBlocks.add(new ItemStack(item, 1, i));
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
package WayofTime.bloodmagic.block.base;
|
||||
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class BlockStringContainer extends BlockString implements ITileEntityProvider
|
||||
{
|
||||
public BlockStringContainer(Material material, String[] values, String propName)
|
||||
{
|
||||
super(material, values, propName);
|
||||
|
||||
this.isBlockContainer = true;
|
||||
}
|
||||
|
||||
public BlockStringContainer(Material material, String[] values)
|
||||
{
|
||||
this(material, values, "type");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
super.breakBlock(worldIn, pos, state);
|
||||
worldIn.removeTileEntity(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventReceived(IBlockState state, World worldIn, BlockPos pos, int eventID, int eventParam)
|
||||
{
|
||||
super.eventReceived(state, worldIn, pos, eventID, eventParam);
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventID, eventParam);
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
package WayofTime.bloodmagic.block.property;
|
||||
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
public class UnlistedPropertyInteger implements IUnlistedProperty<Integer>
|
||||
{
|
||||
private int maxMeta;
|
||||
private String propName;
|
||||
|
||||
public UnlistedPropertyInteger(int maxMeta, String propName)
|
||||
{
|
||||
this.maxMeta = maxMeta;
|
||||
this.propName = propName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return propName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(Integer value)
|
||||
{
|
||||
return value <= maxMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Integer> getType()
|
||||
{
|
||||
return Integer.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String valueToString(Integer value)
|
||||
{
|
||||
return value.toString();
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
package WayofTime.bloodmagic.block.property;
|
||||
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class UnlistedPropertyString implements IUnlistedProperty<String>
|
||||
{
|
||||
private List values;
|
||||
private String propName;
|
||||
|
||||
public UnlistedPropertyString(String[] values, String propName)
|
||||
{
|
||||
this.values = Arrays.asList(values);
|
||||
this.propName = propName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return propName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(String value)
|
||||
{
|
||||
return values.contains(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<String> getType()
|
||||
{
|
||||
return String.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String valueToString(String value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
|
@ -1,77 +1,46 @@
|
|||
package WayofTime.bloodmagic.command;
|
||||
|
||||
import WayofTime.bloodmagic.command.sub.SubCommandBind;
|
||||
import WayofTime.bloodmagic.command.sub.SubCommandHelp;
|
||||
import WayofTime.bloodmagic.command.sub.SubCommandNetwork;
|
||||
import WayofTime.bloodmagic.command.sub.SubCommandOrb;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraftforge.server.command.CommandTreeBase;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class CommandBloodMagic extends CommandBase
|
||||
public class CommandBloodMagic extends CommandTreeBase
|
||||
{
|
||||
// TODO - Move this and sub commands to CommandTreeBase in 1.11. Much cleaner impl
|
||||
private final List<String> aliases = new ArrayList<String>();
|
||||
private final Map<String, ISubCommand> subCommands = new HashMap<String, ISubCommand>();
|
||||
|
||||
public CommandBloodMagic()
|
||||
{
|
||||
aliases.add("BloodMagic");
|
||||
aliases.add("bloodmagic");
|
||||
aliases.add("bloodMagic");
|
||||
aliases.add("bm");
|
||||
|
||||
subCommands.put("help", new SubCommandHelp(this));
|
||||
subCommands.put("network", new SubCommandNetwork(this));
|
||||
subCommands.put("bind", new SubCommandBind(this));
|
||||
subCommands.put("orb", new SubCommandOrb(this));
|
||||
addSubcommand(new SubCommandBind());
|
||||
addSubcommand(new SubCommandNetwork());
|
||||
addSubcommand(new SubCommandOrb());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName()
|
||||
public String getName()
|
||||
{
|
||||
return "/bloodmagic";
|
||||
return "bloodmagic";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRequiredPermissionLevel()
|
||||
public String getUsage(ICommandSender sender)
|
||||
{
|
||||
return 2;
|
||||
return "/bloodmagic help";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandUsage(ICommandSender commandSender)
|
||||
public static void displayHelpString(ICommandSender commandSender, String display, Object... info)
|
||||
{
|
||||
return getCommandName() + " help";
|
||||
commandSender.sendMessage(new TextComponentString(TextHelper.localizeEffect(display, info)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getCommandAliases()
|
||||
public static void displayErrorString(ICommandSender commandSender, String display, Object... info)
|
||||
{
|
||||
return aliases;
|
||||
commandSender.sendMessage(new TextComponentString(TextHelper.localizeEffect(display, info)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(MinecraftServer server, ICommandSender commandSender, String[] args)
|
||||
public static void displaySuccessString(ICommandSender commandSender, String display, Object... info)
|
||||
{
|
||||
if (args.length > 0 && subCommands.containsKey(args[0]))
|
||||
{
|
||||
|
||||
ISubCommand subCommand = subCommands.get(args[0]);
|
||||
String[] subArgs = Arrays.copyOfRange(args, 1, args.length);
|
||||
subCommand.processSubCommand(server, commandSender, subArgs);
|
||||
} else
|
||||
{
|
||||
commandSender.addChatMessage(new TextComponentString(TextHelper.localizeEffect("commands.error.unknown")));
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, ISubCommand> getSubCommands()
|
||||
{
|
||||
return subCommands;
|
||||
commandSender.sendMessage(new TextComponentString(TextHelper.localizeEffect(display, info)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
package WayofTime.bloodmagic.command;
|
||||
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
public interface ISubCommand
|
||||
{
|
||||
|
||||
String getSubCommandName();
|
||||
|
||||
ICommand getParentCommand();
|
||||
|
||||
String getArgUsage(ICommandSender commandSender);
|
||||
|
||||
String getHelpText();
|
||||
|
||||
void processSubCommand(MinecraftServer server, ICommandSender commandSender, String[] args);
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
package WayofTime.bloodmagic.command;
|
||||
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public abstract class SubCommandBase implements ISubCommand
|
||||
{
|
||||
|
||||
private ICommand parent;
|
||||
private String name;
|
||||
|
||||
public SubCommandBase(ICommand parent, String name)
|
||||
{
|
||||
this.parent = parent;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSubCommandName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICommand getParentCommand()
|
||||
{
|
||||
return parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processSubCommand(MinecraftServer server, ICommandSender commandSender, String[] args)
|
||||
{
|
||||
|
||||
if (args.length == 0 && !getSubCommandName().equals("help"))
|
||||
displayErrorString(commandSender, String.format(TextHelper.localizeEffect("commands.format.error"), capitalizeFirstLetter(getSubCommandName()), getArgUsage(commandSender)));
|
||||
|
||||
if (isBounded(0, 2, args.length) && args[0].equals("help"))
|
||||
displayHelpString(commandSender, String.format(TextHelper.localizeEffect("commands.format.help"), capitalizeFirstLetter(getSubCommandName()), getHelpText()));
|
||||
}
|
||||
|
||||
protected String capitalizeFirstLetter(String toCapital)
|
||||
{
|
||||
return String.valueOf(toCapital.charAt(0)).toUpperCase(Locale.ENGLISH) + toCapital.substring(1);
|
||||
}
|
||||
|
||||
protected boolean isBounded(int low, int high, int given)
|
||||
{
|
||||
return given > low && given < high;
|
||||
}
|
||||
|
||||
public static void displayHelpString(ICommandSender commandSender, String display, Object... info)
|
||||
{
|
||||
commandSender.addChatMessage(new TextComponentString(TextHelper.localizeEffect(display, info)));
|
||||
}
|
||||
|
||||
public static void displayErrorString(ICommandSender commandSender, String display, Object... info)
|
||||
{
|
||||
commandSender.addChatMessage(new TextComponentString(TextHelper.localizeEffect(display, info)));
|
||||
}
|
||||
|
||||
public static void displaySuccessString(ICommandSender commandSender, String display, Object... info)
|
||||
{
|
||||
commandSender.addChatMessage(new TextComponentString(TextHelper.localizeEffect(display, info)));
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package WayofTime.bloodmagic.command;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -4,43 +4,31 @@ import WayofTime.bloodmagic.api.Constants;
|
|||
import WayofTime.bloodmagic.api.iface.IBindable;
|
||||
import WayofTime.bloodmagic.api.util.helper.BindableHelper;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
import WayofTime.bloodmagic.command.SubCommandBase;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import com.google.common.base.Strings;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.command.PlayerNotFoundException;
|
||||
import net.minecraft.command.*;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
|
||||
public class SubCommandBind extends SubCommandBase
|
||||
public class SubCommandBind extends CommandBase
|
||||
{
|
||||
|
||||
public SubCommandBind(ICommand parent)
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
super(parent, "bind");
|
||||
return "bind";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArgUsage(ICommandSender commandSender)
|
||||
public String getUsage(ICommandSender commandSender)
|
||||
{
|
||||
return TextHelper.localizeEffect("commands.bind.usage");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelpText()
|
||||
public void execute(MinecraftServer server, ICommandSender commandSender, String[] args) throws CommandException
|
||||
{
|
||||
return TextHelper.localizeEffect("commands.bind.help");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processSubCommand(MinecraftServer server, ICommandSender commandSender, String[] args)
|
||||
{
|
||||
super.processSubCommand(server, commandSender, args);
|
||||
|
||||
if (commandSender.getEntityWorld().isRemote)
|
||||
return;
|
||||
|
||||
|
@ -52,7 +40,7 @@ public class SubCommandBind extends SubCommandBase
|
|||
ItemStack held = player.getHeldItemMainhand();
|
||||
boolean bind = true;
|
||||
|
||||
if (held != null && held.getItem() instanceof IBindable)
|
||||
if (held.getItem() instanceof IBindable)
|
||||
{
|
||||
if (args.length > 0)
|
||||
{
|
||||
|
@ -77,20 +65,20 @@ public class SubCommandBind extends SubCommandBase
|
|||
{
|
||||
BindableHelper.setItemOwnerName(held, playerName);
|
||||
BindableHelper.setItemOwnerUUID(held, uuid);
|
||||
commandSender.addChatMessage(new TextComponentTranslation("commands.bind.success"));
|
||||
commandSender.sendMessage(new TextComponentTranslation("commands.bind.success"));
|
||||
} else
|
||||
{
|
||||
if (!Strings.isNullOrEmpty(((IBindable) held.getItem()).getOwnerUUID(held)))
|
||||
{
|
||||
held.getTagCompound().removeTag(Constants.NBT.OWNER_UUID);
|
||||
held.getTagCompound().removeTag(Constants.NBT.OWNER_NAME);
|
||||
commandSender.addChatMessage(new TextComponentTranslation("commands.bind.remove.success"));
|
||||
commandSender.sendMessage(new TextComponentTranslation("commands.bind.remove.success"));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (PlayerNotFoundException e)
|
||||
{
|
||||
commandSender.addChatMessage(new TextComponentTranslation(TextHelper.localizeEffect("commands.error.404")));
|
||||
commandSender.sendMessage(new TextComponentTranslation(TextHelper.localizeEffect("commands.error.404")));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
package WayofTime.bloodmagic.command.sub;
|
||||
|
||||
import WayofTime.bloodmagic.command.CommandBloodMagic;
|
||||
import WayofTime.bloodmagic.command.ISubCommand;
|
||||
import WayofTime.bloodmagic.command.SubCommandBase;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
|
||||
public class SubCommandHelp extends SubCommandBase
|
||||
{
|
||||
|
||||
public SubCommandHelp(ICommand parent)
|
||||
{
|
||||
super(parent, "help");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArgUsage(ICommandSender commandSender)
|
||||
{
|
||||
return TextHelper.localize("commands.help.usage");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelpText()
|
||||
{
|
||||
return TextHelper.localizeEffect("commands.help.help");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processSubCommand(MinecraftServer server, ICommandSender commandSender, String[] args)
|
||||
{
|
||||
super.processSubCommand(server, commandSender, args);
|
||||
|
||||
if (args.length > 0)
|
||||
return;
|
||||
|
||||
for (ISubCommand subCommand : ((CommandBloodMagic) getParentCommand()).getSubCommands().values())
|
||||
commandSender.addChatMessage(new TextComponentString(TextHelper.localizeEffect("commands.format.help", capitalizeFirstLetter(subCommand.getSubCommandName()), subCommand.getArgUsage(commandSender))));
|
||||
}
|
||||
}
|
|
@ -2,45 +2,32 @@ package WayofTime.bloodmagic.command.sub;
|
|||
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.command.SubCommandBase;
|
||||
import WayofTime.bloodmagic.command.CommandBloodMagic;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.command.PlayerNotFoundException;
|
||||
import net.minecraft.command.*;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class SubCommandNetwork extends SubCommandBase
|
||||
public class SubCommandNetwork extends CommandBase
|
||||
{
|
||||
|
||||
public SubCommandNetwork(ICommand parent)
|
||||
{
|
||||
super(parent, "network");
|
||||
@Override
|
||||
public String getName() {
|
||||
return "network";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArgUsage(ICommandSender commandSender)
|
||||
public String getUsage(ICommandSender commandSender)
|
||||
{
|
||||
return TextHelper.localizeEffect("commands.network.usage");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelpText()
|
||||
public void execute(MinecraftServer server, ICommandSender commandSender, String[] args) throws CommandException
|
||||
{
|
||||
return TextHelper.localizeEffect("commands.network.help");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processSubCommand(MinecraftServer server, ICommandSender commandSender, String[] args)
|
||||
{
|
||||
super.processSubCommand(server, commandSender, args);
|
||||
|
||||
if (args.length > 1)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("help"))
|
||||
|
@ -53,18 +40,18 @@ public class SubCommandNetwork extends SubCommandBase
|
|||
try
|
||||
{
|
||||
ValidCommands command = ValidCommands.valueOf(args[0].toUpperCase(Locale.ENGLISH));
|
||||
command.run(player, commandSender, isBounded(0, 2, args.length), args);
|
||||
command.run(player, commandSender, args.length > 0 && args.length < 2, args);
|
||||
} catch (IllegalArgumentException e)
|
||||
{
|
||||
|
||||
}
|
||||
} catch (PlayerNotFoundException e)
|
||||
{
|
||||
displayErrorString(commandSender, e.getLocalizedMessage());
|
||||
CommandBloodMagic.displayErrorString(commandSender, e.getLocalizedMessage());
|
||||
}
|
||||
} else
|
||||
{
|
||||
displayErrorString(commandSender, "commands.error.arg.missing");
|
||||
CommandBloodMagic.displayErrorString(commandSender, "commands.error.arg.missing");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,7 +64,7 @@ public class SubCommandNetwork extends SubCommandBase
|
|||
{
|
||||
if (displayHelp)
|
||||
{
|
||||
displayHelpString(sender, this.help);
|
||||
CommandBloodMagic.displayHelpString(sender, this.help);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -87,14 +74,14 @@ public class SubCommandNetwork extends SubCommandBase
|
|||
{
|
||||
int amount = Integer.parseInt(args[2]);
|
||||
NetworkHelper.syphonAndDamage(NetworkHelper.getSoulNetwork(player), player, amount);
|
||||
displaySuccessString(sender, "commands.network.syphon.success", amount, player.getDisplayName().getFormattedText());
|
||||
CommandBloodMagic.displaySuccessString(sender, "commands.network.syphon.success", amount, player.getDisplayName().getFormattedText());
|
||||
} else
|
||||
{
|
||||
displayErrorString(sender, "commands.error.arg.invalid");
|
||||
CommandBloodMagic.displayErrorString(sender, "commands.error.arg.invalid");
|
||||
}
|
||||
} else
|
||||
{
|
||||
displayErrorString(sender, "commands.error.arg.missing");
|
||||
CommandBloodMagic.displayErrorString(sender, "commands.error.arg.missing");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -105,7 +92,7 @@ public class SubCommandNetwork extends SubCommandBase
|
|||
{
|
||||
if (displayHelp)
|
||||
{
|
||||
displayHelpString(sender, this.help);
|
||||
CommandBloodMagic.displayHelpString(sender, this.help);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -117,14 +104,14 @@ public class SubCommandNetwork extends SubCommandBase
|
|||
{
|
||||
int amount = Integer.parseInt(args[2]);
|
||||
int maxOrb = NetworkHelper.getMaximumForTier(network.getOrbTier());
|
||||
displaySuccessString(sender, "commands.network.add.success", network.add(amount, maxOrb), player.getDisplayName().getFormattedText());
|
||||
CommandBloodMagic.displaySuccessString(sender, "commands.network.add.success", network.add(amount, maxOrb), player.getDisplayName().getFormattedText());
|
||||
} else
|
||||
{
|
||||
displayErrorString(sender, "commands.error.arg.invalid");
|
||||
CommandBloodMagic.displayErrorString(sender, "commands.error.arg.invalid");
|
||||
}
|
||||
} else
|
||||
{
|
||||
displayErrorString(sender, "commands.error.arg.missing");
|
||||
CommandBloodMagic.displayErrorString(sender, "commands.error.arg.missing");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -135,7 +122,7 @@ public class SubCommandNetwork extends SubCommandBase
|
|||
{
|
||||
if (displayHelp)
|
||||
{
|
||||
displayHelpString(sender, this.help);
|
||||
CommandBloodMagic.displayHelpString(sender, this.help);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -147,14 +134,14 @@ public class SubCommandNetwork extends SubCommandBase
|
|||
{
|
||||
int amount = Integer.parseInt(args[2]);
|
||||
network.setCurrentEssence(amount);
|
||||
displaySuccessString(sender, "commands.network.set.success", player.getDisplayName().getFormattedText(), amount);
|
||||
CommandBloodMagic.displaySuccessString(sender, "commands.network.set.success", player.getDisplayName().getFormattedText(), amount);
|
||||
} else
|
||||
{
|
||||
displayErrorString(sender, "commands.error.arg.invalid");
|
||||
CommandBloodMagic.displayErrorString(sender, "commands.error.arg.invalid");
|
||||
}
|
||||
} else
|
||||
{
|
||||
displayErrorString(sender, "commands.error.arg.missing");
|
||||
CommandBloodMagic.displayErrorString(sender, "commands.error.arg.missing");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -165,14 +152,14 @@ public class SubCommandNetwork extends SubCommandBase
|
|||
{
|
||||
if (displayHelp)
|
||||
{
|
||||
displayHelpString(sender, this.help);
|
||||
CommandBloodMagic.displayHelpString(sender, this.help);
|
||||
return;
|
||||
}
|
||||
|
||||
SoulNetwork network = NetworkHelper.getSoulNetwork(player);
|
||||
|
||||
if (args.length > 1)
|
||||
sender.addChatMessage(new TextComponentString(TextHelper.localizeEffect("tooltip.BloodMagic.sigil.divination.currentEssence", network.getCurrentEssence())));
|
||||
sender.sendMessage(new TextComponentString(TextHelper.localizeEffect("tooltip.BloodMagic.sigil.divination.currentEssence", network.getCurrentEssence())));
|
||||
|
||||
}
|
||||
},
|
||||
|
@ -183,7 +170,7 @@ public class SubCommandNetwork extends SubCommandBase
|
|||
{
|
||||
if (displayHelp)
|
||||
{
|
||||
displayHelpString(sender, this.help, Integer.MAX_VALUE);
|
||||
CommandBloodMagic.displayHelpString(sender, this.help, Integer.MAX_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -192,7 +179,7 @@ public class SubCommandNetwork extends SubCommandBase
|
|||
if (args.length > 1)
|
||||
{
|
||||
network.setCurrentEssence(Integer.MAX_VALUE);
|
||||
displaySuccessString(sender, "commands.network.fill.success", player.getDisplayName().getFormattedText());
|
||||
CommandBloodMagic.displaySuccessString(sender, "commands.network.fill.success", player.getDisplayName().getFormattedText());
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -203,7 +190,7 @@ public class SubCommandNetwork extends SubCommandBase
|
|||
{
|
||||
if (displayHelp)
|
||||
{
|
||||
displayHelpString(sender, this.help);
|
||||
CommandBloodMagic.displayHelpString(sender, this.help);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -213,7 +200,7 @@ public class SubCommandNetwork extends SubCommandBase
|
|||
{
|
||||
int maxOrb = NetworkHelper.getMaximumForTier(network.getOrbTier());
|
||||
network.setCurrentEssence(maxOrb);
|
||||
displaySuccessString(sender, "commands.network.cap.success", player.getDisplayName().getFormattedText());
|
||||
CommandBloodMagic.displaySuccessString(sender, "commands.network.cap.success", player.getDisplayName().getFormattedText());
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -3,44 +3,32 @@ package WayofTime.bloodmagic.command.sub;
|
|||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
import WayofTime.bloodmagic.command.SubCommandBase;
|
||||
import WayofTime.bloodmagic.command.CommandBloodMagic;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.command.PlayerNotFoundException;
|
||||
import net.minecraft.command.*;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class SubCommandOrb extends SubCommandBase
|
||||
public class SubCommandOrb extends CommandBase
|
||||
{
|
||||
|
||||
public SubCommandOrb(ICommand parent)
|
||||
{
|
||||
super(parent, "orb");
|
||||
@Override
|
||||
public String getName() {
|
||||
return "orb";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArgUsage(ICommandSender commandSender)
|
||||
public String getUsage(ICommandSender commandSender)
|
||||
{
|
||||
return TextHelper.localizeEffect("commands.orb.usage");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelpText()
|
||||
public void execute(MinecraftServer server, ICommandSender commandSender, String[] args) throws CommandException
|
||||
{
|
||||
return TextHelper.localizeEffect("commands.orb.help");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processSubCommand(MinecraftServer server, ICommandSender commandSender, String[] args)
|
||||
{
|
||||
super.processSubCommand(server, commandSender, args);
|
||||
|
||||
if (args.length > 0)
|
||||
{
|
||||
|
||||
|
@ -58,7 +46,7 @@ public class SubCommandOrb extends SubCommandBase
|
|||
String uuid = PlayerHelper.getUUIDFromPlayer(player).toString();
|
||||
SoulNetwork network = NetworkHelper.getSoulNetwork(uuid);
|
||||
|
||||
boolean displayHelp = isBounded(0, 2, args.length);
|
||||
boolean displayHelp = args.length > 0 && args.length < 2;
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -68,7 +56,7 @@ public class SubCommandOrb extends SubCommandBase
|
|||
{
|
||||
if (displayHelp)
|
||||
{
|
||||
displayHelpString(commandSender, ValidCommands.SET.help);
|
||||
CommandBloodMagic.displayHelpString(commandSender, ValidCommands.SET.help);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -78,14 +66,14 @@ public class SubCommandOrb extends SubCommandBase
|
|||
{
|
||||
int amount = Integer.parseInt(args[2]);
|
||||
network.setOrbTier(amount);
|
||||
displaySuccessString(commandSender, "commands.success");
|
||||
CommandBloodMagic.displaySuccessString(commandSender, "commands.success");
|
||||
} else
|
||||
{
|
||||
displayErrorString(commandSender, "commands.error.arg.invalid");
|
||||
CommandBloodMagic.displayErrorString(commandSender, "commands.error.arg.invalid");
|
||||
}
|
||||
} else
|
||||
{
|
||||
displayErrorString(commandSender, "commands.error.arg.missing");
|
||||
CommandBloodMagic.displayErrorString(commandSender, "commands.error.arg.missing");
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -94,23 +82,23 @@ public class SubCommandOrb extends SubCommandBase
|
|||
{
|
||||
if (displayHelp)
|
||||
{
|
||||
displayHelpString(commandSender, ValidCommands.GET.help);
|
||||
CommandBloodMagic.displayHelpString(commandSender, ValidCommands.GET.help);
|
||||
break;
|
||||
}
|
||||
|
||||
if (args.length > 1)
|
||||
commandSender.addChatMessage(new TextComponentString(TextHelper.localizeEffect("message.orb.currenttier", network.getOrbTier())));
|
||||
commandSender.sendMessage(new TextComponentString(TextHelper.localizeEffect("message.orb.currenttier", network.getOrbTier())));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (IllegalArgumentException e)
|
||||
{
|
||||
displayErrorString(commandSender, "commands.error.404");
|
||||
CommandBloodMagic.displayErrorString(commandSender, "commands.error.404");
|
||||
}
|
||||
} catch (PlayerNotFoundException e)
|
||||
{
|
||||
displayErrorString(commandSender, "commands.error.404");
|
||||
CommandBloodMagic.displayErrorString(commandSender, "commands.error.404");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ public class CompatibilityWaila implements ICompatibility
|
|||
@Override
|
||||
public String getModId()
|
||||
{
|
||||
return "Waila";
|
||||
return "waila";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,8 +17,8 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
|
||||
public class ItemSigilLava extends ItemSigilBase
|
||||
{
|
||||
|
@ -28,8 +28,9 @@ public class ItemSigilLava extends ItemSigilBase
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return ActionResult.newResult(EnumActionResult.FAIL, stack);
|
||||
|
||||
|
@ -49,35 +50,36 @@ public class ItemSigilLava extends ItemSigilBase
|
|||
|
||||
if (!world.isBlockModifiable(player, blockpos))
|
||||
{
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
if (!player.canPlayerEdit(blockpos.offset(rayTrace.sideHit), rayTrace.sideHit, stack))
|
||||
{
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
BlockPos blockpos1 = blockpos.offset(rayTrace.sideHit);
|
||||
|
||||
if (!player.canPlayerEdit(blockpos1, rayTrace.sideHit, stack))
|
||||
{
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
if (this.canPlaceLava(world, blockpos1) && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()) && this.tryPlaceLava(world, blockpos1))
|
||||
{
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos blockPos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (world.isRemote || player.isSneaking() || isUnusable(stack))
|
||||
{
|
||||
return EnumActionResult.FAIL;
|
||||
|
@ -88,14 +90,15 @@ public class ItemSigilLava extends ItemSigilBase
|
|||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
if (tile instanceof IFluidHandler)
|
||||
if (tile.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side))
|
||||
{
|
||||
IFluidHandler handler = tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side);
|
||||
FluidStack fluid = new FluidStack(FluidRegistry.LAVA, 1000);
|
||||
int amount = ((IFluidHandler) tile).fill(side, fluid, false);
|
||||
int amount = handler.fill(fluid, false);
|
||||
|
||||
if (amount > 0 && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()))
|
||||
{
|
||||
((IFluidHandler) tile).fill(side, fluid, true);
|
||||
handler.fill(fluid, true);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -649,7 +649,7 @@ public class Utils
|
|||
|
||||
for (int i = 0; i < handler.getSlots(); i++)
|
||||
{
|
||||
if (handler.getStackInSlot(i) == null)
|
||||
if (handler.getStackInSlot(i).isEmpty())
|
||||
{
|
||||
slots++;
|
||||
}
|
||||
|
@ -658,7 +658,7 @@ public class Utils
|
|||
{
|
||||
for (int i = 0; i < ((IInventory) tile).getSizeInventory(); i++)
|
||||
{
|
||||
if (((IInventory) tile).getStackInSlot(i) == null)
|
||||
if (((IInventory) tile).getStackInSlot(i).isEmpty())
|
||||
{
|
||||
slots++;
|
||||
}
|
||||
|
@ -677,9 +677,9 @@ public class Utils
|
|||
for (int slot = 0; slot < numberOfSlots; slot++)
|
||||
{
|
||||
copyStack = handler.insertItem(slot, copyStack, false);
|
||||
if (copyStack == null)
|
||||
if (copyStack.isEmpty())
|
||||
{
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue