mirror of
https://github.com/GTNewHorizons/Avaritia.git
synced 2026-11-20 12:19:39 +00:00
Thaumic Smaaaaash
This commit is contained in:
1 parent
fc734ba36a
commit
802e18e489
10 files changed
+233
-13
No files matched your search
@@ -67,7 +67,7 @@ public class LudicrousEvents {
|
||||
&& drop.getItem() != Item.getItemFromBlock(Blocks.netherrack)
|
||||
&& !(FurnaceRecipes.smelting().getSmeltingResult(drop).getItem() instanceof ItemBlock)){
|
||||
ItemStack smelt = FurnaceRecipes.smelting().getSmeltingResult(drop).copy();
|
||||
smelt.stackSize = Math.min(drop.stackSize * 8, drop.getMaxStackSize());
|
||||
smelt.stackSize = Math.min(drop.stackSize * 10, drop.getMaxStackSize());
|
||||
adds.add(smelt);
|
||||
removals.add(drop);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package fox.spiteful.avaritia.compat.thaumcraft;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.wands.IWandRodOnUpdate;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
|
||||
public class CheatyWandUpdate implements IWandRodOnUpdate {
|
||||
Aspect primals[] = Aspect.getPrimalAspects().toArray(new Aspect[0]);
|
||||
public void onUpdate(ItemStack itemstack, EntityPlayer player) {
|
||||
for (int x = 0; x < primals.length; x++) {
|
||||
if (((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x]) < ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack)) {
|
||||
((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack) - ((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x]), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,17 +2,25 @@ package fox.spiteful.avaritia.compat.thaumcraft;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import fox.spiteful.avaritia.blocks.LudicrousBlocks;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeCraftingManager;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import thaumcraft.api.ThaumcraftApi;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.wands.WandCap;
|
||||
import thaumcraft.api.wands.WandRod;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
|
||||
public class Lucrum {
|
||||
|
||||
public static Aspect ULTRA_DEATH;
|
||||
public static WandRod WAND_ROD_NEUTRONIUM;
|
||||
public static WandCap WAND_CAP_CRYSTAL;
|
||||
|
||||
public static void abracadabra(){
|
||||
ULTRA_DEATH = new Aspect("terminus", 0xb90000, new Aspect[] { Aspect.GREED, Aspect.ELDRITCH }, new ResourceLocation("avaritia", "textures/misc/terminus.png"), 771);
|
||||
@@ -37,6 +45,29 @@ public class Lucrum {
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(LudicrousItems.infinity_sword), new AspectList().add(ULTRA_DEATH, 60).add(Aspect.WEAPON, 999).add(Aspect.DEATH, 999).add(Aspect.ELDRITCH, 100));
|
||||
ThaumcraftApi.registerComplexObjectTag(new ItemStack(LudicrousItems.skull_sword), new AspectList().add(ULTRA_DEATH, 1).add(Aspect.FIRE, 2).add(Aspect.CRYSTAL, 16).add(Aspect.DEATH, 4));
|
||||
|
||||
WAND_ROD_NEUTRONIUM = new WandRod("infinity", 9999999, new ItemStack(LudicrousBlocks.resource_block, 1, 0), 9999, new CheatyWandUpdate(), new ResourceLocation("avaritia", "textures/models/wand_rod_neutronium.png"));
|
||||
WAND_ROD_NEUTRONIUM.setGlowing(true);
|
||||
WAND_CAP_CRYSTAL = new WandCap("matrix", 0.0F, new ItemStack(Blocks.command_block), 1000);
|
||||
WAND_CAP_CRYSTAL.setTexture(new ResourceLocation("avaritia", "textures/models/wand_cap_crystal.png"));
|
||||
|
||||
ItemStack wand = new ItemStack(ConfigItems.itemWandCasting, 1, 9000);
|
||||
((ItemWandCasting)ConfigItems.itemWandCasting).setRod(wand, WAND_ROD_NEUTRONIUM);
|
||||
((ItemWandCasting)ConfigItems.itemWandCasting).setCap(wand, WAND_CAP_CRYSTAL);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addRecipe(wand, new Object[]{
|
||||
" C ",
|
||||
" CIC ",
|
||||
" NIIC",
|
||||
" NINC ",
|
||||
" NIN ",
|
||||
" CNIN ",
|
||||
"CIIN ",
|
||||
" CIC ",
|
||||
" C ",
|
||||
'I', new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'C', new ItemStack(LudicrousItems.resource, 1, 1),
|
||||
'N', new ItemStack(LudicrousItems.resource, 1, 4)});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package fox.spiteful.avaritia.items;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
import fox.spiteful.avaritia.render.ModelArmorInfinity;
|
||||
@@ -7,15 +8,15 @@ import net.minecraft.client.model.ModelBiped;
|
||||
import fox.spiteful.avaritia.PotionHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ISpecialArmor;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
@@ -103,4 +104,15 @@ public class ItemArmorInfinity extends ItemArmor {
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap getAttributeModifiers(ItemStack stack)
|
||||
{
|
||||
Multimap multimap = super.getAttributeModifiers(stack);
|
||||
if(armorType == 2)
|
||||
multimap.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Armor modifier", 1.0, 1));
|
||||
if(armorType == 3)
|
||||
multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Armor modifier", 0.7, 1));
|
||||
return multimap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,10 +5,12 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -16,9 +18,12 @@ import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -27,6 +32,8 @@ public class ItemPickaxeInfinity extends ItemPickaxe {
|
||||
private static final ToolMaterial opPickaxe = EnumHelper.addToolMaterial("INFINITY_PICKAXE", 32, 9999, 9999F, 5.0F, 200);
|
||||
private IIcon hammer;
|
||||
|
||||
private static final Material[] MATERIALS = new Material[] { Material.rock, Material.iron, Material.ice, Material.glass, Material.piston, Material.anvil, Material.grass, Material.ground, Material.sand, Material.snow, Material.craftedSnow, Material.clay };
|
||||
|
||||
public ItemPickaxeInfinity(){
|
||||
super(opPickaxe);
|
||||
setUnlocalizedName("infinity_pickaxe");
|
||||
@@ -53,8 +60,10 @@ public class ItemPickaxeInfinity extends ItemPickaxe {
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDigSpeed(ItemStack stack, Block block, int meta)
|
||||
{
|
||||
public float getDigSpeed(ItemStack stack, Block block, int meta){
|
||||
if(stack.getTagCompound() != null && stack.getTagCompound().getBoolean("hammer")){
|
||||
return 5.0F;
|
||||
}
|
||||
if (ForgeHooks.isToolEffective(stack, block, meta))
|
||||
{
|
||||
return efficiencyOnProperMaterial;
|
||||
@@ -86,6 +95,7 @@ public class ItemPickaxeInfinity extends ItemPickaxe {
|
||||
return getIcon(stack, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if(player.isSneaking()) {
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
@@ -101,4 +111,49 @@ public class ItemPickaxeInfinity extends ItemPickaxe {
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack stack, EntityLivingBase victim, EntityLivingBase player){
|
||||
if(stack.getTagCompound() != null){
|
||||
if(stack.getTagCompound().getBoolean("hammer")) {
|
||||
if(!(victim instanceof EntityPlayer && LudicrousItems.isInfinite((EntityPlayer)victim))) {
|
||||
int i = 10;
|
||||
victim.addVelocity((double) (-MathHelper.sin(player.rotationYaw * (float) Math.PI / 180.0F) * (float) i * 0.5F), 2.0D, (double) (MathHelper.cos(player.rotationYaw * (float) Math.PI / 180.0F) * (float) i * 0.5F));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
|
||||
if(stack.getTagCompound() != null && stack.getTagCompound().getBoolean("hammer")) {
|
||||
MovingObjectPosition raycast = ToolHelper.raytraceFromEntity(player.worldObj, player, true, 10);
|
||||
if (raycast != null) {
|
||||
breakOtherBlock(player, stack, x, y, z, x, y, z, raycast.sideHit);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void breakOtherBlock(EntityPlayer player, ItemStack stack, int x, int y, int z, int originX, int originY, int originZ, int side) {
|
||||
|
||||
World world = player.worldObj;
|
||||
Material mat = world.getBlock(x, y, z).getMaterial();
|
||||
if(!ToolHelper.isRightMaterial(mat, MATERIALS))
|
||||
return;
|
||||
|
||||
if(world.isAirBlock(x, y, z))
|
||||
return;
|
||||
|
||||
ForgeDirection direction = ForgeDirection.getOrientation(side);
|
||||
int fortune = EnchantmentHelper.getFortuneModifier(player);
|
||||
boolean silk = EnchantmentHelper.getSilkTouchModifier(player);
|
||||
boolean doY = direction.offsetY == 0;
|
||||
|
||||
int range = 8;
|
||||
|
||||
ToolHelper.removeBlocksInIteration(player, stack, world, x, y, z, -range, doY ? -1 : -range, -range, range, doY ? range * 2 - 2 : range, range, null, MATERIALS, silk, fortune, false);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -49,8 +49,7 @@ public class ItemSwordInfinity extends ItemSword implements ICosmicRenderItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack stack, EntityLivingBase victim, EntityLivingBase player)
|
||||
{
|
||||
public boolean hitEntity(ItemStack stack, EntityLivingBase victim, EntityLivingBase player){
|
||||
if(player.worldObj.isRemote)
|
||||
return true;
|
||||
if(victim instanceof EntityPlayer){
|
||||
@@ -67,7 +66,7 @@ public class ItemSwordInfinity extends ItemSword implements ICosmicRenderItem {
|
||||
stupidMojangProtectedVariable.setInt(victim, 60);
|
||||
}
|
||||
catch(Exception e){
|
||||
Lumberjack.log(Level.ERROR, e, "WHAT THE FUCK");
|
||||
Lumberjack.log(Level.ERROR, e, "The sword isn't reflecting right! Polish it!");
|
||||
}
|
||||
victim.func_110142_aN().func_94547_a(new DamageSourceInfinitySword(player), victim.getHealth(), victim.getHealth());
|
||||
victim.setHealth(0);
|
||||
@@ -76,8 +75,7 @@ public class ItemSwordInfinity extends ItemSword implements ICosmicRenderItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
|
||||
{
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity){
|
||||
if(!entity.worldObj.isRemote && entity instanceof EntityPlayer) {
|
||||
EntityPlayer victim = (EntityPlayer)entity;
|
||||
if(victim.capabilities.isCreativeMode && !victim.isDead && victim.getHealth() > 0 && !LudicrousItems.isInfinite(victim)){
|
||||
@@ -117,8 +115,7 @@ public class ItemSwordInfinity extends ItemSword implements ICosmicRenderItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass)
|
||||
{
|
||||
public IIcon getIcon(ItemStack stack, int pass){
|
||||
if (pass == 1) { return this.pommel; }
|
||||
|
||||
return super.getIcon(stack, pass);
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
/**
|
||||
* This class based on code by Vazkii in the Botania mod.
|
||||
*
|
||||
* Get the original source here:
|
||||
* https://github.com/Vazkii/Botania/blob/master/src/main/java/vazkii/botania/common/item/equipment/tool/ToolCommons.java
|
||||
*/
|
||||
|
||||
package fox.spiteful.avaritia.items.tools;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ToolHelper {
|
||||
|
||||
public static Material[] materialsPick = new Material[]{ Material.rock, Material.iron, Material.ice, Material.glass, Material.piston, Material.anvil };
|
||||
public static Material[] materialsShovel = new Material[]{ Material.grass, Material.ground, Material.sand, Material.snow, Material.craftedSnow, Material.clay };
|
||||
public static Material[] materialsAxe = new Material[]{ Material.coral, Material.leaves, Material.plants, Material.wood };
|
||||
|
||||
public static void removeBlocksInIteration(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int xs, int ys, int zs, int xe, int ye, int ze, Block block, Material[] materialsListing, boolean silk, int fortune, boolean dispose) {
|
||||
float blockHardness = block == null ? 1F : block.getBlockHardness(world, x, y, z);
|
||||
|
||||
for(int x1 = xs; x1 < xe; x1++)
|
||||
for(int y1 = ys; y1 < ye; y1++)
|
||||
for(int z1 = zs; z1 < ze; z1++)
|
||||
removeBlockWithDrops(player, stack, world, x1 + x, y1 + y, z1 + z, x, y, z, block, materialsListing, silk, fortune, blockHardness, dispose);
|
||||
}
|
||||
|
||||
public static boolean isRightMaterial(Material material, Material[] materialsListing) {
|
||||
for(Material mat : materialsListing)
|
||||
if(material == mat)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void removeBlockWithDrops(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int bx, int by, int bz, Block block, Material[] materialsListing, boolean silk, int fortune, float blockHardness, boolean dispose) {
|
||||
removeBlockWithDrops(player, stack, world, x, y, z, bx, by, bz, block, materialsListing, silk, fortune, blockHardness, dispose, true);
|
||||
}
|
||||
|
||||
public static void removeBlockWithDrops(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int bx, int by, int bz, Block block, Material[] materialsListing, boolean silk, int fortune, float blockHardness, boolean dispose, boolean particles) {
|
||||
if(!world.blockExists(x, y, z))
|
||||
return;
|
||||
|
||||
Block blk = world.getBlock(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if(block != null && blk != block)
|
||||
return;
|
||||
|
||||
Material mat = world.getBlock(x, y, z).getMaterial();
|
||||
if(!world.isRemote && blk != null && !blk.isAir(world, x, y, z)/* && blk.getPlayerRelativeBlockHardness(player, world, x, y, z) > 0*/) {
|
||||
if(!blk.canHarvestBlock(player, meta) || !isRightMaterial(mat, materialsListing))
|
||||
return;
|
||||
|
||||
if(!player.capabilities.isCreativeMode) {
|
||||
int localMeta = world.getBlockMetadata(x, y, z);
|
||||
blk.onBlockHarvested(world, x, y, z, localMeta, player);
|
||||
|
||||
if(blk.removedByPlayer(world, player, x, y, z, true)) {
|
||||
blk.onBlockDestroyedByPlayer(world, x, y, z, localMeta);
|
||||
|
||||
if(!dispose)
|
||||
blk.harvestBlock(world, player, x, y, z, localMeta);
|
||||
}
|
||||
|
||||
} else world.setBlockToAir(x, y, z);
|
||||
|
||||
if(particles && !world.isRemote /*&& ConfigHandler.blockBreakParticles && ConfigHandler.blockBreakParticlesTool*/)
|
||||
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(blk) + (meta << 12));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @author mDiyo
|
||||
*/
|
||||
public static MovingObjectPosition raytraceFromEntity(World world, Entity player, boolean par3, double range) {
|
||||
float f = 1.0F;
|
||||
float f1 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * f;
|
||||
float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f;
|
||||
double d0 = player.prevPosX + (player.posX - player.prevPosX) * f;
|
||||
double d1 = player.prevPosY + (player.posY - player.prevPosY) * f;
|
||||
if (!world.isRemote && player instanceof EntityPlayer)
|
||||
d1 += 1.62D;
|
||||
double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * f;
|
||||
Vec3 vec3 = Vec3.createVectorHelper(d0, d1, d2);
|
||||
float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI);
|
||||
float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI);
|
||||
float f5 = -MathHelper.cos(-f1 * 0.017453292F);
|
||||
float f6 = MathHelper.sin(-f1 * 0.017453292F);
|
||||
float f7 = f4 * f5;
|
||||
float f8 = f3 * f5;
|
||||
double d3 = range;
|
||||
Vec3 vec31 = vec3.addVector(f7 * d3, f6 * d3, f8 * d3);
|
||||
return world.rayTraceBlocks(vec3, vec31, par3);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user