It runs!
This commit is contained in:
parent
51e10eaad2
commit
ed27873fbe
42 changed files with 3606 additions and 3648 deletions
|
@ -2,6 +2,7 @@ package WayofTime.bloodmagic;
|
|||
|
||||
import java.io.File;
|
||||
|
||||
import WayofTime.bloodmagic.command.CommandBloodMagic;
|
||||
import WayofTime.bloodmagic.meteor.MeteorConfigHandler;
|
||||
import lombok.Getter;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
|
@ -104,6 +105,8 @@ public class BloodMagic
|
|||
proxy.preInit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent event)
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@ package WayofTime.bloodmagic.api.soul;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
/**
|
||||
* This class provides several helper methods in order to handle soul
|
||||
|
@ -23,7 +24,7 @@ public class PlayerDemonWillHandler
|
|||
*/
|
||||
public static double getTotalDemonWill(EnumDemonWillType type, EntityPlayer player)
|
||||
{
|
||||
ItemStack[] inventory = player.inventory.mainInventory;
|
||||
NonNullList<ItemStack> inventory = player.inventory.mainInventory;
|
||||
double souls = 0;
|
||||
|
||||
for (ItemStack stack : inventory)
|
||||
|
@ -72,7 +73,7 @@ public class PlayerDemonWillHandler
|
|||
*/
|
||||
public static boolean isDemonWillFull(EnumDemonWillType type, EntityPlayer player)
|
||||
{
|
||||
ItemStack[] inventory = player.inventory.mainInventory;
|
||||
NonNullList<ItemStack> inventory = player.inventory.mainInventory;
|
||||
|
||||
boolean hasGem = false;
|
||||
for (ItemStack stack : inventory)
|
||||
|
@ -102,25 +103,22 @@ public class PlayerDemonWillHandler
|
|||
{
|
||||
double consumed = 0;
|
||||
|
||||
ItemStack[] inventory = player.inventory.mainInventory;
|
||||
NonNullList<ItemStack> inventory = player.inventory.mainInventory;
|
||||
|
||||
for (int i = 0; i < inventory.length; i++)
|
||||
for (int i = 0; i < inventory.size(); i++)
|
||||
{
|
||||
if (consumed >= amount)
|
||||
return consumed;
|
||||
|
||||
ItemStack stack = inventory[i];
|
||||
if (stack != null)
|
||||
ItemStack stack = inventory.get(i);
|
||||
if (stack.getItem() instanceof IDemonWill && ((IDemonWill) stack.getItem()).getType(stack) == type)
|
||||
{
|
||||
if (stack.getItem() instanceof IDemonWill && ((IDemonWill) stack.getItem()).getType(stack) == type)
|
||||
{
|
||||
consumed += ((IDemonWill) stack.getItem()).drainWill(type, stack, amount - consumed);
|
||||
if (((IDemonWill) stack.getItem()).getWill(type, stack) <= 0)
|
||||
inventory[i] = null;
|
||||
} else if (stack.getItem() instanceof IDemonWillGem)
|
||||
{
|
||||
consumed += ((IDemonWillGem) stack.getItem()).drainWill(type, stack, amount - consumed, true);
|
||||
}
|
||||
consumed += ((IDemonWill) stack.getItem()).drainWill(type, stack, amount - consumed);
|
||||
if (((IDemonWill) stack.getItem()).getWill(type, stack) <= 0)
|
||||
inventory.set(i, ItemStack.EMPTY);
|
||||
} else if (stack.getItem() instanceof IDemonWillGem)
|
||||
{
|
||||
consumed += ((IDemonWillGem) stack.getItem()).drainWill(type, stack, amount - consumed, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,7 +141,7 @@ public class PlayerDemonWillHandler
|
|||
if (willStack == null)
|
||||
return null;
|
||||
|
||||
ItemStack[] inventory = player.inventory.mainInventory;
|
||||
NonNullList<ItemStack> inventory = player.inventory.mainInventory;
|
||||
|
||||
for (ItemStack stack : inventory)
|
||||
{
|
||||
|
@ -173,7 +171,7 @@ public class PlayerDemonWillHandler
|
|||
*/
|
||||
public static double addDemonWill(EnumDemonWillType type, EntityPlayer player, double amount)
|
||||
{
|
||||
ItemStack[] inventory = player.inventory.mainInventory;
|
||||
NonNullList<ItemStack> inventory = player.inventory.mainInventory;
|
||||
double remaining = amount;
|
||||
|
||||
for (ItemStack stack : inventory)
|
||||
|
@ -206,7 +204,7 @@ public class PlayerDemonWillHandler
|
|||
*/
|
||||
public static double addDemonWill(EnumDemonWillType type, EntityPlayer player, double amount, ItemStack ignored)
|
||||
{
|
||||
ItemStack[] inventory = player.inventory.mainInventory;
|
||||
NonNullList<ItemStack> inventory = player.inventory.mainInventory;
|
||||
double remaining = amount;
|
||||
|
||||
for (ItemStack stack : inventory)
|
||||
|
|
|
@ -26,7 +26,7 @@ public class PlayerHelper
|
|||
|
||||
public static String getUsernameFromPlayer(EntityPlayer player)
|
||||
{
|
||||
return player.worldObj.isRemote ? "" : UsernameCache.getLastKnownUsername(getUUIDFromPlayer(player));
|
||||
return player.getEntityWorld().isRemote ? "" : UsernameCache.getLastKnownUsername(getUUIDFromPlayer(player));
|
||||
}
|
||||
|
||||
public static EntityPlayer getPlayerFromUsername(String username)
|
||||
|
|
|
@ -3,6 +3,7 @@ package WayofTime.bloodmagic.block;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import WayofTime.bloodmagic.block.base.BlockInteger;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
@ -23,7 +24,9 @@ import WayofTime.bloodmagic.ritual.portal.LocationsHandler;
|
|||
import WayofTime.bloodmagic.ritual.portal.Teleports;
|
||||
import WayofTime.bloodmagic.tile.TileDimensionalPortal;
|
||||
|
||||
public class BlockDimensionalPortal extends BlockIntegerContainer
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockDimensionalPortal extends BlockInteger
|
||||
{
|
||||
protected static final AxisAlignedBB AABB_0 = new AxisAlignedBB(0.0D, 0.0D, 0.375D, 1.0D, 1.0D, 0.625D);
|
||||
protected static final AxisAlignedBB AABB_1 = new AxisAlignedBB(0.375D, 0.0D, 0.0D, 0.625D, 1.0D, 1.0D);
|
||||
|
@ -38,12 +41,6 @@ public class BlockDimensionalPortal extends BlockIntegerContainer
|
|||
setLightOpacity(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileDimensionalPortal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
|
@ -57,13 +54,13 @@ public class BlockDimensionalPortal extends BlockIntegerContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, World world, BlockPos pos)
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -170,6 +167,17 @@ public class BlockDimensionalPortal extends BlockIntegerContainer
|
|||
this.spawnParticles(world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileDimensionalPortal();
|
||||
}
|
||||
|
||||
private void spawnParticles(World world, int x, int y, int z)
|
||||
{
|
||||
Random random = world.rand;
|
||||
|
|
|
@ -12,6 +12,8 @@ import WayofTime.bloodmagic.BloodMagic;
|
|||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.tile.routing.TileInputRoutingNode;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockInputRoutingNode extends BlockRoutingNode
|
||||
{
|
||||
public BlockInputRoutingNode()
|
||||
|
@ -21,12 +23,6 @@ public class BlockInputRoutingNode extends BlockRoutingNode
|
|||
setUnlocalizedName(Constants.Mod.MODID + ".inputRouting");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileInputRoutingNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
//TODO: Combine BlockInputRoutingNode and BlockInputRoutingNode so they have the same superclass
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
|
@ -50,4 +46,15 @@ public class BlockInputRoutingNode extends BlockRoutingNode
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileInputRoutingNode();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ import WayofTime.bloodmagic.api.Constants;
|
|||
import WayofTime.bloodmagic.tile.routing.TileItemRoutingNode;
|
||||
import WayofTime.bloodmagic.tile.routing.TileRoutingNode;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockItemRoutingNode extends BlockRoutingNode
|
||||
{
|
||||
public BlockItemRoutingNode()
|
||||
|
@ -17,12 +19,6 @@ public class BlockItemRoutingNode extends BlockRoutingNode
|
|||
setUnlocalizedName(Constants.Mod.MODID + ".itemRouting");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileItemRoutingNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
|
@ -33,4 +29,15 @@ public class BlockItemRoutingNode extends BlockRoutingNode
|
|||
}
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileItemRoutingNode();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.tile.routing.TileMasterRoutingNode;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockMasterRoutingNode extends BlockRoutingNode
|
||||
{
|
||||
public BlockMasterRoutingNode()
|
||||
|
@ -20,12 +23,17 @@ public class BlockMasterRoutingNode extends BlockRoutingNode
|
|||
}
|
||||
|
||||
@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 TileMasterRoutingNode();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// @Override
|
||||
// public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
// {
|
||||
// if (world.getTileEntity(pos) instanceof TileMasterRoutingNode)
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import WayofTime.bloodmagic.block.base.BlockEnum;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -39,7 +40,7 @@ import WayofTime.bloodmagic.util.ChatUtil;
|
|||
import amerifrance.guideapi.api.IGuideLinked;
|
||||
|
||||
@Optional.Interface(modid = "guideapi", iface = "amerifrance.guideapi.api.IGuideLinked")
|
||||
public class BlockRitualController extends BlockEnumContainer<EnumRitualController> implements IVariantProvider, IGuideLinked
|
||||
public class BlockRitualController extends BlockEnum<EnumRitualController> implements IVariantProvider, IGuideLinked
|
||||
{
|
||||
public BlockRitualController()
|
||||
{
|
||||
|
@ -54,13 +55,14 @@ public class BlockRitualController extends BlockEnumContainer<EnumRitualControll
|
|||
}
|
||||
|
||||
@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);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if (getMetaFromState(state) == 0 && tile instanceof TileMasterRitualStone)
|
||||
{
|
||||
if (heldItem != null && heldItem.getItem() == ModItems.ACTIVATION_CRYSTAL)
|
||||
if (heldItem.getItem() == ModItems.ACTIVATION_CRYSTAL)
|
||||
{
|
||||
String key = RitualHelper.getValidRitual(world, pos);
|
||||
EnumFacing direction = RitualHelper.getDirectionOfRitual(world, pos, key);
|
||||
|
|
|
@ -52,7 +52,7 @@ public class GuiAlchemyTable extends GuiContainer
|
|||
{
|
||||
Slot slot = this.inventorySlots.getSlot(slotId);
|
||||
|
||||
this.drawTexturedModalRect(i + slot.xDisplayPosition, j + slot.yDisplayPosition, 195, 1, 16, 16);
|
||||
this.drawTexturedModalRect(i + slot.xPos, j + slot.yPos, 195, 1, 16, 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class HUDElementDemonWillAura extends HUDElement
|
|||
@Override
|
||||
public void render(Minecraft minecraft, ScaledResolution resolution, float partialTicks)
|
||||
{
|
||||
EntityPlayer player = minecraft.thePlayer;
|
||||
EntityPlayer player = minecraft.player;
|
||||
|
||||
if (!Utils.canPlayerSeeDemonWill(player))
|
||||
{
|
||||
|
|
|
@ -26,16 +26,11 @@ public class HUDElementHolding extends HUDElement
|
|||
@Override
|
||||
public void render(Minecraft minecraft, ScaledResolution resolution, float partialTicks)
|
||||
{
|
||||
ItemStack sigilHolding = minecraft.thePlayer.getHeldItemMainhand();
|
||||
// TODO - Clean this mess
|
||||
ItemStack sigilHolding = minecraft.player.getHeldItemMainhand();
|
||||
// Check mainhand for Sigil of Holding
|
||||
if (sigilHolding == null)
|
||||
return;
|
||||
if (!(sigilHolding.getItem() == ModItems.SIGIL_HOLDING))
|
||||
sigilHolding = minecraft.thePlayer.getHeldItemOffhand();
|
||||
sigilHolding = minecraft.player.getHeldItemOffhand();
|
||||
// Check offhand for Sigil of Holding
|
||||
if (sigilHolding == null)
|
||||
return;
|
||||
if (!(sigilHolding.getItem() == ModItems.SIGIL_HOLDING))
|
||||
return;
|
||||
|
||||
|
@ -54,7 +49,7 @@ public class HUDElementHolding extends HUDElement
|
|||
{
|
||||
for (ItemStack sigil : holdingInv)
|
||||
{
|
||||
renderHotbarItem(resolution.getScaledWidth() / 2 + 103 + xOffset + getXOffset(), resolution.getScaledHeight() - 18 + getYOffset(), partialTicks, minecraft.thePlayer, sigil);
|
||||
renderHotbarItem(resolution.getScaledWidth() / 2 + 103 + xOffset + getXOffset(), resolution.getScaledHeight() - 18 + getYOffset(), partialTicks, minecraft.player, sigil);
|
||||
xOffset += 20;
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +67,7 @@ public class HUDElementHolding extends HUDElement
|
|||
{
|
||||
if (stack != null)
|
||||
{
|
||||
float animation = (float) stack.animationsToGo - partialTicks;
|
||||
float animation = (float) stack.getAnimationsToGo() - partialTicks;
|
||||
|
||||
if (animation > 0.0F)
|
||||
{
|
||||
|
|
|
@ -27,8 +27,8 @@ public enum KeyBindings
|
|||
@Override
|
||||
public void handleKeybind()
|
||||
{
|
||||
ItemStack itemStack = ClientHandler.minecraft.thePlayer.getHeldItemMainhand();
|
||||
if (itemStack != null && itemStack.getItem() instanceof IKeybindable)
|
||||
ItemStack itemStack = ClientHandler.minecraft.player.getHeldItemMainhand();
|
||||
if (itemStack.getItem() instanceof IKeybindable)
|
||||
BloodMagicPacketHandler.INSTANCE.sendToServer(new KeyProcessor(this, false));
|
||||
}
|
||||
},
|
||||
|
@ -38,8 +38,8 @@ public enum KeyBindings
|
|||
@Override
|
||||
public void handleKeybind()
|
||||
{
|
||||
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
|
||||
if (player.getHeldItemMainhand() != null && player.getHeldItemMainhand().getItem() instanceof ItemSigilHolding)
|
||||
EntityPlayerSP player = Minecraft.getMinecraft().player;
|
||||
if (player.getHeldItemMainhand().getItem() instanceof ItemSigilHolding)
|
||||
ClientHandler.cycleSigil(player.getHeldItemMainhand(), player, -1);
|
||||
}
|
||||
},
|
||||
|
@ -49,8 +49,8 @@ public enum KeyBindings
|
|||
@Override
|
||||
public void handleKeybind()
|
||||
{
|
||||
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
|
||||
if (player.getHeldItemMainhand() != null && player.getHeldItemMainhand().getItem() instanceof ItemSigilHolding)
|
||||
EntityPlayerSP player = Minecraft.getMinecraft().player;
|
||||
if (player.getHeldItemMainhand().getItem() instanceof ItemSigilHolding)
|
||||
ClientHandler.cycleSigil(player.getHeldItemMainhand(), player, 1);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -102,7 +102,7 @@ public class RenderAltar extends TileEntitySpecialRenderer<TileAltar>
|
|||
{
|
||||
GlStateManager.translate(0.5, 1, 0.5);
|
||||
EntityItem entityitem = new EntityItem(world, 0.0D, 0.0D, 0.0D, stack);
|
||||
entityitem.getEntityItem().stackSize = 1;
|
||||
entityitem.getEntityItem().setCount(1);
|
||||
entityitem.hoverStart = 0.0F;
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.disableLighting();
|
||||
|
@ -124,8 +124,8 @@ public class RenderAltar extends TileEntitySpecialRenderer<TileAltar>
|
|||
|
||||
private void renderHologram(TileAltar altar, EnumAltarTier tier, float partialTicks)
|
||||
{
|
||||
EntityPlayerSP player = mc.thePlayer;
|
||||
World world = player.worldObj;
|
||||
EntityPlayerSP player = mc.player;
|
||||
World world = player.world;
|
||||
|
||||
if (tier == EnumAltarTier.ONE)
|
||||
return;
|
||||
|
|
|
@ -37,7 +37,7 @@ public class RenderDemonCrucible extends TileEntitySpecialRenderer<TileDemonCruc
|
|||
{
|
||||
GlStateManager.translate(0.5, 1.5, 0.5);
|
||||
EntityItem entityitem = new EntityItem(world, 0.0D, 0.0D, 0.0D, stack);
|
||||
entityitem.getEntityItem().stackSize = 1;
|
||||
entityitem.getEntityItem().setCount(1);
|
||||
entityitem.hoverStart = 0.0F;
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.disableLighting();
|
||||
|
|
|
@ -28,7 +28,7 @@ public class RenderItemRoutingNode extends TileEntitySpecialRenderer<TileRouting
|
|||
@Override
|
||||
public void renderTileEntityAt(TileRoutingNode tileNode, double x, double y, double z, float partialTicks, int destroyStage)
|
||||
{
|
||||
if ((mc.thePlayer.getHeldItemMainhand() != null && mc.thePlayer.getHeldItemMainhand().getItem() instanceof INodeRenderer) || ConfigHandler.alwaysRenderRoutingLines)
|
||||
if (mc.player.getHeldItemMainhand().getItem() instanceof INodeRenderer || ConfigHandler.alwaysRenderRoutingLines)
|
||||
{
|
||||
List<BlockPos> connectionList = tileNode.getConnected();
|
||||
for (BlockPos wantedPos : connectionList)
|
||||
|
@ -41,7 +41,7 @@ public class RenderItemRoutingNode extends TileEntitySpecialRenderer<TileRouting
|
|||
int yd = offsetPos.getY();
|
||||
int zd = offsetPos.getZ();
|
||||
double distance = Math.sqrt(xd * xd + yd * yd + zd * zd);
|
||||
double subLength = MathHelper.sqrt_double(xd * xd + zd * zd);
|
||||
double subLength = MathHelper.sqrt(xd * xd + zd * zd);
|
||||
float rotYaw = -((float) (Math.atan2(zd, xd) * 180.0D / Math.PI));
|
||||
float rotPitch = ((float) (Math.atan2(yd, subLength) * 180.0D / Math.PI));
|
||||
|
||||
|
@ -55,7 +55,7 @@ public class RenderItemRoutingNode extends TileEntitySpecialRenderer<TileRouting
|
|||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableCull();
|
||||
float f2 = 0;
|
||||
float f3 = -f2 * 0.2F - (float) MathHelper.floor_float(-f2 * 0.1F);
|
||||
float f3 = -f2 * 0.2F - (float) MathHelper.floor(-f2 * 0.1F);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ public class RenderCorruptedZombie extends RenderBiped<EntityCorruptedZombie>
|
|||
|
||||
public RenderCorruptedZombie(RenderManager renderManagerIn)
|
||||
{
|
||||
super(renderManagerIn, new ModelZombie(), 0.5F, 1.0F);
|
||||
LayerRenderer<?> layerrenderer = (LayerRenderer) this.layerRenderers.get(0);
|
||||
super(renderManagerIn, new ModelZombie(), 0.5F);
|
||||
LayerRenderer<?> layerrenderer = this.layerRenderers.get(0);
|
||||
this.zombieVillagerModel = new ModelZombieVillager();
|
||||
this.addLayer(new LayerHeldItem(this));
|
||||
LayerBipedArmor layerbipedarmor = new LayerBipedArmor(this)
|
||||
|
@ -38,11 +38,11 @@ public class RenderCorruptedZombie extends RenderBiped<EntityCorruptedZombie>
|
|||
|
||||
if (layerrenderer instanceof LayerCustomHead)
|
||||
{
|
||||
this.removeLayer(layerrenderer);
|
||||
layerRenderers.remove(layerrenderer);
|
||||
this.addLayer(new LayerCustomHead(this.zombieVillagerModel.bipedHead));
|
||||
}
|
||||
|
||||
this.removeLayer(layerbipedarmor);
|
||||
this.layerRenderers.remove(layerbipedarmor);
|
||||
this.addLayer(new LayerWill<EntityCorruptedZombie>(this, new ModelZombie(1.2f, false)));
|
||||
}
|
||||
|
||||
|
@ -71,9 +71,4 @@ public class RenderCorruptedZombie extends RenderBiped<EntityCorruptedZombie>
|
|||
{
|
||||
return ZOMBIE_TEXTURES;
|
||||
}
|
||||
|
||||
protected void rotateCorpse(EntityCorruptedZombie entityLiving, float p_77043_2_, float p_77043_3_, float partialTicks)
|
||||
{
|
||||
super.rotateCorpse(entityLiving, p_77043_2_, p_77043_3_, partialTicks);
|
||||
}
|
||||
}
|
|
@ -26,8 +26,9 @@ public class ItemSigilAir extends ItemSigilBase implements ISentientSwordEffectP
|
|||
}
|
||||
|
||||
@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);
|
||||
|
||||
|
@ -59,7 +60,7 @@ public class ItemSigilAir extends ItemSigilBase implements ISentientSwordEffectP
|
|||
player.fallDistance = 0;
|
||||
}
|
||||
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,15 +31,16 @@ public class ItemSigilBloodLight 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);
|
||||
|
||||
RayTraceResult mop = this.rayTrace(world, player, false);
|
||||
|
||||
if (getCooldownRemainder(stack) > 0)
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
|
||||
if (mop != null && mop.typeOfHit == RayTraceResult.Type.BLOCK)
|
||||
{
|
||||
|
@ -52,19 +53,19 @@ public class ItemSigilBloodLight extends ItemSigilBase
|
|||
NetworkHelper.syphonAndDamage(NetworkHelper.getSoulNetwork(player), player, getLpUsed());
|
||||
resetCooldown(stack);
|
||||
player.swingArm(hand);
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.spawnEntityInWorld(new EntityBloodLight(world, player));
|
||||
world.spawnEntity(new EntityBloodLight(world, player));
|
||||
NetworkHelper.syphonAndDamage(NetworkHelper.getSoulNetwork(player), player, getLpUsed());
|
||||
}
|
||||
resetCooldown(stack);
|
||||
}
|
||||
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package WayofTime.bloodmagic.item.sigil;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.compress.CompressionRegistry;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
|
@ -24,12 +23,12 @@ public class ItemSigilCompression extends ItemSigilToggleableBase
|
|||
if (PlayerHelper.isFakePlayer(player))
|
||||
return;
|
||||
|
||||
ItemStack compressedStack = CompressionRegistry.compressInventory(player.inventory.mainInventory, world);
|
||||
ItemStack compressedStack = CompressionRegistry.compressInventory(player.inventory.mainInventory.toArray(new ItemStack[player.inventory.mainInventory.size()]), world);
|
||||
|
||||
if (compressedStack != null)
|
||||
{
|
||||
EntityItem entityItem = new EntityItem(world, player.posX, player.posY, player.posZ, compressedStack);
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
world.spawnEntity(entityItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public class ItemSigilDivination extends ItemSigilBase implements IAltarReader
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
// if (world instanceof WorldServer)
|
||||
// {
|
||||
|
@ -46,13 +46,14 @@ public class ItemSigilDivination extends ItemSigilBase implements IAltarReader
|
|||
// fred.setPosition(player.posX, player.posY, player.posZ);
|
||||
// world.spawnEntityInWorld(fred);
|
||||
// }
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return ActionResult.newResult(EnumActionResult.FAIL, stack);
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
super.onItemRightClick(stack, world, player, hand);
|
||||
super.onItemRightClick(world, player, hand);
|
||||
|
||||
RayTraceResult position = rayTrace(world, player, false);
|
||||
|
||||
|
@ -99,6 +100,6 @@ public class ItemSigilDivination extends ItemSigilBase implements IAltarReader
|
|||
}
|
||||
}
|
||||
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public class ItemSigilHolding extends ItemSigilBase implements IKeybindable, IAl
|
|||
if (stack == player.getHeldItemMainhand() && stack.getItem() instanceof ItemSigilHolding && key.equals(KeyBindings.OPEN_HOLDING))
|
||||
{
|
||||
Utils.setUUID(stack);
|
||||
player.openGui(BloodMagic.instance, Constants.Gui.SIGIL_HOLDING_GUI, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
player.openGui(BloodMagic.instance, Constants.Gui.SIGIL_HOLDING_GUI, player.getEntityWorld(), (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,9 +98,10 @@ public class ItemSigilHolding extends ItemSigilBase implements IKeybindable, IAl
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (PlayerHelper.isFakePlayer(playerIn))
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return EnumActionResult.FAIL;
|
||||
|
||||
int currentSlot = getCurrentItemOrdinal(stack);
|
||||
|
@ -114,15 +115,16 @@ public class ItemSigilHolding extends ItemSigilBase implements IKeybindable, IAl
|
|||
if (itemUsing == null || Strings.isNullOrEmpty(((IBindable) itemUsing.getItem()).getOwnerUUID(itemUsing)))
|
||||
return EnumActionResult.PASS;
|
||||
|
||||
EnumActionResult result = itemUsing.getItem().onItemUse(itemUsing, playerIn, worldIn, pos, hand, facing, hitX, hitY, hitZ);
|
||||
EnumActionResult result = itemUsing.getItem().onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
|
||||
saveInventory(stack, inv);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@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);
|
||||
|
||||
|
@ -137,7 +139,7 @@ public class ItemSigilHolding extends ItemSigilBase implements IKeybindable, IAl
|
|||
if (itemUsing == null || Strings.isNullOrEmpty(((IBindable) itemUsing.getItem()).getOwnerUUID(itemUsing)))
|
||||
return ActionResult.newResult(EnumActionResult.PASS, stack);
|
||||
|
||||
itemUsing.getItem().onItemRightClick(itemUsing, world, player, hand);
|
||||
itemUsing.getItem().onItemRightClick(world, player, hand);
|
||||
|
||||
saveInventory(stack, inv);
|
||||
|
||||
|
@ -251,7 +253,7 @@ public class ItemSigilHolding extends ItemSigilBase implements IKeybindable, IAl
|
|||
{
|
||||
initModeTag(itemStack);
|
||||
int currentSigil = itemStack.getTagCompound().getInteger(Constants.NBT.CURRENT_SIGIL);
|
||||
currentSigil = MathHelper.clamp_int(currentSigil, 0, inventorySize - 1);
|
||||
currentSigil = MathHelper.clamp(currentSigil, 0, inventorySize - 1);
|
||||
return currentSigil;
|
||||
}
|
||||
|
||||
|
@ -284,7 +286,7 @@ public class ItemSigilHolding extends ItemSigilBase implements IKeybindable, IAl
|
|||
|
||||
if (j >= 0 && j < inv.length)
|
||||
{
|
||||
inv[j] = ItemStack.loadItemStackFromNBT(data);
|
||||
inv[j] = new ItemStack(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@ public class ItemSigilMagnetism extends ItemSigilToggleableBase
|
|||
float posX = Math.round(player.posX);
|
||||
float posY = (float) (player.posY - player.getEyeHeight());
|
||||
float posZ = Math.round(player.posZ);
|
||||
List<EntityItem> entities = player.worldObj.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(range, verticalRange, range));
|
||||
List<EntityXPOrb> xpOrbs = player.worldObj.getEntitiesWithinAABB(EntityXPOrb.class, new AxisAlignedBB(posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(range, verticalRange, range));
|
||||
List<EntityItem> entities = player.getEntityWorld().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(range, verticalRange, range));
|
||||
List<EntityXPOrb> xpOrbs = player.getEntityWorld().getEntitiesWithinAABB(EntityXPOrb.class, new AxisAlignedBB(posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(range, verticalRange, range));
|
||||
|
||||
for (EntityItem entity : entities)
|
||||
{
|
||||
|
|
|
@ -31,14 +31,15 @@ public class ItemSigilSeer extends ItemSigilBase implements IAltarReader
|
|||
}
|
||||
|
||||
@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);
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
super.onItemRightClick(stack, world, player, hand);
|
||||
super.onItemRightClick(world, player, hand);
|
||||
RayTraceResult rayTrace = rayTrace(world, player, false);
|
||||
|
||||
if (rayTrace == null)
|
||||
|
@ -67,10 +68,10 @@ public class ItemSigilSeer extends ItemSigilBase implements IAltarReader
|
|||
altar.checkTier();
|
||||
if (tile instanceof IInventory)
|
||||
{
|
||||
if (((IInventory) tile).getStackInSlot(0) != null)
|
||||
if (!((IInventory) tile).getStackInSlot(0).isEmpty())
|
||||
{
|
||||
int progress = altar.getProgress();
|
||||
int totalLiquidRequired = altar.getLiquidRequired() * ((IInventory) tile).getStackInSlot(0).stackSize;
|
||||
int totalLiquidRequired = altar.getLiquidRequired() * ((IInventory) tile).getStackInSlot(0).getCount();
|
||||
int consumptionRate = (int) (altar.getConsumptionRate() * (altar.getConsumptionMultiplier() + 1));
|
||||
ChatUtil.sendNoSpam(player, new TextComponentTranslation(tooltipBase + "currentAltarProgress", progress, totalLiquidRequired), new TextComponentTranslation(tooltipBase + "currentAltarConsumptionRate", consumptionRate), new TextComponentTranslation(tooltipBase + "currentAltarTier", tier), new TextComponentTranslation(tooltipBase + "currentEssence", currentEssence), new TextComponentTranslation(tooltipBase + "currentAltarCapacity", capacity), new TextComponentTranslation(tooltipBase + "currentCharge", charge));
|
||||
} else
|
||||
|
@ -93,6 +94,6 @@ public class ItemSigilSeer extends ItemSigilBase implements IAltarReader
|
|||
}
|
||||
}
|
||||
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,10 +48,7 @@ public class ItemSigilSuppression extends ItemSigilToggleableBase
|
|||
BlockPos blockPos = new BlockPos(x + i, y + j, z + k);
|
||||
IBlockState state = world.getBlockState(blockPos);
|
||||
|
||||
// TODO - Change back when BlockFluidBase overrides getStateFromMeta()
|
||||
// Temporary fix to avoid liquid duplication
|
||||
if (state.getBlock() instanceof BlockFluidBase) {/*No-op*/}
|
||||
else if (Utils.isBlockLiquid(state) && world.getTileEntity(blockPos) == null)
|
||||
if (Utils.isBlockLiquid(state) && world.getTileEntity(blockPos) == null)
|
||||
TileSpectralBlock.createSpectralBlock(world, blockPos, refresh);
|
||||
else
|
||||
{
|
||||
|
|
|
@ -47,8 +47,9 @@ public class ItemSigilTeleposition 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);
|
||||
|
||||
|
@ -63,12 +64,13 @@ public class ItemSigilTeleposition extends ItemSigilBase
|
|||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(blockPos, player, getOwnerUUID(stack), world, getValue(stack.getTagCompound(), Constants.NBT.DIMENSION_ID), true));
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return EnumActionResult.FAIL;
|
||||
|
||||
|
|
|
@ -66,8 +66,9 @@ public class ItemSigilTransposition extends ItemSigilBase
|
|||
}
|
||||
|
||||
@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 (PlayerHelper.isFakePlayer(player))
|
||||
return EnumActionResult.FAIL;
|
||||
|
||||
|
@ -123,7 +124,7 @@ public class ItemSigilTransposition extends ItemSigilBase
|
|||
blockPos = blockPos.offset(side);
|
||||
}
|
||||
|
||||
if (stack.stackSize != 0 && player.canPlayerEdit(blockPos, side, stack) && world.canBlockBePlaced(blockToPlace.getBlock(), blockPos, false, side, player, stack))
|
||||
if (!stack.isEmpty() && player.canPlayerEdit(blockPos, side, stack) && world.mayPlace(blockToPlace.getBlock(), blockPos, false, side, player))
|
||||
{
|
||||
if (world.setBlockState(blockPos, blockToPlace.getState(), 3))
|
||||
{
|
||||
|
|
|
@ -15,8 +15,8 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
|
||||
public class ItemSigilVoid extends ItemSigilBase
|
||||
{
|
||||
|
@ -26,8 +26,9 @@ public class ItemSigilVoid 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);
|
||||
|
||||
|
@ -47,40 +48,41 @@ public class ItemSigilVoid 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);
|
||||
}
|
||||
|
||||
if (!player.canPlayerEdit(blockpos, rayTrace.sideHit, stack))
|
||||
{
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
if (world.getBlockState(blockpos).getBlock().getMaterial(world.getBlockState(blockpos)).isLiquid() && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()))
|
||||
{
|
||||
world.setBlockToAir(blockpos);
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
this.setUnusable(stack, !NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()));
|
||||
}
|
||||
|
||||
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 (PlayerHelper.isFakePlayer(player))
|
||||
return EnumActionResult.FAIL;
|
||||
|
||||
|
@ -95,13 +97,14 @@ public class ItemSigilVoid extends ItemSigilBase
|
|||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
if (tile instanceof IFluidHandler)
|
||||
if (tile.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side))
|
||||
{
|
||||
FluidStack amount = ((IFluidHandler) tile).drain(side, 1000, false);
|
||||
IFluidHandler handler = tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side);
|
||||
FluidStack amount = handler.drain(1000, false);
|
||||
|
||||
if (amount != null && amount.amount > 0 && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()))
|
||||
{
|
||||
((IFluidHandler) tile).drain(side, 1000, true);
|
||||
handler.drain(1000, true);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ import net.minecraft.util.math.RayTraceResult;
|
|||
import net.minecraft.world.World;
|
||||
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 ItemSigilWater extends ItemSigilBase
|
||||
{
|
||||
|
@ -31,8 +31,9 @@ public class ItemSigilWater 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);
|
||||
|
||||
|
@ -51,28 +52,29 @@ public class ItemSigilWater extends ItemSigilBase
|
|||
BlockPos blockpos = rayTrace.getBlockPos();
|
||||
|
||||
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.canPlaceWater(world, blockpos1) && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()) && this.tryPlaceWater(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;
|
||||
|
||||
|
@ -80,14 +82,15 @@ public class ItemSigilWater extends ItemSigilBase
|
|||
return EnumActionResult.FAIL;
|
||||
|
||||
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.WATER, 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
package WayofTime.bloodmagic.item.sigil;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
import WayofTime.bloodmagic.registry.ModPotions;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemSigilWhirlwind extends ItemSigilToggleableBase
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package WayofTime.bloodmagic.registry;
|
||||
|
||||
import WayofTime.bloodmagic.compat.ICompatibility;
|
||||
import WayofTime.bloodmagic.compat.jei.CompatibilityJustEnoughItems;
|
||||
import WayofTime.bloodmagic.compat.waila.CompatibilityWaila;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
|
||||
|
@ -13,7 +12,6 @@ public class ModCompatibility
|
|||
|
||||
public static void registerModCompat()
|
||||
{
|
||||
compatibilities.add(new CompatibilityJustEnoughItems());
|
||||
compatibilities.add(new CompatibilityWaila());
|
||||
// compatibilities.add(new CompatibilityThaumcraft());
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ public class RitualLivingArmourDowngrade extends Ritual
|
|||
recipe.consumeInventory(inv);
|
||||
|
||||
EntityLightningBolt lightning = new EntityLightningBolt(world, chestPos.getX(), chestPos.getY(), chestPos.getZ(), true);
|
||||
world.spawnEntityInWorld(lightning);
|
||||
world.spawnEntity(lightning);
|
||||
|
||||
masterRitualStone.setActive(false);
|
||||
}
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
package WayofTime.bloodmagic.util.handler.event;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.annot.Handler;
|
||||
import WayofTime.bloodmagic.api.saving.BMWorldSavedData;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
import com.google.common.base.Stopwatch;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
// Migrates from the old data storage system to the cleaner new one
|
||||
@Handler
|
||||
public class MigrateNetworkDataHandler
|
||||
{
|
||||
|
||||
@SubscribeEvent
|
||||
public void playerJoin(EntityJoinWorldEvent event)
|
||||
{
|
||||
if (!event.getWorld().isRemote && event.getEntity() instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) event.getEntity();
|
||||
UUID playerId = PlayerHelper.getUUIDFromPlayer(player);
|
||||
Stopwatch stopwatch = Stopwatch.createStarted();
|
||||
|
||||
if (event.getWorld().getMapStorage() == null)
|
||||
return;
|
||||
|
||||
BMWorldSavedData saveData = (BMWorldSavedData) event.getWorld().getMapStorage().getOrLoadData(BMWorldSavedData.class, BMWorldSavedData.ID);
|
||||
WayofTime.bloodmagic.api.network.SoulNetwork oldData = (WayofTime.bloodmagic.api.network.SoulNetwork) event.getWorld().getMapStorage().getOrLoadData(WayofTime.bloodmagic.api.network.SoulNetwork.class, playerId.toString());
|
||||
|
||||
if (saveData == null)
|
||||
{
|
||||
saveData = new BMWorldSavedData();
|
||||
event.getWorld().getMapStorage().setData(BMWorldSavedData.ID, saveData);
|
||||
}
|
||||
|
||||
if (oldData == null)
|
||||
return;
|
||||
|
||||
SoulNetwork network = saveData.getNetwork(playerId);
|
||||
if (oldData.getOrbTier() > network.getOrbTier())
|
||||
network.setOrbTier(oldData.getOrbTier());
|
||||
if (oldData.getCurrentEssence() > network.getCurrentEssence())
|
||||
network.setCurrentEssence(oldData.getCurrentEssence());
|
||||
|
||||
File oldDataFile = event.getWorld().getSaveHandler().getMapFileFromName(playerId.toString());
|
||||
try
|
||||
{
|
||||
FileUtils.forceDelete(oldDataFile);
|
||||
} catch (IOException e)
|
||||
{
|
||||
BloodMagic.instance.getLogger().error("Error deleting data file {}.", oldDataFile);
|
||||
BloodMagic.instance.getLogger().error(e.getLocalizedMessage());
|
||||
}
|
||||
stopwatch.stop();
|
||||
BloodMagic.instance.getLogger().info("Migration completed for {} ({}) in {}.", player.getDisplayNameString(), playerId, stopwatch);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue