init
|
@ -0,0 +1,130 @@
|
|||
---
|
||||
AccessModifierOffset: 0
|
||||
AlignAfterOpenBracket: BlockIndent
|
||||
AlignArrayOfStructures: None
|
||||
AlignConsecutiveAssignments: None
|
||||
AlignConsecutiveMacros: None
|
||||
AlignConsecutiveBitFields: None
|
||||
AlignConsecutiveDeclarations: None
|
||||
AlignEscapedNewlines: DontAlign
|
||||
AlignOperands: DontAlign
|
||||
AlignTrailingComments: false
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: Empty
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortEnumsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AlwaysBreakTemplateDeclarations: MultiLine
|
||||
AttributeMacros: []
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false
|
||||
BitFieldColonSpacing: After
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: false
|
||||
AfterControlStatement: Never
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
BeforeLambdaBody: false
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: false
|
||||
SplitEmptyRecord: false
|
||||
SplitEmptyNamespace: false
|
||||
BreakAfterJavaFieldAnnotations: true
|
||||
#BreakArrays: false
|
||||
BreakBeforeBinaryOperators: All
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeConceptDeclarations: true
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: AfterColon
|
||||
BreakInheritanceList: AfterColon
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 90
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: false
|
||||
DeriveLineEnding: false
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false # wtf
|
||||
EmptyLineAfterAccessModifier: Never
|
||||
EmptyLineBeforeAccessModifier: Always
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: false
|
||||
ForEachMacros: ["BOOST_FOREACH"]
|
||||
IfMacros: []
|
||||
IncludeBlocks: Regroup
|
||||
IndentAccessModifiers: false
|
||||
IndentCaseBlocks: false
|
||||
IndentCaseLabels: true
|
||||
IndentExternBlock: Indent
|
||||
IndentGotoLabels: true
|
||||
IndentPPDirectives: BeforeHash
|
||||
#IndentRequiresClause: false
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
#InsertBraces: false
|
||||
InsertTrailingCommas: Wrapped
|
||||
JavaImportGroups: ["java"]
|
||||
JavaScriptQuotes: Double
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
LambdaBodyIndentation: OuterScope
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: All
|
||||
PackConstructorInitializers: NextLine
|
||||
PointerAlignment: Left
|
||||
QualifierAlignment: Left
|
||||
ReferenceAlignment: Left
|
||||
ReflowComments: true
|
||||
#RemoveSemicolon: true
|
||||
#RequiresClausePosition: OwnLine
|
||||
#RequiresExpressionIndentation: OuterScope
|
||||
SeparateDefinitionBlocks: Always
|
||||
SortIncludes: CaseInsensitive
|
||||
SortJavaStaticImport: Before
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: true
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: false
|
||||
SpaceAroundPointerQualifiers: After
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCaseColon: false
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: false
|
||||
SpaceBeforeInheritanceColon: false
|
||||
SpaceBeforeParens: ControlStatementsExceptControlMacros
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceBeforeSquareBrackets: false
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesInAngles: Never
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInLineCommentPrefix:
|
||||
Minimum: 0
|
||||
Maximum: -1
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: c++20
|
||||
StatementAttributeLikeMacros: []
|
||||
StatementMacros: []
|
||||
TabWidth: 4
|
||||
TypenameMacros: []
|
||||
UseCRLF: false # wtf
|
||||
UseTab: Never
|
||||
WhitespaceSensitiveMacros: ["BOOST_PP_STRINGSIZE"]
|
|
@ -1,3 +1,7 @@
|
|||
.project
|
||||
.classpath
|
||||
bin
|
||||
.settings
|
||||
.gradle
|
||||
.idea
|
||||
build
|
||||
|
|
14
build.gradle
|
@ -23,21 +23,27 @@ apply plugin: 'maven-publish'
|
|||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
version = "1.0"
|
||||
group= "modgroup"
|
||||
archivesBaseName = "modid"
|
||||
version = "0.1.0"
|
||||
group= "dev.tilera"
|
||||
archivesBaseName = "classic-casting"
|
||||
|
||||
minecraft {
|
||||
version = "1.7.10-10.13.4.1614-1.7.10"
|
||||
runDir = "run"
|
||||
|
||||
replaceIn "dev/tilera/classiccasting/ClassicCasting.java"
|
||||
replace "@VERSION@", project.version
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven { url = "https://maven.tilera.xyz" }
|
||||
maven { url = "https://jitpack.io" }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "thaumcraft:Thaumcraft:1.7.10-4.2.3.5:deobf"
|
||||
implementation "dev.tilera:auracore:0.1.0:deobf"
|
||||
implementation "com.github.tox1cozZ:mixin-booter-legacy:1.1.2"
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
@ -85,4 +91,4 @@ publishing {
|
|||
mavenLocal()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package dev.tilera.classiccasting;
|
||||
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
|
||||
@Mod(
|
||||
modid = "classiccasting",
|
||||
name = "Classic Casting",
|
||||
version = "@VERSION@",
|
||||
dependencies = "required-after:Thaumcraft"
|
||||
)
|
||||
public class ClassicCasting {
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent ev) {
|
||||
ClassicCastingTab.INSTANCE = new ClassicCastingTab();
|
||||
Items.init();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package dev.tilera.classiccasting;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class ClassicCastingTab extends CreativeTabs {
|
||||
public static ClassicCastingTab INSTANCE;
|
||||
|
||||
public ClassicCastingTab() {
|
||||
super("classiccasting");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getTabIconItem() {
|
||||
return Items.wandExcavation;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package dev.tilera.classiccasting;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import dev.tilera.classiccasting.items.ItemPortableHole;
|
||||
import dev.tilera.classiccasting.items.wands.ItemHellrod;
|
||||
import dev.tilera.classiccasting.items.wands.ItemWandCastingAdept;
|
||||
import dev.tilera.classiccasting.items.wands.ItemWandCastingApprentice;
|
||||
import dev.tilera.classiccasting.items.wands.ItemWandCastingMage;
|
||||
import dev.tilera.classiccasting.items.wands.ItemWandExcavation;
|
||||
import dev.tilera.classiccasting.items.wands.ItemWandFire;
|
||||
import dev.tilera.classiccasting.items.wands.ItemWandFrost;
|
||||
import dev.tilera.classiccasting.items.wands.ItemWandLightning;
|
||||
import dev.tilera.classiccasting.items.wands.ItemWandTrade;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class Items {
|
||||
public static Item portableHole;
|
||||
|
||||
public static Item wandCastingApprentice;
|
||||
public static Item wandCastingAdept;
|
||||
public static Item wandCastingMage;
|
||||
|
||||
public static Item wandExcavation;
|
||||
public static Item wandFire;
|
||||
public static Item wandFrost;
|
||||
public static Item wandHellrod;
|
||||
public static Item wandLightning;
|
||||
public static Item wandTrade;
|
||||
|
||||
public static void init() {
|
||||
portableHole = new ItemPortableHole();
|
||||
|
||||
wandCastingApprentice = new ItemWandCastingApprentice();
|
||||
wandCastingAdept = new ItemWandCastingAdept();
|
||||
wandCastingMage = new ItemWandCastingMage();
|
||||
|
||||
wandExcavation = new ItemWandExcavation();
|
||||
wandFire = new ItemWandFire();
|
||||
wandFrost = new ItemWandFrost();
|
||||
wandHellrod = new ItemHellrod();
|
||||
wandLightning = new ItemWandLightning();
|
||||
wandTrade = new ItemWandTrade();
|
||||
|
||||
GameRegistry.registerItem(portableHole, "portableHole");
|
||||
|
||||
GameRegistry.registerItem(wandCastingApprentice, "wandCastingApprentice");
|
||||
GameRegistry.registerItem(wandCastingAdept, "wandCastingAdept");
|
||||
GameRegistry.registerItem(wandCastingMage, "wandCastingMage");
|
||||
|
||||
GameRegistry.registerItem(wandExcavation, "wandExcavation");
|
||||
GameRegistry.registerItem(wandFire, "wandFire");
|
||||
GameRegistry.registerItem(wandFrost, "wandFrost");
|
||||
GameRegistry.registerItem(wandHellrod, "wandHellrod");
|
||||
GameRegistry.registerItem(wandLightning, "wandLightning");
|
||||
GameRegistry.registerItem(wandTrade, "wandTrade");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,200 @@
|
|||
package dev.tilera.classiccasting;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class Utils {
|
||||
public static Entity getPointedEntity(
|
||||
final World world,
|
||||
final EntityPlayer entityplayer,
|
||||
final double range,
|
||||
final float padding
|
||||
) {
|
||||
return getPointedEntity(world, entityplayer, range, padding, false);
|
||||
}
|
||||
|
||||
public static Entity getPointedEntity(
|
||||
final World world,
|
||||
final EntityPlayer entityplayer,
|
||||
final double range,
|
||||
final float padding,
|
||||
final boolean nonCollide
|
||||
) {
|
||||
Entity pointedEntity = null;
|
||||
final double d = range;
|
||||
final Vec3 vec3d = Vec3.createVectorHelper(
|
||||
((Entity) entityplayer).posX,
|
||||
((Entity) entityplayer).posY + entityplayer.getEyeHeight(),
|
||||
((Entity) entityplayer).posZ
|
||||
);
|
||||
final Vec3 vec3d2 = entityplayer.getLookVec();
|
||||
final Vec3 vec3d3
|
||||
= vec3d.addVector(vec3d2.xCoord * d, vec3d2.yCoord * d, vec3d2.zCoord * d);
|
||||
final float f1 = padding;
|
||||
final List<Entity> list = world.getEntitiesWithinAABBExcludingEntity(
|
||||
(Entity) entityplayer,
|
||||
((Entity) entityplayer)
|
||||
.boundingBox
|
||||
.addCoord(vec3d2.xCoord * d, vec3d2.yCoord * d, vec3d2.zCoord * d)
|
||||
.expand((double) f1, (double) f1, (double) f1)
|
||||
);
|
||||
double d2 = 0.0;
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
final Entity entity = list.get(i);
|
||||
if (entity.canBeCollidedWith() || nonCollide) {
|
||||
if (world.rayTraceBlocks(
|
||||
Vec3.createVectorHelper(
|
||||
((Entity) entityplayer).posX,
|
||||
((Entity) entityplayer).posY + entityplayer.getEyeHeight(),
|
||||
((Entity) entityplayer).posZ
|
||||
),
|
||||
Vec3.createVectorHelper(
|
||||
entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ
|
||||
),
|
||||
false
|
||||
)
|
||||
== null) {
|
||||
final float f2 = Math.max(0.8f, entity.getCollisionBorderSize());
|
||||
final AxisAlignedBB axisalignedbb = entity.boundingBox.expand(
|
||||
(double) f2, (double) f2, (double) f2
|
||||
);
|
||||
final MovingObjectPosition movingobjectposition
|
||||
= axisalignedbb.calculateIntercept(vec3d, vec3d3);
|
||||
if (axisalignedbb.isVecInside(vec3d)) {
|
||||
if (0.0 < d2 || d2 == 0.0) {
|
||||
pointedEntity = entity;
|
||||
d2 = 0.0;
|
||||
}
|
||||
} else if (movingobjectposition != null) {
|
||||
final double d3 = vec3d.distanceTo(movingobjectposition.hitVec);
|
||||
if (d3 < d2 || d2 == 0.0) {
|
||||
pointedEntity = entity;
|
||||
d2 = d3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return pointedEntity;
|
||||
}
|
||||
|
||||
public static Entity getPointedEntity(
|
||||
final World world,
|
||||
final EntityPlayer entityplayer,
|
||||
final double range,
|
||||
final Class<? extends Entity> clazz
|
||||
) {
|
||||
Entity pointedEntity = null;
|
||||
final double d = range;
|
||||
final Vec3 vec3d = Vec3.createVectorHelper(
|
||||
((Entity) entityplayer).posX,
|
||||
((Entity) entityplayer).posY + entityplayer.getEyeHeight(),
|
||||
((Entity) entityplayer).posZ
|
||||
);
|
||||
final Vec3 vec3d2 = entityplayer.getLookVec();
|
||||
final Vec3 vec3d3
|
||||
= vec3d.addVector(vec3d2.xCoord * d, vec3d2.yCoord * d, vec3d2.zCoord * d);
|
||||
final float f1 = 1.1f;
|
||||
final List<Entity> list = world.getEntitiesWithinAABBExcludingEntity(
|
||||
(Entity) entityplayer,
|
||||
((Entity) entityplayer)
|
||||
.boundingBox
|
||||
.addCoord(vec3d2.xCoord * d, vec3d2.yCoord * d, vec3d2.zCoord * d)
|
||||
.expand((double) f1, (double) f1, (double) f1)
|
||||
);
|
||||
double d2 = 0.0;
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
final Entity entity = list.get(i);
|
||||
if (entity.canBeCollidedWith()
|
||||
&& world.rayTraceBlocks(
|
||||
Vec3.createVectorHelper(
|
||||
((Entity) entityplayer).posX,
|
||||
((Entity) entityplayer).posY + entityplayer.getEyeHeight(),
|
||||
((Entity) entityplayer).posZ
|
||||
),
|
||||
Vec3.createVectorHelper(
|
||||
entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ
|
||||
),
|
||||
false
|
||||
) == null) {
|
||||
if (!clazz.isInstance(entity)) {
|
||||
final float f2 = Math.max(0.8f, entity.getCollisionBorderSize());
|
||||
final AxisAlignedBB axisalignedbb = entity.boundingBox.expand(
|
||||
(double) f2, (double) f2, (double) f2
|
||||
);
|
||||
final MovingObjectPosition movingobjectposition
|
||||
= axisalignedbb.calculateIntercept(vec3d, vec3d3);
|
||||
if (axisalignedbb.isVecInside(vec3d)) {
|
||||
if (0.0 < d2 || d2 == 0.0) {
|
||||
pointedEntity = entity;
|
||||
d2 = 0.0;
|
||||
}
|
||||
} else if (movingobjectposition != null) {
|
||||
final double d3 = vec3d.distanceTo(movingobjectposition.hitVec);
|
||||
if (d3 < d2 || d2 == 0.0) {
|
||||
pointedEntity = entity;
|
||||
d2 = d3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return pointedEntity;
|
||||
}
|
||||
|
||||
public static MovingObjectPosition
|
||||
getTargetBlock(final World world, final EntityPlayer player, final boolean par3) {
|
||||
final float var4 = 1.0f;
|
||||
final float var5 = ((Entity) player).prevRotationPitch
|
||||
+ (((Entity) player).rotationPitch - ((Entity) player).prevRotationPitch)
|
||||
* var4;
|
||||
final float var6 = ((Entity) player).prevRotationYaw
|
||||
+ (((Entity) player).rotationYaw - ((Entity) player).prevRotationYaw) * var4;
|
||||
final double var7 = ((Entity) player).prevPosX
|
||||
+ (((Entity) player).posX - ((Entity) player).prevPosX) * var4;
|
||||
final double var8 = ((Entity) player).prevPosY
|
||||
+ (((Entity) player).posY - ((Entity) player).prevPosY) * var4 + 1.62
|
||||
- ((Entity) player).yOffset;
|
||||
final double var9 = ((Entity) player).prevPosZ
|
||||
+ (((Entity) player).posZ - ((Entity) player).prevPosZ) * var4;
|
||||
final Vec3 var10 = Vec3.createVectorHelper(var7, var8, var9);
|
||||
final float var11 = MathHelper.cos(-var6 * 0.017453292f - 3.1415927f);
|
||||
final float var12 = MathHelper.sin(-var6 * 0.017453292f - 3.1415927f);
|
||||
final float var13 = -MathHelper.cos(-var5 * 0.017453292f);
|
||||
final float var14 = MathHelper.sin(-var5 * 0.017453292f);
|
||||
final float var15 = var12 * var13;
|
||||
final float var16 = var11 * var13;
|
||||
final double var17 = 10.0;
|
||||
final Vec3 var18 = var10.addVector(var15 * var17, var14 * var17, var16 * var17);
|
||||
return world.rayTraceBlocks(var10, var18, par3);
|
||||
}
|
||||
|
||||
public static MovingObjectPosition getTargetBlock(
|
||||
final World world,
|
||||
final double x,
|
||||
final double y,
|
||||
final double z,
|
||||
final float yaw,
|
||||
final float pitch,
|
||||
final boolean par3,
|
||||
final double range
|
||||
) {
|
||||
final Vec3 var13 = Vec3.createVectorHelper(x, y, z);
|
||||
final float var14 = MathHelper.cos(-yaw * 0.017453292f - 3.1415927f);
|
||||
final float var15 = MathHelper.sin(-yaw * 0.017453292f - 3.1415927f);
|
||||
final float var16 = -MathHelper.cos(-pitch * 0.017453292f);
|
||||
final float var17 = MathHelper.sin(-pitch * 0.017453292f);
|
||||
final float var18 = var15 * var16;
|
||||
final float var19 = var14 * var16;
|
||||
final double var20 = range;
|
||||
final Vec3 var21 = var13.addVector(var18 * var20, var17 * var20, var19 * var20);
|
||||
return world.rayTraceBlocks(var13, var21, par3);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,182 @@
|
|||
package dev.tilera.classiccasting.items;
|
||||
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dev.tilera.auracore.aura.AuraManager;
|
||||
import dev.tilera.classiccasting.ClassicCastingTab;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.ThaumcraftApi;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.tiles.TileHole;
|
||||
|
||||
public class ItemPortableHole extends Item {
|
||||
public IIcon icon;
|
||||
|
||||
public ItemPortableHole() {
|
||||
super();
|
||||
this.setMaxStackSize(1);
|
||||
this.setMaxDamage(321);
|
||||
this.isDamageable();
|
||||
this.setNoRepair();
|
||||
this.setCreativeTab(ClassicCastingTab.INSTANCE);
|
||||
this.setUnlocalizedName("classiccasting:portableHole");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister ir) {
|
||||
this.icon = ir.registerIcon("classiccasting:portablehole");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(final int par1) {
|
||||
return this.icon;
|
||||
}
|
||||
|
||||
public void onUpdate(
|
||||
final ItemStack is,
|
||||
final World w,
|
||||
final Entity e,
|
||||
final int par4,
|
||||
final boolean par5
|
||||
) {
|
||||
if (!w.isRemote && is.getItemDamage() >= 10
|
||||
&& AuraManager.decreaseClosestAura(w, e.posX, e.posY, e.posZ, 1)) {
|
||||
is.setItemDamage(is.getItemDamage() - 10);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean spendCharge(
|
||||
final World world,
|
||||
final ItemStack itemstack,
|
||||
final EntityPlayer player,
|
||||
final int amount
|
||||
) {
|
||||
final int charge = itemstack.getMaxDamage() - itemstack.getItemDamage();
|
||||
if (charge >= amount * 10) {
|
||||
if (!world.isRemote) {
|
||||
itemstack.damageItem(amount * 10, player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (!world.isRemote) {
|
||||
player.addChatMessage(new ChatComponentText(
|
||||
LanguageRegistry.instance().getStringLocalization("tc.portableholeerror")
|
||||
));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean createHole(
|
||||
final World world,
|
||||
final int ii,
|
||||
final int jj,
|
||||
final int kk,
|
||||
final int side,
|
||||
final byte count
|
||||
) {
|
||||
final Block bi = world.getBlock(ii, jj, kk);
|
||||
if (world.getTileEntity(ii, jj, kk) == null
|
||||
&& !ThaumcraftApi.portableHoleBlackList.contains(bi) && bi != Blocks.bedrock
|
||||
&& bi != ConfigBlocks.blockHole && bi != null
|
||||
&& !bi.canPlaceBlockAt(world, ii, jj, kk)
|
||||
&& bi.getBlockHardness(world, ii, jj, kk) != -1.0f) {
|
||||
final TileHole ts = new TileHole(
|
||||
bi,
|
||||
world.getBlockMetadata(ii, jj, kk),
|
||||
(short) 120,
|
||||
count,
|
||||
(byte) side,
|
||||
null
|
||||
);
|
||||
world.setBlock(ii, jj, kk, Blocks.air, 0, 0);
|
||||
if (world.setBlock(ii, jj, kk, ConfigBlocks.blockHole, 0, 0)) {
|
||||
world.setTileEntity(ii, jj, kk, (TileEntity) ts);
|
||||
}
|
||||
world.markBlockForUpdate(ii, jj, kk);
|
||||
Thaumcraft.proxy.blockSparkle(world, ii, jj, kk, 5, 1);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onItemUseFirst(
|
||||
final ItemStack itemstack,
|
||||
final EntityPlayer entityplayer,
|
||||
final World world,
|
||||
final int i,
|
||||
final int j,
|
||||
final int k,
|
||||
final int side,
|
||||
final float f1,
|
||||
final float f2,
|
||||
final float f3
|
||||
) {
|
||||
int ii = i;
|
||||
int jj = j;
|
||||
int kk = k;
|
||||
int distance;
|
||||
Block bi;
|
||||
for (distance = 0, distance = 0; distance < 33; ++distance) {
|
||||
bi = world.getBlock(ii, jj, kk);
|
||||
if (ThaumcraftApi.portableHoleBlackList.contains(bi) || bi == Blocks.bedrock
|
||||
|| bi == ConfigBlocks.blockHole || bi == Blocks.air) {
|
||||
break;
|
||||
}
|
||||
if (bi.getBlockHardness(world, ii, jj, kk) == -1.0f) {
|
||||
break;
|
||||
}
|
||||
switch (side) {
|
||||
case 0: {
|
||||
++jj;
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
--jj;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
++kk;
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
--kk;
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
++ii;
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
--ii;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (spendCharge(world, itemstack, entityplayer, distance)) {
|
||||
createHole(world, i, j, k, side, (byte) (distance + 1));
|
||||
}
|
||||
if (!world.isRemote) {
|
||||
world.playSoundEffect(
|
||||
i + 0.5, j + 0.5, k + 0.5, "mob.endermen.portal", 1.0f, 1.0f
|
||||
);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public EnumRarity getRarity(final ItemStack itemstack) {
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
package dev.tilera.classiccasting.items.wands;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dev.tilera.auracore.aura.AuraManager;
|
||||
import dev.tilera.classiccasting.Utils;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagShort;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.common.entities.monster.EntityFireBat;
|
||||
|
||||
public class ItemHellrod extends ItemWandBasic {
|
||||
public IIcon icon;
|
||||
|
||||
public ItemHellrod() {
|
||||
super();
|
||||
this.setMaxDamage(1);
|
||||
this.setUnlocalizedName("classiccasting:hellrod");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister ir) {
|
||||
this.icon = ir.registerIcon("classiccasting:hellrod");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(final int par1) {
|
||||
return this.icon;
|
||||
}
|
||||
|
||||
public void onUpdate(
|
||||
final ItemStack is,
|
||||
final World w,
|
||||
final Entity e,
|
||||
final int par4,
|
||||
final boolean par5
|
||||
) {
|
||||
final int tcount = this.canCharge(is) ? 25 : 50;
|
||||
if (is.hasTagCompound() && is.stackTagCompound.hasKey("charges")) {
|
||||
if (!w.isRemote && e.ticksExisted % tcount == 0) {
|
||||
final short charges = is.stackTagCompound.getShort("charges");
|
||||
if (charges < 9
|
||||
&& AuraManager.decreaseClosestAura(w, e.posX, e.posY, e.posZ, 6)) {
|
||||
is.setTagInfo("charges", new NBTTagShort((short) (charges + 1)));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
is.setTagInfo("charges", new NBTTagShort((short) 0));
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack
|
||||
onItemRightClick(final ItemStack itemstack, final World world, final EntityPlayer p) {
|
||||
if (itemstack.hasTagCompound() && itemstack.stackTagCompound.hasKey("charges")) {
|
||||
final short charges = itemstack.stackTagCompound.getShort("charges");
|
||||
if (charges <= 0) {
|
||||
return itemstack;
|
||||
}
|
||||
final Entity pointedEntity = Utils.getPointedEntity(
|
||||
((Entity) p).worldObj, p, 32.0, EntityFireBat.class
|
||||
);
|
||||
double px = ((Entity) p).posX;
|
||||
double py = ((Entity) p).posY;
|
||||
double pz = ((Entity) p).posZ;
|
||||
py = ((Entity) p).boundingBox.minY + ((Entity) p).height / 2.0f + 0.25;
|
||||
px -= MathHelper.cos(((Entity) p).rotationYaw / 180.0f * 3.141593f) * 0.16f;
|
||||
py -= 0.05000000014901161;
|
||||
pz -= MathHelper.sin(((Entity) p).rotationYaw / 180.0f * 3.141593f) * 0.16f;
|
||||
final Vec3 vec3d = p.getLook(1.0f);
|
||||
px += vec3d.xCoord * 0.5;
|
||||
py += vec3d.yCoord * 0.5;
|
||||
pz += vec3d.zCoord * 0.5;
|
||||
if (pointedEntity != null && pointedEntity instanceof EntityLiving) {
|
||||
if (!world.isRemote) {
|
||||
if (pointedEntity instanceof EntityPlayer
|
||||
&& !MinecraftServer.getServer().isPVPEnabled()) {
|
||||
return itemstack;
|
||||
}
|
||||
final EntityFireBat firebat = new EntityFireBat(world);
|
||||
firebat.setLocationAndAngles(
|
||||
px,
|
||||
py + ((Entity) firebat).height,
|
||||
pz,
|
||||
((Entity) p).rotationYaw,
|
||||
0.0f
|
||||
);
|
||||
firebat.setTarget(pointedEntity);
|
||||
firebat.setIsSummoned(true);
|
||||
firebat.setIsBatHanging(false);
|
||||
firebat.damBonus = this.getPotency(itemstack);
|
||||
// TODO: WTF
|
||||
//firebat.initCreature();
|
||||
if (world.spawnEntityInWorld((Entity) firebat)) {
|
||||
world.playAuxSFX(2004, (int) px, (int) py, (int) pz, 0);
|
||||
itemstack.setTagInfo(
|
||||
"charges", new NBTTagShort((short) (charges - 1))
|
||||
);
|
||||
}
|
||||
} else {
|
||||
world.spawnParticle("explode", px, py, pz, 0.0, 0.0, 0.0);
|
||||
}
|
||||
world.playSoundAtEntity(
|
||||
(Entity) p,
|
||||
"thaumcraft:wandfail",
|
||||
0.4f,
|
||||
0.9f + world.rand.nextFloat() * 0.2f
|
||||
);
|
||||
p.swingItem();
|
||||
}
|
||||
}
|
||||
return itemstack;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
package dev.tilera.classiccasting.items.wands;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dev.tilera.classiccasting.ClassicCastingTab;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemWandBasic extends Item {
|
||||
public ItemWandBasic() {
|
||||
super();
|
||||
super.maxStackSize = 1;
|
||||
super.canRepair = false;
|
||||
this.setCreativeTab(ClassicCastingTab.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemEnchantability() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRotateAroundWhenRendering() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDamageable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(final ItemStack itemstack) {
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
public ItemStack
|
||||
damageWand(final ItemStack itemstack, final EntityPlayer p, final int amount) {
|
||||
//final int var3 = EnchantmentHelper.getEnchantmentLevel(
|
||||
// Config.enchFrugal.effectId, itemstack
|
||||
//);
|
||||
//for (int a = 0; a < amount; ++a) {
|
||||
// if (EnchantmentFrugal.doDamage(itemstack, var3, Item.itemRand)) {
|
||||
// itemstack.damageItem(1, (EntityLiving) p);
|
||||
// }
|
||||
//}
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
public int getPotency(final ItemStack itemstack) {
|
||||
//return EnchantmentHelper.getEnchantmentLevel(
|
||||
// Config.enchPotency.effectId, itemstack
|
||||
//);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int getTreasure(final ItemStack itemstack) {
|
||||
//return EnchantmentHelper.getEnchantmentLevel(
|
||||
// Config.enchWandFortune.effectId, itemstack
|
||||
//);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public boolean canCharge(final ItemStack itemstack) {
|
||||
//return EnchantmentHelper.getEnchantmentLevel(
|
||||
// Config.enchCharging.effectId, itemstack
|
||||
// )
|
||||
// > 0;
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,385 @@
|
|||
package dev.tilera.classiccasting.items.wands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
import dev.tilera.auracore.api.IWand;
|
||||
import dev.tilera.auracore.aura.AuraManager;
|
||||
import dev.tilera.classiccasting.ClassicCastingTab;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagShort;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import thaumcraft.common.config.Config;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumcraft.common.items.wands.WandManager;
|
||||
import thaumcraft.common.lib.research.ResearchManager;
|
||||
import thaumcraft.common.tiles.TileArcaneBore;
|
||||
import thaumcraft.common.tiles.TileArcaneBoreBase;
|
||||
import thaumcraft.common.tiles.TileArcaneWorkbench;
|
||||
import thaumcraft.common.tiles.TileCrucible;
|
||||
import thaumcraft.common.tiles.TileOwned;
|
||||
|
||||
public abstract class ItemWandCasting extends Item implements IWand {
|
||||
public ItemWandCasting() {
|
||||
super();
|
||||
super.maxStackSize = 1;
|
||||
super.canRepair = false;
|
||||
this.setCreativeTab(ClassicCastingTab.INSTANCE);
|
||||
}
|
||||
|
||||
public int getRechargeInterval() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(
|
||||
final ItemStack stack,
|
||||
final EntityPlayer par2EntityPlayer,
|
||||
final List list,
|
||||
final boolean par4
|
||||
) {
|
||||
if (stack.hasTagCompound() && stack.stackTagCompound.hasKey("vis")) {
|
||||
final int vl = stack.stackTagCompound.getShort("vis");
|
||||
list.add(LanguageRegistry.instance()
|
||||
.getStringLocalization("tc.wandcharge")
|
||||
.replace("%s", vl + ""));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVis(ItemStack stack) {
|
||||
return stack.stackTagCompound.hasKey("vis")
|
||||
? stack.stackTagCompound.getShort("vis")
|
||||
: 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean consumeVis(ItemStack stack, int amount) {
|
||||
if (this.getVis(stack) >= amount) {
|
||||
stack.stackTagCompound.setShort("vis", (short) (this.getVis(stack) - amount));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean recharge(
|
||||
final ItemStack is,
|
||||
final World w,
|
||||
final int count,
|
||||
final double x,
|
||||
final double y,
|
||||
final double z
|
||||
) {
|
||||
boolean done = false;
|
||||
if (is.hasTagCompound() && is.stackTagCompound.hasKey("vis")) {
|
||||
if (!w.isRemote && count % this.getRechargeInterval() == 0) {
|
||||
final short charges = is.stackTagCompound.getShort("vis");
|
||||
if (charges < this.getMaxVis(is)) {
|
||||
if (AuraManager.decreaseClosestAura(w, x, y, z, 1)) {
|
||||
is.setTagInfo(
|
||||
"vis", (NBTBase) new NBTTagShort((short) (charges + 1))
|
||||
);
|
||||
}
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
} else if (is.getItemDamage() > 0) {
|
||||
is.setTagInfo(
|
||||
"vis",
|
||||
(NBTBase
|
||||
) new NBTTagShort((short) (this.getMaxVis(is) - is.getItemDamage()))
|
||||
);
|
||||
} else {
|
||||
is.setTagInfo("vis", (NBTBase) new NBTTagShort((short) this.getMaxVis(is)));
|
||||
}
|
||||
if (is.getItemDamage() > 0) {
|
||||
is.setItemDamage(0);
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(
|
||||
final ItemStack is,
|
||||
final World w,
|
||||
final Entity e,
|
||||
final int par4,
|
||||
final boolean par5
|
||||
) {
|
||||
this.recharge(is, w, e.ticksExisted, e.posX, e.posY, e.posZ);
|
||||
}
|
||||
|
||||
//@Override
|
||||
//public boolean itemInteractionForEntity(
|
||||
// final ItemStack par1ItemStack, EntityPlayer p, final EntityLivingBase entity
|
||||
//) {
|
||||
// if (!(entity instanceof EntityGolemBase) || ((Entity) entity).isDead) {
|
||||
// return false;
|
||||
// }
|
||||
// if (((Entity) entity).worldObj.isRemote) {
|
||||
// // TODO: WTF
|
||||
// //entity.spawnExplosionParticle();
|
||||
//
|
||||
// return false;
|
||||
// }
|
||||
// final EnumGolemType md = ((EntityGolemBase) entity).golemType;
|
||||
// final String deco = ((EntityGolemBase) entity).decoration;
|
||||
// final ItemStack dropped = new ItemStack(ConfigItems.itemGolemPlacer, 1, 0);
|
||||
// if (deco.length() > 0) {
|
||||
// dropped.setTagInfo("deco", (NBTBase) new NBTTagString(deco));
|
||||
// }
|
||||
// if (entity instanceof EntityGolemClay) {
|
||||
// dropped.setItemDamage(md + 16);
|
||||
// } else if (entity instanceof EntityGolemWood) {
|
||||
// dropped.setItemDamage(md);
|
||||
// } else if (entity instanceof EntityGolemStone) {
|
||||
// dropped.setItemDamage(md + 32);
|
||||
// } else if (entity instanceof EntityGolemTallow) {
|
||||
// dropped.setItemDamage(md + 48);
|
||||
// } else if (entity instanceof EntityGolemStraw) {
|
||||
// dropped.setItemDamage(md + 64);
|
||||
// } else if (entity instanceof EntityGolemClayAdvanced) {
|
||||
// dropped.setItemDamage(md + 80);
|
||||
// } else if (entity instanceof EntityGolemStoneAdvanced) {
|
||||
// dropped.setItemDamage(md + 96);
|
||||
// } else if (entity instanceof EntityGolemIronGuardian) {
|
||||
// dropped.setItemDamage(md + 112);
|
||||
// } else if (entity instanceof EntityGolemTallowAdvanced) {
|
||||
// dropped.setItemDamage(md + 128);
|
||||
// }
|
||||
// ((EntityGolemBase) entity).entityDropItem(dropped, 0.5f);
|
||||
// ((Entity) entity)
|
||||
// .worldObj.playSoundAtEntity((Entity) entity, "thaumcraft.zap", 0.5f, 1.0f);
|
||||
// entity.setDead();
|
||||
// return true;
|
||||
//}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(
|
||||
final ItemStack itemstack,
|
||||
final EntityPlayer player,
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z,
|
||||
final int side,
|
||||
final float hitX,
|
||||
final float hitY,
|
||||
final float hitZ
|
||||
) {
|
||||
final Block bi = world.getBlock(x, y, z);
|
||||
final int md = world.getBlockMetadata(x, y, z);
|
||||
boolean result = false;
|
||||
final ForgeDirection direction = ForgeDirection.getOrientation(side);
|
||||
if (bi == ConfigBlocks.blockTable && md <= 1) {
|
||||
// TODO: don't use original workbench here or mixinate it HARD
|
||||
world.setBlock(x, y, z, bi, 15, 3);
|
||||
world.setTileEntity(x, y, z, (TileEntity) new TileArcaneWorkbench());
|
||||
final TileArcaneWorkbench tawb
|
||||
= (TileArcaneWorkbench) world.getTileEntity(x, y, z);
|
||||
if (tawb != null) {
|
||||
tawb.setInventorySlotContents(10, itemstack.copy());
|
||||
player.inventory.setInventorySlotContents(
|
||||
player.inventory.currentItem, (ItemStack) null
|
||||
);
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
world.playSoundEffect(x + 0.5, y + 0.1, z + 0.5, "random.click", 0.15f, 0.5f);
|
||||
return false;
|
||||
}
|
||||
if (bi == ConfigBlocks.blockWarded
|
||||
|| (bi == ConfigBlocks.blockCosmeticOpaque && md == 2)
|
||||
|| (bi == ConfigBlocks.blockWoodenDevice && md == 2)) {
|
||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (!Config.wardedStone
|
||||
|| (tile != null && tile instanceof TileOwned
|
||||
&& player.getDisplayName().equals(((TileOwned) tile).owner))) {
|
||||
if (!world.isRemote) {
|
||||
((TileOwned) tile).safeToRemove = true;
|
||||
world.spawnEntityInWorld((Entity) new EntityItem(
|
||||
world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(bi, 1, md)
|
||||
));
|
||||
world.playAuxSFX(
|
||||
2001, x, y, z, Block.getIdFromBlock(bi) + (md << 12)
|
||||
);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 3);
|
||||
} else {
|
||||
player.swingItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bi == ConfigBlocks.blockArcaneDoor) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (!Config.wardedStone
|
||||
|| (tile != null && tile instanceof TileOwned
|
||||
&& player.getDisplayName().equals(((TileOwned) tile).owner))) {
|
||||
if (!world.isRemote) {
|
||||
((TileOwned) tile).safeToRemove = true;
|
||||
if ((md & 0x8) == 0x0) {
|
||||
tile = world.getTileEntity(x, y + 1, z);
|
||||
} else {
|
||||
tile = world.getTileEntity(x, y - 1, z);
|
||||
}
|
||||
if (tile != null && tile instanceof TileOwned) {
|
||||
((TileOwned) tile).safeToRemove = true;
|
||||
}
|
||||
if (Config.wardedStone
|
||||
|| (!Config.wardedStone && (md & 0x8) == 0x0)) {
|
||||
world.spawnEntityInWorld((Entity) new EntityItem(
|
||||
world,
|
||||
x + 0.5,
|
||||
y + 0.5,
|
||||
z + 0.5,
|
||||
new ItemStack(ConfigItems.itemArcaneDoor)
|
||||
));
|
||||
}
|
||||
world.playAuxSFX(
|
||||
2001, x, y, z, Block.getIdFromBlock(bi) + (md << 12)
|
||||
);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 3);
|
||||
} else {
|
||||
player.swingItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bi == ConfigBlocks.blockWoodenDevice && md == 5
|
||||
&& world.isAirBlock(
|
||||
x + direction.offsetX, y + direction.offsetY, z + direction.offsetZ
|
||||
)) {
|
||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile != null && tile instanceof TileArcaneBore
|
||||
&& side
|
||||
!= ((TileArcaneBore) tile).baseOrientation.getOpposite().ordinal()) {
|
||||
((TileArcaneBore) tile).setOrientation(direction, false);
|
||||
((Entity) player)
|
||||
.worldObj.playSound(
|
||||
x + 0.5,
|
||||
y + 0.5,
|
||||
z + 0.5,
|
||||
"thaumcraft:tool",
|
||||
0.5f,
|
||||
0.9f + ((Entity) player).worldObj.rand.nextFloat() * 0.2f,
|
||||
false
|
||||
);
|
||||
player.swingItem();
|
||||
}
|
||||
}
|
||||
if (bi == ConfigBlocks.blockWoodenDevice && md == 4 && side > 1) {
|
||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile != null && tile instanceof TileArcaneBoreBase) {
|
||||
((TileArcaneBoreBase) tile).orientation = direction;
|
||||
((Entity) player)
|
||||
.worldObj.playSound(
|
||||
x + 0.5,
|
||||
y + 0.5,
|
||||
z + 0.5,
|
||||
"thaumcraft:tool",
|
||||
0.5f,
|
||||
0.9f + ((Entity) player).worldObj.rand.nextFloat() * 0.2f,
|
||||
false
|
||||
);
|
||||
player.swingItem();
|
||||
}
|
||||
}
|
||||
if (bi == Blocks.bookshelf) {
|
||||
// TODO: wrong WandManager, this is gonna throw a CCE
|
||||
result = WandManager.createThaumonomicon(itemstack, player, world, x, y, z);
|
||||
}
|
||||
if (bi == Blocks.cauldron) {
|
||||
// TODO: same here
|
||||
result = WandManager.createCrucible(itemstack, player, world, x, y, z);
|
||||
}
|
||||
if ((bi == Blocks.obsidian || bi == Blocks.nether_brick || bi == Blocks.iron_bars)
|
||||
&& ResearchManager.isResearchComplete(
|
||||
player.getDisplayName(), "INFERNALFURNACE"
|
||||
)) {
|
||||
// TODO: you get the point
|
||||
result = WandManager.createArcaneFurnace(itemstack, player, world, x, y, z);
|
||||
}
|
||||
// TODO: WTF
|
||||
//if ((bi == ConfigBlocks.blockCosmeticSolid || bi == ConfigBlocks.blockCrystal)
|
||||
// && ResearchManager.isResearchComplete(
|
||||
// player.getDisplayName(), "CRYSTALCORE"
|
||||
// )) {
|
||||
// result = WandManager.createNodeMagnet(itemstack, player, world, x, y, z);
|
||||
//}
|
||||
|
||||
// TODO: implement infusion workbench
|
||||
//if (bi == ConfigBlocks.blockInfusionWorkbench
|
||||
// && ResearchManager.isResearchComplete(player.getDisplayName(), "MAGBLOCK"))
|
||||
// { result
|
||||
// = WandManager.createInfusionWorkbench(itemstack, player, world, x, y,
|
||||
// z);
|
||||
//}
|
||||
|
||||
// TODO: need alembics for this
|
||||
//if (bi == ConfigBlocks.blockMetalDevice && md >= 1 && md <= 4) {
|
||||
// if (player.isSneaking()) {
|
||||
// final TileEntity tile = world.getTileEntity(x, y, z);
|
||||
// if (tile != null && tile instanceof TileAlembic) {
|
||||
// player.swingItem();
|
||||
// if (world.isRemote) {
|
||||
// world.playSound(
|
||||
// (double) x,
|
||||
// (double) y,
|
||||
// (double) z,
|
||||
// "thaumcraft.bubble",
|
||||
// 0.2f,
|
||||
// 1.0f + world.rand.nextFloat() * 0.4f,
|
||||
// false
|
||||
// );
|
||||
// world.addBlockEvent(
|
||||
// tile.xCoord,
|
||||
// tile.yCoord,
|
||||
// tile.zCoord,
|
||||
// ConfigBlocks.blockMetalDevice,
|
||||
// 0,
|
||||
// -1
|
||||
// );
|
||||
// return false;
|
||||
// }
|
||||
// ((TileAlembic) tile).spillRemnants();
|
||||
// }
|
||||
// } else {
|
||||
// // TODO: WTF
|
||||
// //result = WandManager.refillCrucible(itemstack, player, world, x, y,
|
||||
// z);
|
||||
// }
|
||||
//}
|
||||
|
||||
if (bi == ConfigBlocks.blockMetalDevice && md == 0) {
|
||||
if (world.isRemote) {
|
||||
return false;
|
||||
}
|
||||
final TileCrucible tile2 = (TileCrucible) world.getTileEntity(x, y, z);
|
||||
if (player.isSneaking()) {
|
||||
tile2.spillRemnants();
|
||||
return true;
|
||||
}
|
||||
// TODO: worry about this when tilera implements the other recipe handler
|
||||
// thingy
|
||||
//if (WandManager.spendCharge(
|
||||
// world,
|
||||
// itemstack,
|
||||
// player,
|
||||
// ThaumcraftCraftingManager.getCrucibleOutputCost(tile2)
|
||||
// )) {
|
||||
// ThaumcraftCraftingManager.performCrucibleCrafting(
|
||||
// world, player, tile2
|
||||
// );
|
||||
// return true;
|
||||
//}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package dev.tilera.classiccasting.items.wands;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class ItemWandCastingAdept extends ItemWandCasting {
|
||||
public IIcon icon;
|
||||
|
||||
public ItemWandCastingAdept() {
|
||||
super();
|
||||
super.maxStackSize = 1;
|
||||
super.canRepair = false;
|
||||
this.setUnlocalizedName("classiccasting:wandCastingAdept");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister ir) {
|
||||
this.icon = ir.registerIcon("classiccasting:wandadept");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(final int par1) {
|
||||
return this.icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(final ItemStack itemstack) {
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxVis(ItemStack i) {
|
||||
return 250;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRechargeInterval() {
|
||||
return 7;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package dev.tilera.classiccasting.items.wands;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemWandCastingApprentice extends ItemWandCasting
|
||||
{
|
||||
public IIcon icon;
|
||||
|
||||
public ItemWandCastingApprentice() {
|
||||
super();
|
||||
super.maxStackSize = 1;
|
||||
super.canRepair = false;
|
||||
this.setUnlocalizedName("classiccasting:wandCastingApprentice");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister ir) {
|
||||
this.icon = ir.registerIcon("classiccasting:wandapprentice");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(final int par1) {
|
||||
return this.icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxVis(ItemStack i) {
|
||||
return 50;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(final ItemStack itemstack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRechargeInterval() {
|
||||
return 10;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package dev.tilera.classiccasting.items.wands;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class ItemWandCastingMage extends ItemWandCasting {
|
||||
public IIcon icon;
|
||||
|
||||
public ItemWandCastingMage() {
|
||||
super();
|
||||
super.maxStackSize = 1;
|
||||
super.canRepair = false;
|
||||
this.setUnlocalizedName("classiccasting:wandCastingMage");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister ir) {
|
||||
this.icon = ir.registerIcon("classiccasting:wandthaumaturge");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(final int par1) {
|
||||
return this.icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(final ItemStack itemstack) {
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxVis(ItemStack i) {
|
||||
return 1000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRechargeInterval() {
|
||||
return 5;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,326 @@
|
|||
package dev.tilera.classiccasting.items.wands;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dev.tilera.auracore.aura.AuraManager;
|
||||
import dev.tilera.classiccasting.Utils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
|
||||
public class ItemWandExcavation extends ItemWandBasic {
|
||||
public IIcon icon;
|
||||
static HashMap<String, Long> soundDelay;
|
||||
static HashMap<String, Object> beam;
|
||||
static HashMap<String, Float> breakcount;
|
||||
static HashMap<String, Integer> lastX;
|
||||
static HashMap<String, Integer> lastY;
|
||||
static HashMap<String, Integer> lastZ;
|
||||
static HashMap<String, Integer> mined;
|
||||
|
||||
public ItemWandExcavation() {
|
||||
super();
|
||||
this.setMaxDamage(2000);
|
||||
this.setUnlocalizedName("classiccasting:wandExcavation");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister ir) {
|
||||
this.icon = ir.registerIcon("classiccasting:wandexcavation");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(final int par1) {
|
||||
return this.icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration(final ItemStack itemstack) {
|
||||
return 50;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(
|
||||
final ItemStack is,
|
||||
final World w,
|
||||
final Entity e,
|
||||
final int par4,
|
||||
final boolean par5
|
||||
) {
|
||||
if (!this.canCharge(is)) {
|
||||
return;
|
||||
}
|
||||
if (!w.isRemote && e.ticksExisted % 50 == 0 && is.getItemDamage() > 0
|
||||
&& AuraManager.decreaseClosestAura(w, e.posX, e.posY, e.posZ, 1)) {
|
||||
is.damageItem(-5, (EntityLiving) e);
|
||||
if (is.getItemDamage() < 0) {
|
||||
is.setItemDamage(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack
|
||||
onItemRightClick(final ItemStack itemstack, final World world, final EntityPlayer p) {
|
||||
String pp = "R" + p.getDisplayName();
|
||||
if (!((Entity) p).worldObj.isRemote) {
|
||||
pp = "S" + p.getDisplayName();
|
||||
}
|
||||
if (ItemWandExcavation.mined.get(pp) == null) {
|
||||
ItemWandExcavation.mined.put(pp, 0);
|
||||
}
|
||||
if (!((Entity) p).worldObj.isRemote && ItemWandExcavation.mined.get(pp) != null
|
||||
&& ItemWandExcavation.mined.get(pp) > 0 && !p.isUsingItem()) {
|
||||
if (ItemWandExcavation.mined.get(pp)
|
||||
> itemstack.getMaxDamage() - itemstack.getItemDamage()) {
|
||||
ItemWandExcavation.mined.put(
|
||||
pp, itemstack.getMaxDamage() - itemstack.getItemDamage() + 1
|
||||
);
|
||||
}
|
||||
this.damageWand(itemstack, p, ItemWandExcavation.mined.get(pp));
|
||||
p.inventoryContainer.detectAndSendChanges();
|
||||
ItemWandExcavation.mined.put(pp, 0);
|
||||
}
|
||||
p.setItemInUse(itemstack, this.getMaxItemUseDuration(itemstack));
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void
|
||||
onUsingTick(final ItemStack stack, final EntityPlayer p, final int count) {
|
||||
String pp = "R" + p.getDisplayName();
|
||||
if (!((Entity) p).worldObj.isRemote) {
|
||||
pp = "S" + p.getDisplayName();
|
||||
}
|
||||
if (ItemWandExcavation.mined.get(pp) == null) {
|
||||
ItemWandExcavation.mined.put(pp, 0);
|
||||
}
|
||||
if (ItemWandExcavation.soundDelay.get(pp) == null) {
|
||||
ItemWandExcavation.soundDelay.put(pp, 0L);
|
||||
}
|
||||
if (ItemWandExcavation.breakcount.get(pp) == null) {
|
||||
ItemWandExcavation.breakcount.put(pp, 0.0f);
|
||||
}
|
||||
if (ItemWandExcavation.lastX.get(pp) == null) {
|
||||
ItemWandExcavation.lastX.put(pp, 0);
|
||||
}
|
||||
if (ItemWandExcavation.lastY.get(pp) == null) {
|
||||
ItemWandExcavation.lastY.put(pp, 0);
|
||||
}
|
||||
if (ItemWandExcavation.lastZ.get(pp) == null) {
|
||||
ItemWandExcavation.lastZ.put(pp, 0);
|
||||
}
|
||||
final MovingObjectPosition mop
|
||||
= Utils.getTargetBlock(((Entity) p).worldObj, p, false);
|
||||
final Vec3 v = p.getLookVec();
|
||||
double tx = ((Entity) p).posX + v.xCoord * 10.0;
|
||||
double ty = ((Entity) p).posY + v.yCoord * 10.0;
|
||||
double tz = ((Entity) p).posZ + v.zCoord * 10.0;
|
||||
int impact = 0;
|
||||
if (mop != null) {
|
||||
tx = mop.hitVec.xCoord;
|
||||
ty = mop.hitVec.yCoord;
|
||||
tz = mop.hitVec.zCoord;
|
||||
impact = 5;
|
||||
if (!((Entity) p).worldObj.isRemote
|
||||
&& ItemWandExcavation.soundDelay.get(pp) < System.currentTimeMillis()) {
|
||||
((Entity) p)
|
||||
.worldObj.playSoundEffect(
|
||||
tx, ty, tz, "thaumcraft:rumble", 0.3f, 1.0f
|
||||
);
|
||||
ItemWandExcavation.soundDelay.put(pp, System.currentTimeMillis() + 1200L);
|
||||
}
|
||||
} else {
|
||||
ItemWandExcavation.soundDelay.put(pp, 0L);
|
||||
}
|
||||
if (((Entity) p).worldObj.isRemote) {
|
||||
ItemWandExcavation.beam.put(
|
||||
pp,
|
||||
Thaumcraft.proxy.beamCont(
|
||||
((Entity) p).worldObj,
|
||||
p,
|
||||
tx,
|
||||
ty,
|
||||
tz,
|
||||
2,
|
||||
65382,
|
||||
false,
|
||||
(impact > 0) ? 2.0f : 0.0f,
|
||||
ItemWandExcavation.beam.get(pp),
|
||||
impact
|
||||
)
|
||||
);
|
||||
}
|
||||
if (mop != null && mop.typeOfHit == MovingObjectType.BLOCK) {
|
||||
final Block bi
|
||||
= ((Entity) p).worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ);
|
||||
final int md
|
||||
= ((Entity) p)
|
||||
.worldObj.getBlockMetadata(mop.blockX, mop.blockY, mop.blockZ);
|
||||
final float hardness
|
||||
= bi.getBlockHardness(
|
||||
((Entity) p).worldObj, mop.blockX, mop.blockY, mop.blockZ
|
||||
)
|
||||
/ bi.getPlayerRelativeBlockHardness(
|
||||
p, ((Entity) p).worldObj, mop.blockX, mop.blockY, mop.blockZ
|
||||
)
|
||||
/ 100.0f;
|
||||
if (hardness >= 0.0f) {
|
||||
final int pot = this.getPotency(stack);
|
||||
float speed = 0.1f + pot * 0.1f;
|
||||
if (bi.getMaterial() == Material.rock
|
||||
|| bi.getMaterial() == Material.grass
|
||||
|| bi.getMaterial() == Material.ground
|
||||
|| bi.getMaterial() == Material.sand) {
|
||||
speed = 1.0f + pot * 0.25f;
|
||||
}
|
||||
if (bi == Blocks.obsidian) {
|
||||
speed = 50.0f + pot * 5;
|
||||
}
|
||||
if (ItemWandExcavation.lastX.get(pp) == mop.blockX
|
||||
&& ItemWandExcavation.lastY.get(pp) == mop.blockY
|
||||
&& ItemWandExcavation.lastZ.get(pp) == mop.blockZ) {
|
||||
final float bc = ItemWandExcavation.breakcount.get(pp);
|
||||
if (((Entity) p).worldObj.isRemote && bc > 0.0f && bi != Blocks.air) {
|
||||
final int progress = (int) (bc / hardness * 9.0f);
|
||||
Thaumcraft.proxy.excavateFX(
|
||||
mop.blockX,
|
||||
mop.blockY,
|
||||
mop.blockZ,
|
||||
p,
|
||||
Block.getIdFromBlock(bi),
|
||||
md,
|
||||
progress
|
||||
);
|
||||
}
|
||||
if (((Entity) p).worldObj.isRemote) {
|
||||
if (bc >= hardness) {
|
||||
((Entity) p)
|
||||
.worldObj.playAuxSFX(
|
||||
2001,
|
||||
mop.blockX,
|
||||
mop.blockY,
|
||||
mop.blockZ,
|
||||
Block.getIdFromBlock(bi) + (md << 12)
|
||||
);
|
||||
ItemWandExcavation.breakcount.put(pp, 0.0f);
|
||||
} else {
|
||||
ItemWandExcavation.breakcount.put(pp, bc + speed);
|
||||
}
|
||||
} else if (bc >= hardness) {
|
||||
final int fortune
|
||||
= ((ItemWandExcavation) stack.getItem()).getTreasure(stack);
|
||||
bi.dropBlockAsItem(
|
||||
((Entity) p).worldObj,
|
||||
mop.blockX,
|
||||
mop.blockY,
|
||||
mop.blockZ,
|
||||
md,
|
||||
fortune
|
||||
);
|
||||
((Entity) p)
|
||||
.worldObj.setBlock(
|
||||
mop.blockX, mop.blockY, mop.blockZ, Blocks.air, 0, 3
|
||||
);
|
||||
ItemWandExcavation.lastX.put(pp, Integer.MAX_VALUE);
|
||||
ItemWandExcavation.lastY.put(pp, Integer.MAX_VALUE);
|
||||
ItemWandExcavation.lastZ.put(pp, Integer.MAX_VALUE);
|
||||
ItemWandExcavation.breakcount.put(pp, 0.0f);
|
||||
ItemWandExcavation.mined.put(
|
||||
pp, ItemWandExcavation.mined.get(pp) + 1
|
||||
);
|
||||
} else {
|
||||
ItemWandExcavation.breakcount.put(pp, bc + speed);
|
||||
}
|
||||
} else {
|
||||
ItemWandExcavation.lastX.put(pp, mop.blockX);
|
||||
ItemWandExcavation.lastY.put(pp, mop.blockY);
|
||||
ItemWandExcavation.lastZ.put(pp, mop.blockZ);
|
||||
ItemWandExcavation.breakcount.put(pp, 0.0f);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ItemWandExcavation.lastX.put(pp, Integer.MAX_VALUE);
|
||||
ItemWandExcavation.lastY.put(pp, Integer.MAX_VALUE);
|
||||
ItemWandExcavation.lastZ.put(pp, Integer.MAX_VALUE);
|
||||
ItemWandExcavation.breakcount.put(pp, 0.0f);
|
||||
}
|
||||
if (ItemWandExcavation.mined.get(pp)
|
||||
> stack.getMaxDamage() - stack.getItemDamage()) {
|
||||
p.stopUsingItem();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerStoppedUsing(
|
||||
final ItemStack stack, final World world, final EntityPlayer p, final int count
|
||||
) {
|
||||
String pp = "R" + p.getDisplayName();
|
||||
if (!((Entity) p).worldObj.isRemote) {
|
||||
pp = "S" + p.getDisplayName();
|
||||
}
|
||||
if (ItemWandExcavation.mined.get(pp) == null) {
|
||||
ItemWandExcavation.mined.put(pp, 0);
|
||||
}
|
||||
if (ItemWandExcavation.soundDelay.get(pp) == null) {
|
||||
ItemWandExcavation.soundDelay.put(pp, 0L);
|
||||
}
|
||||
if (ItemWandExcavation.breakcount.get(pp) == null) {
|
||||
ItemWandExcavation.breakcount.put(pp, 0.0f);
|
||||
}
|
||||
if (ItemWandExcavation.lastX.get(pp) == null) {
|
||||
ItemWandExcavation.lastX.put(pp, 0);
|
||||
}
|
||||
if (ItemWandExcavation.lastY.get(pp) == null) {
|
||||
ItemWandExcavation.lastY.put(pp, 0);
|
||||
}
|
||||
if (ItemWandExcavation.lastZ.get(pp) == null) {
|
||||
ItemWandExcavation.lastZ.put(pp, 0);
|
||||
}
|
||||
if (ItemWandExcavation.mined.get(pp)
|
||||
> stack.getMaxDamage() - stack.getItemDamage()) {
|
||||
ItemWandExcavation.mined.put(
|
||||
pp, stack.getMaxDamage() - stack.getItemDamage() + 1
|
||||
);
|
||||
}
|
||||
this.damageWand(stack, p, ItemWandExcavation.mined.get(pp));
|
||||
p.inventoryContainer.detectAndSendChanges();
|
||||
ItemWandExcavation.beam.put(pp, null);
|
||||
ItemWandExcavation.lastX.put(pp, Integer.MAX_VALUE);
|
||||
ItemWandExcavation.lastY.put(pp, Integer.MAX_VALUE);
|
||||
ItemWandExcavation.lastZ.put(pp, Integer.MAX_VALUE);
|
||||
ItemWandExcavation.breakcount.put(pp, 0.0f);
|
||||
ItemWandExcavation.mined.put(pp, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction(final ItemStack itemstack) {
|
||||
return EnumAction.bow;
|
||||
}
|
||||
|
||||
static {
|
||||
ItemWandExcavation.soundDelay = new HashMap<>();
|
||||
ItemWandExcavation.beam = new HashMap<>();
|
||||
ItemWandExcavation.breakcount = new HashMap<>();
|
||||
ItemWandExcavation.lastX = new HashMap<>();
|
||||
ItemWandExcavation.lastY = new HashMap<>();
|
||||
ItemWandExcavation.lastZ = new HashMap<>();
|
||||
ItemWandExcavation.mined = new HashMap<>();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,211 @@
|
|||
package dev.tilera.classiccasting.items.wands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dev.tilera.auracore.aura.AuraManager;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EntityDamageSource;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.client.lib.UtilsFX;
|
||||
|
||||
public class ItemWandFire extends ItemWandBasic {
|
||||
public IIcon icon;
|
||||
long soundDelay;
|
||||
private int chargecount;
|
||||
|
||||
public ItemWandFire() {
|
||||
super();
|
||||
this.soundDelay = 0L;
|
||||
this.chargecount = 0;
|
||||
this.setMaxDamage(2000);
|
||||
this.setUnlocalizedName("classiccasting:wandFire");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister ir) {
|
||||
this.icon = ir.registerIcon("classiccasting:wandfire");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(final int par1) {
|
||||
return this.icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration(final ItemStack itemstack) {
|
||||
return 50;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(
|
||||
final ItemStack is,
|
||||
final World w,
|
||||
final Entity e,
|
||||
final int par4,
|
||||
final boolean par5
|
||||
) {
|
||||
if (!this.canCharge(is)) {
|
||||
return;
|
||||
}
|
||||
if (!w.isRemote && e.ticksExisted % 50 == 0 && is.getItemDamage() > 0
|
||||
&& AuraManager.decreaseClosestAura(w, e.posX, e.posY, e.posZ, 1)) {
|
||||
is.damageItem(-5, (EntityLiving) e);
|
||||
if (is.getItemDamage() < 0) {
|
||||
is.setItemDamage(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack
|
||||
onItemRightClick(final ItemStack itemstack, final World world, final EntityPlayer p) {
|
||||
if (!((Entity) p).worldObj.isRemote && this.chargecount > 0 && !p.isUsingItem()) {
|
||||
if (this.chargecount > itemstack.getMaxDamage() - itemstack.getItemDamage()) {
|
||||
this.chargecount
|
||||
= itemstack.getMaxDamage() - itemstack.getItemDamage() + 1;
|
||||
}
|
||||
this.damageWand(itemstack, p, this.chargecount);
|
||||
p.inventoryContainer.detectAndSendChanges();
|
||||
this.chargecount = 0;
|
||||
}
|
||||
p.setItemInUse(itemstack, this.getMaxItemUseDuration(itemstack));
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void
|
||||
onUsingTick(final ItemStack stack, final EntityPlayer p, final int count) {
|
||||
final int range = 17;
|
||||
final Vec3 vec3d = p.getLook((float) range);
|
||||
if (!((Entity) p).worldObj.isRemote
|
||||
&& this.soundDelay < System.currentTimeMillis()) {
|
||||
((Entity) p)
|
||||
.worldObj.playSoundAtEntity(
|
||||
(Entity) p, "thaumcraft:fireloop", 0.25f, 1.0f
|
||||
);
|
||||
this.soundDelay = System.currentTimeMillis() + 500L;
|
||||
}
|
||||
if (((Entity) p).worldObj.isRemote) {
|
||||
UtilsFX.shootFire(((Entity) p).worldObj, p, true, range, false);
|
||||
} else {
|
||||
++this.chargecount;
|
||||
this.getTargets(stack, ((Entity) p).worldObj, vec3d, p, range);
|
||||
}
|
||||
final int charges = this.getMaxItemUseDuration(stack) - count;
|
||||
if (charges > stack.getMaxDamage() - stack.getItemDamage()) {
|
||||
p.stopUsingItem();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerStoppedUsing(
|
||||
final ItemStack stack,
|
||||
final World world,
|
||||
final EntityPlayer player,
|
||||
final int count
|
||||
) {
|
||||
this.chargecount = 0;
|
||||
int charges = this.getMaxItemUseDuration(stack) - count;
|
||||
if (charges > stack.getMaxDamage() - stack.getItemDamage()) {
|
||||
charges = stack.getMaxDamage() - stack.getItemDamage() + 1;
|
||||
}
|
||||
this.damageWand(stack, player, this.chargecount);
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(
|
||||
final ItemStack par1ItemStack,
|
||||
final EntityLivingBase target,
|
||||
final EntityLivingBase player
|
||||
) {
|
||||
if (!((Entity) player).worldObj.isRemote) {
|
||||
if (target instanceof EntityPlayer
|
||||
&& !MinecraftServer.getServer().isPVPEnabled()) {
|
||||
return true;
|
||||
}
|
||||
target.setFire(5);
|
||||
this.damageWand(par1ItemStack, (EntityPlayer) player, 1);
|
||||
((Entity) target)
|
||||
.worldObj.playSoundEffect(
|
||||
((Entity) target).posX,
|
||||
((Entity) target).posY,
|
||||
((Entity) target).posZ,
|
||||
"random.fizz",
|
||||
1.0f,
|
||||
Item.itemRand.nextFloat() * 0.4f + 0.8f
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void getTargets(
|
||||
final ItemStack itemstack,
|
||||
final World world,
|
||||
final Vec3 tvec,
|
||||
final EntityPlayer p,
|
||||
final double range
|
||||
) {
|
||||
Entity pointedEntity = null;
|
||||
final Vec3 vec3d = Vec3.createVectorHelper(
|
||||
((Entity) p).posX, ((Entity) p).posY, ((Entity) p).posZ
|
||||
);
|
||||
final Vec3 vec3d2 = vec3d.addVector(
|
||||
tvec.xCoord * range, tvec.yCoord * range, tvec.zCoord * range
|
||||
);
|
||||
final float f1 = 1.0f;
|
||||
final List<Entity> list = world.getEntitiesWithinAABBExcludingEntity(
|
||||
(Entity) p,
|
||||
((Entity) p)
|
||||
.boundingBox
|
||||
.addCoord(tvec.xCoord * range, tvec.yCoord * range, tvec.zCoord * range)
|
||||
.expand((double) f1, (double) f1, (double) f1)
|
||||
);
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
final Entity entity = list.get(i);
|
||||
if (entity.canBeCollidedWith()) {
|
||||
final float f2 = Math.max(1.0f, entity.getCollisionBorderSize());
|
||||
final AxisAlignedBB axisalignedbb = entity.boundingBox.expand(
|
||||
(double) f2, (double) (f2 * 1.25f), (double) f2
|
||||
);
|
||||
final MovingObjectPosition movingobjectposition
|
||||
= axisalignedbb.calculateIntercept(vec3d, vec3d2);
|
||||
if (movingobjectposition != null) {
|
||||
pointedEntity = entity;
|
||||
if (pointedEntity != null && p.canEntityBeSeen(pointedEntity)
|
||||
&& !pointedEntity.isImmuneToFire()
|
||||
&& (!(pointedEntity instanceof EntityPlayer)
|
||||
|| MinecraftServer.getServer().isPVPEnabled())) {
|
||||
pointedEntity.setFire(4 + this.getPotency(itemstack));
|
||||
pointedEntity.attackEntityFrom(
|
||||
(DamageSource) new EntityDamageSource("inFire", (Entity) p),
|
||||
2 + this.getPotency(itemstack)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction(final ItemStack itemstack) {
|
||||
return EnumAction.bow;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package dev.tilera.classiccasting.items.wands;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dev.tilera.auracore.aura.AuraManager;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.common.entities.projectile.EntityFrostShard;
|
||||
|
||||
public class ItemWandFrost extends ItemWandBasic {
|
||||
public IIcon icon;
|
||||
|
||||
public ItemWandFrost() {
|
||||
super();
|
||||
this.setMaxDamage(2000);
|
||||
this.setUnlocalizedName("classiccasting:wandFrost");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister ir) {
|
||||
this.icon = ir.registerIcon("classiccasting:wandfrost");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(final int par1) {
|
||||
return this.icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(
|
||||
final ItemStack is,
|
||||
final World w,
|
||||
final Entity e,
|
||||
final int par4,
|
||||
final boolean par5
|
||||
) {
|
||||
if (!this.canCharge(is)) {
|
||||
return;
|
||||
}
|
||||
if (!w.isRemote && e.ticksExisted % 50 == 0 && is.getItemDamage() > 0
|
||||
&& AuraManager.decreaseClosestAura(w, e.posX, e.posY, e.posZ, 1)) {
|
||||
is.damageItem(-5, (EntityLiving) e);
|
||||
if (is.getItemDamage() < 0) {
|
||||
is.setItemDamage(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack
|
||||
onItemRightClick(final ItemStack itemstack, final World world, final EntityPlayer p) {
|
||||
final EntityFrostShard shard
|
||||
= new EntityFrostShard(world, p, 1.0f + this.getPotency(itemstack) / 2.0f);
|
||||
if (!world.isRemote && world.spawnEntityInWorld((Entity) shard)) {
|
||||
this.damageWand(itemstack, p, 1);
|
||||
}
|
||||
world.playSoundAtEntity(
|
||||
(Entity) p, "thaumcraft:ice", 0.4f, 1.0f + world.rand.nextFloat() * 0.1f
|
||||
);
|
||||
p.swingItem();
|
||||
return itemstack;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,268 @@
|
|||
package dev.tilera.classiccasting.items.wands;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dev.tilera.auracore.aura.AuraManager;
|
||||
import dev.tilera.classiccasting.Utils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.client.fx.bolt.FXLightningBolt;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
|
||||
public class ItemWandLightning extends ItemWandBasic {
|
||||
public IIcon icon;
|
||||
long soundDelay;
|
||||
private int chargecount;
|
||||
|
||||
public ItemWandLightning() {
|
||||
super();
|
||||
this.soundDelay = 0L;
|
||||
this.chargecount = 0;
|
||||
this.setMaxStackSize(1);
|
||||
this.setMaxDamage(2000);
|
||||
this.setUnlocalizedName("classiccasting:wandLightning");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister ir) {
|
||||
this.icon = ir.registerIcon("classiccasting:wandlightning");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(final int par1) {
|
||||
return this.icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(
|
||||
final ItemStack is,
|
||||
final World w,
|
||||
final Entity e,
|
||||
final int par4,
|
||||
final boolean par5
|
||||
) {
|
||||
if (!this.canCharge(is)) {
|
||||
return;
|
||||
}
|
||||
if (!w.isRemote && e.ticksExisted % 50 == 0 && is.getItemDamage() > 0
|
||||
&& AuraManager.decreaseClosestAura(w, e.posX, e.posY, e.posZ, 1)) {
|
||||
is.damageItem(-5, (EntityLiving) e);
|
||||
if (is.getItemDamage() < 0) {
|
||||
is.setItemDamage(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void shootLightning(
|
||||
final World world,
|
||||
final EntityLivingBase entityplayer,
|
||||
final double xx,
|
||||
final double yy,
|
||||
final double zz,
|
||||
final boolean offset
|
||||
) {
|
||||
double px = ((Entity) entityplayer).posX;
|
||||
double py = ((Entity) entityplayer).posY;
|
||||
double pz = ((Entity) entityplayer).posZ;
|
||||
if (entityplayer.getEntityId()
|
||||
!= Minecraft.getMinecraft().thePlayer.getEntityId()) {
|
||||
py = ((Entity) entityplayer).boundingBox.minY
|
||||
+ ((Entity) entityplayer).height / 2.0f + 0.25;
|
||||
}
|
||||
px -= MathHelper.cos(((Entity) entityplayer).rotationYaw / 180.0f * 3.141593f)
|
||||
* 0.16f;
|
||||
py -= 0.05000000014901161;
|
||||
pz -= MathHelper.sin(((Entity) entityplayer).rotationYaw / 180.0f * 3.141593f)
|
||||
* 0.16f;
|
||||
final Vec3 vec3d = entityplayer.getLook(1.0f);
|
||||
px += vec3d.xCoord * 0.25;
|
||||
py += vec3d.yCoord * 0.25;
|
||||
pz += vec3d.zCoord * 0.25;
|
||||
final FXLightningBolt bolt = new FXLightningBolt(
|
||||
world, px, py, pz, xx, yy, zz, world.rand.nextLong(), 6, 0.5f, 5
|
||||
);
|
||||
bolt.defaultFractal();
|
||||
bolt.setType(2);
|
||||
bolt.setWidth(0.125f);
|
||||
bolt.finalizeBolt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration(final ItemStack itemstack) {
|
||||
return 50;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack
|
||||
onItemRightClick(final ItemStack itemstack, final World world, final EntityPlayer p) {
|
||||
if (!((Entity) p).worldObj.isRemote && this.chargecount > 0 && !p.isUsingItem()) {
|
||||
if (this.chargecount > itemstack.getMaxDamage() - itemstack.getItemDamage()) {
|
||||
this.chargecount
|
||||
= itemstack.getMaxDamage() - itemstack.getItemDamage() + 1;
|
||||
}
|
||||
this.damageWand(itemstack, p, this.chargecount);
|
||||
p.inventoryContainer.detectAndSendChanges();
|
||||
this.chargecount = 0;
|
||||
}
|
||||
p.setItemInUse(itemstack, this.getMaxItemUseDuration(itemstack));
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void
|
||||
onUsingTick(final ItemStack stack, final EntityPlayer p, final int count) {
|
||||
final Entity pointedEntity
|
||||
= Utils.getPointedEntity(((Entity) p).worldObj, p, 20.0, 1.1f);
|
||||
boolean zapped = false;
|
||||
if (this.soundDelay < System.currentTimeMillis()) {
|
||||
if (!((Entity) p).worldObj.isRemote) {
|
||||
((Entity) p)
|
||||
.worldObj.playSoundEffect(
|
||||
((Entity) p).posX,
|
||||
((Entity) p).posY,
|
||||
((Entity) p).posZ,
|
||||
"thaumcraft:shock",
|
||||
0.25f,
|
||||
1.0f
|
||||
);
|
||||
}
|
||||
this.soundDelay = System.currentTimeMillis() + 100L;
|
||||
zapped = true;
|
||||
}
|
||||
if (((Entity) p).worldObj.isRemote) {
|
||||
if (zapped) {
|
||||
final MovingObjectPosition mop
|
||||
= Utils.getTargetBlock(((Entity) p).worldObj, p, false);
|
||||
final Vec3 v = p.getLook(2.0f);
|
||||
double px = ((Entity) p).posX + v.xCoord * 10.0;
|
||||
double py = ((Entity) p).posY + v.yCoord * 10.0;
|
||||
double pz = ((Entity) p).posZ + v.zCoord * 10.0;
|
||||
if (mop != null) {
|
||||
px = mop.hitVec.xCoord;
|
||||
py = mop.hitVec.yCoord;
|
||||
pz = mop.hitVec.zCoord;
|
||||
for (int a = 0; a < 5; ++a) {
|
||||
Thaumcraft.proxy.sparkle(
|
||||
(float) px
|
||||
+ (((Entity) p).worldObj.rand.nextFloat()
|
||||
- ((Entity) p).worldObj.rand.nextFloat())
|
||||
* 0.3f,
|
||||
(float) py
|
||||
+ (((Entity) p).worldObj.rand.nextFloat()
|
||||
- ((Entity) p).worldObj.rand.nextFloat())
|
||||
* 0.3f,
|
||||
(float) pz
|
||||
+ (((Entity) p).worldObj.rand.nextFloat()
|
||||
- ((Entity) p).worldObj.rand.nextFloat())
|
||||
* 0.3f,
|
||||
2.0f + ((Entity) p).worldObj.rand.nextFloat(),
|
||||
2,
|
||||
0.05f + ((Entity) p).worldObj.rand.nextFloat() * 0.05f
|
||||
);
|
||||
}
|
||||
}
|
||||
if (pointedEntity != null) {
|
||||
px = pointedEntity.posX;
|
||||
py = pointedEntity.boundingBox.minY + pointedEntity.height / 2.0f;
|
||||
pz = pointedEntity.posZ;
|
||||
for (int a = 0; a < 5; ++a) {
|
||||
Thaumcraft.proxy.sparkle(
|
||||
(float) px
|
||||
+ (((Entity) p).worldObj.rand.nextFloat()
|
||||
- ((Entity) p).worldObj.rand.nextFloat())
|
||||
* 0.6f,
|
||||
(float) py
|
||||
+ (((Entity) p).worldObj.rand.nextFloat()
|
||||
- ((Entity) p).worldObj.rand.nextFloat())
|
||||
* 0.6f,
|
||||
(float) pz
|
||||
+ (((Entity) p).worldObj.rand.nextFloat()
|
||||
- ((Entity) p).worldObj.rand.nextFloat())
|
||||
* 0.6f,
|
||||
2.0f + ((Entity) p).worldObj.rand.nextFloat(),
|
||||
2,
|
||||
0.05f + ((Entity) p).worldObj.rand.nextFloat() * 0.05f
|
||||
);
|
||||
}
|
||||
}
|
||||
shootLightning(((Entity) p).worldObj, p, px, py, pz, true);
|
||||
}
|
||||
} else {
|
||||
if (pointedEntity != null) {
|
||||
pointedEntity.attackEntityFrom(
|
||||
DamageSource.causePlayerDamage(p), 3 + this.getPotency(stack)
|
||||
);
|
||||
if (((Entity) p)
|
||||
.worldObj.rand.nextInt(
|
||||
16 - Math.min(15, this.getPotency(stack) * 2)
|
||||
)
|
||||
== 0) {
|
||||
pointedEntity.onStruckByLightning((EntityLightningBolt) null);
|
||||
}
|
||||
}
|
||||
++this.chargecount;
|
||||
}
|
||||
final int charges = this.getMaxItemUseDuration(stack) - count;
|
||||
if (charges > stack.getMaxDamage() - stack.getItemDamage()) {
|
||||
p.stopUsingItem();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerStoppedUsing(
|
||||
final ItemStack stack,
|
||||
final World world,
|
||||
final EntityPlayer player,
|
||||
final int count
|
||||
) {
|
||||
this.chargecount = 0;
|
||||
int charges = this.getMaxItemUseDuration(stack) - count;
|
||||
if (charges > stack.getMaxDamage() - stack.getItemDamage()) {
|
||||
charges = stack.getMaxDamage() - stack.getItemDamage() + 1;
|
||||
}
|
||||
this.damageWand(stack, player, charges);
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction(final ItemStack itemstack) {
|
||||
return EnumAction.bow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(
|
||||
final ItemStack par1ItemStack,
|
||||
final EntityLivingBase target,
|
||||
final EntityLivingBase player
|
||||
) {
|
||||
target.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) player), 4);
|
||||
this.damageWand(par1ItemStack, (EntityPlayer) player, 1);
|
||||
if (!((Entity) target).worldObj.isRemote) {
|
||||
((Entity) target)
|
||||
.worldObj.playSoundEffect(
|
||||
((Entity) target).posX,
|
||||
((Entity) target).posY,
|
||||
((Entity) target).posZ,
|
||||
"thaumcraft:shock",
|
||||
0.25f,
|
||||
1.0f
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,159 @@
|
|||
package dev.tilera.classiccasting.items.wands;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dev.tilera.auracore.aura.AuraManager;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagInt;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.common.lib.events.ServerTickEventsFML;
|
||||
|
||||
public class ItemWandTrade extends ItemWandBasic {
|
||||
public IIcon icon;
|
||||
|
||||
public ItemWandTrade() {
|
||||
super();
|
||||
this.setMaxDamage(1500);
|
||||
this.setUnlocalizedName("classiccasting:wandTrade");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister ir) {
|
||||
this.icon = ir.registerIcon("classiccasting:wandtrade");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(final int par1) {
|
||||
return this.icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(
|
||||
final ItemStack is,
|
||||
final World w,
|
||||
final Entity e,
|
||||
final int par4,
|
||||
final boolean par5
|
||||
) {
|
||||
if (!this.canCharge(is)) {
|
||||
return;
|
||||
}
|
||||
if (!w.isRemote && e.ticksExisted % 50 == 0 && is.getItemDamage() > 0
|
||||
&& AuraManager.decreaseClosestAura(w, e.posX, e.posY, e.posZ, 1)) {
|
||||
is.damageItem(-4, (EntityLiving) e);
|
||||
if (is.getItemDamage() < 0) {
|
||||
is.setItemDamage(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(
|
||||
final ItemStack itemstack,
|
||||
final EntityPlayer player,
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z,
|
||||
final int side,
|
||||
final float f1,
|
||||
final float f2,
|
||||
final float f3
|
||||
) {
|
||||
if (player.isSneaking()) {
|
||||
if (!world.isRemote && world.getTileEntity(x, y, z) == null) {
|
||||
this.storePickedBlock(
|
||||
itemstack,
|
||||
world.getBlock(x, y, z),
|
||||
(short) world.getBlockMetadata(x, y, z)
|
||||
);
|
||||
return true;
|
||||
}
|
||||
player.swingItem();
|
||||
} else {
|
||||
final ItemStack pb = this.getPickedBlock(itemstack);
|
||||
if (pb != null && world.isRemote) {
|
||||
player.swingItem();
|
||||
} else if (pb != null && world.getTileEntity(x, y, z) == null) {
|
||||
ServerTickEventsFML.addSwapper(
|
||||
world,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
world.getBlock(x, y, z),
|
||||
world.getBlockMetadata(x, y, z),
|
||||
pb,
|
||||
3 + this.getPotency(itemstack),
|
||||
player,
|
||||
player.inventory.currentItem
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(final Block par1Block, ItemStack tool) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// getStrVsBlock
|
||||
@Override
|
||||
public float func_150893_a(ItemStack p_150893_1_, Block p_150893_2_) {
|
||||
return 2000.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(
|
||||
final ItemStack itemstack,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z,
|
||||
final EntityPlayer player
|
||||
) {
|
||||
final ItemStack pb = this.getPickedBlock(itemstack);
|
||||
if (pb == null || !((Entity) player).worldObj.isRemote) {
|
||||
if (pb != null && ((Entity) player).worldObj.getTileEntity(x, y, z) == null) {
|
||||
ServerTickEventsFML.addSwapper(
|
||||
((Entity) player).worldObj,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
((Entity) player).worldObj.getBlock(x, y, z),
|
||||
((Entity) player).worldObj.getBlockMetadata(x, y, z),
|
||||
pb,
|
||||
0,
|
||||
player,
|
||||
player.inventory.currentItem
|
||||
);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void storePickedBlock(final ItemStack stack, final Block bi, final short md) {
|
||||
stack.setTagInfo("blockid", (NBTBase) new NBTTagInt(Block.getIdFromBlock(bi)));
|
||||
stack.setTagInfo("blockmd", (NBTBase) new NBTTagInt(md));
|
||||
}
|
||||
|
||||
public ItemStack getPickedBlock(final ItemStack stack) {
|
||||
return (stack.hasTagCompound() && stack.stackTagCompound.hasKey("blockid")
|
||||
&& stack.stackTagCompound.hasKey("blockmd"))
|
||||
? new ItemStack(
|
||||
Block.getBlockById(stack.stackTagCompound.getInteger("blockid")),
|
||||
1,
|
||||
(int) stack.stackTagCompound.getShort("blockmd")
|
||||
)
|
||||
: null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
itemGroup.classiccasting=Classic Casting
|
||||
|
||||
item.classiccasting:portableHole.name=Portable Hole
|
||||
|
||||
item.classiccasting:wandCastingApprentice.name=Wand of the Apprentice
|
||||
item.classiccasting:wandCastingAdept.name=Wand of the Adept
|
||||
item.classiccasting:wandCastingMage.name=Wand of the Thaumaturge
|
||||
|
||||
item.classiccasting:wandExcavation.name=Wand of Excavation
|
||||
item.classiccasting:wandFire.name=Wand of Fire
|
||||
item.classiccasting:wandFrost.name=Wand of Frost
|
||||
item.classiccasting:hellrod.name=Rod of Hell
|
||||
item.classiccasting:wandLightning.name=Wand of Lightning
|
||||
item.classiccasting:wandTrade.name=Wand of Equal Trade
|
After Width: | Height: | Size: 496 B |
After Width: | Height: | Size: 762 B |
After Width: | Height: | Size: 354 B |
After Width: | Height: | Size: 227 B |
After Width: | Height: | Size: 491 B |
After Width: | Height: | Size: 483 B |
After Width: | Height: | Size: 506 B |
After Width: | Height: | Size: 494 B |
After Width: | Height: | Size: 407 B |
After Width: | Height: | Size: 519 B |