mirror of
https://github.com/GTNewHorizons/ThaumicTinkerer.git
synced 2026-11-28 16:06:07 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47f4ab43f5 | ||
|
|
d84f4c5fda | ||
|
|
00800e8611 | ||
|
|
2cc006f911 | ||
|
|
ee68f7828d | ||
|
|
971203650e | ||
|
|
b6cf110de9 | ||
|
|
815f838cc1 | ||
|
|
61b1dd17ab | ||
|
|
926444293d | ||
|
|
b604fe65fa | ||
|
|
3f4ec95e51 | ||
|
|
25a4df53e4 | ||
|
|
3cf59925bc | ||
|
|
071b1aab03 | ||
|
|
c94c33fdac | ||
|
|
d881b73ec4 | ||
|
|
fa31630cfa | ||
|
|
c01202d355 | ||
|
|
1f43d9cd50 | ||
|
|
00ddb35273 | ||
|
|
8124669363 | ||
|
|
581c781319 | ||
|
|
7b2829612d | ||
|
|
2f6467230b | ||
|
|
34705d56b7 | ||
|
|
361732dbe4 | ||
|
|
6b7fb79d45 | ||
|
|
9a726225f1 | ||
|
|
b1be5335be | ||
|
|
b9ce0a5ed3 | ||
|
|
91524232aa | ||
|
|
9592829796 | ||
|
|
383dfe0281 | ||
|
|
eb4b2cd448 | ||
|
|
1d0c7ce8b6 | ||
|
|
bef4a41c52 | ||
|
|
59f8be7793 | ||
|
|
82360f8759 | ||
|
|
514cac18fa | ||
|
|
4e01ec77ef | ||
|
|
f394e0ca2e | ||
|
|
ddbf9571a3 | ||
|
|
8620f42e6e | ||
|
|
e760da1c5f | ||
|
|
ed09496d49 | ||
|
|
78496cc716 | ||
|
|
6a5ef9f95e | ||
|
|
d2cf9aae89 | ||
|
|
6056f4fbe7 | ||
|
|
0fac4e2dca | ||
|
|
cad5c288f8 | ||
|
|
cf2e5e2a29 | ||
|
|
5e102295f3 | ||
|
|
fd7bb2e082 | ||
|
|
4eae65551e | ||
|
|
e3667a3647 | ||
|
|
e4f1d4945c | ||
|
|
7666392f7b | ||
|
|
5c0f45a8d6 | ||
|
|
92d4605c8a | ||
|
|
e0dcd6385b | ||
|
|
6e1142d82d | ||
|
|
a0b029eed3 | ||
|
|
c1c3cd063c | ||
|
|
2638fd9b07 | ||
|
|
a4d8535407 | ||
|
|
2204b303c7 | ||
|
|
afd9dccb5a | ||
|
|
f27407de6a | ||
|
|
35a2d0d1bf | ||
|
|
64fc62bdf9 | ||
|
|
f8cad6ab7a | ||
|
|
a24e36a1ee | ||
|
|
6816a371e4 | ||
|
|
bed0b7dff0 | ||
|
|
e05d9fcac3 | ||
|
|
9d29a2b96f | ||
|
|
d8a70b151c | ||
|
|
73e4bb8213 | ||
|
|
4c9f6f5e95 | ||
|
|
e339230748 | ||
|
|
6b3321d2a6 | ||
|
|
56221654f0 | ||
|
|
7bdf8998fa | ||
|
|
29a3578a68 | ||
|
|
50c164891c | ||
|
|
a4e9d78e2b | ||
|
|
58ff3ffdee | ||
|
|
f1827e3a26 | ||
|
|
ec70c130d1 | ||
|
|
e64103fc97 | ||
|
|
0960096bdb | ||
|
|
97d9af8d3a | ||
|
|
de3d9978cf | ||
|
|
2df312c46a | ||
|
|
6320c7d926 | ||
|
|
c6265980a1 | ||
|
|
2969d57f55 | ||
|
|
34a78e77ce | ||
|
|
e205562eee | ||
|
|
0adca6c6cb | ||
|
|
a97f063d1f | ||
|
|
84e9abd491 | ||
|
|
f6bfd2ff3b | ||
|
|
85c552133c | ||
|
|
c116faae74 | ||
|
|
ec3765f7f0 | ||
|
|
840c8ab497 | ||
|
|
de0636e941 | ||
|
|
774179d40e | ||
|
|
1424f6fbb4 | ||
|
|
86aeb86f91 | ||
|
|
7a005a1ae3 | ||
|
|
3aac6bc05f | ||
|
|
32e7a42406 | ||
|
|
1b71aeb790 | ||
|
|
e255521141 | ||
|
|
a9ef042830 | ||
|
|
5df0319081 | ||
|
|
09e35e1565 | ||
|
|
df96ea26c5 | ||
|
|
671c449743 | ||
|
|
6737d04706 | ||
|
|
179d6f7ae5 | ||
|
|
165e6a0d87 | ||
|
|
9269c0a26e | ||
|
|
70748fd00c | ||
|
|
507a630668 | ||
|
|
b233aaa802 | ||
|
|
9c67110655 | ||
|
|
4c39ce4fe9 | ||
|
|
5f4d434362 | ||
|
|
a42c8e80fe | ||
|
|
fdcbc88cb9 | ||
|
|
594b34f78c | ||
|
|
d130f1061c | ||
|
|
0a1bde7abb | ||
|
|
5d5e99c69e | ||
|
|
1e69128e85 | ||
|
|
dc48c45527 | ||
|
|
054022bf2c | ||
|
|
f0bf6178da | ||
|
|
8eeccc7449 | ||
|
|
40f87e628f | ||
|
|
21e26b051b | ||
|
|
740b65785b | ||
|
|
2483ec15bf | ||
|
|
141b6e5f7b | ||
|
|
af6b2d0287 | ||
|
|
24e5bbf962 | ||
|
|
f78a3141e0 | ||
|
|
7f8dc37db0 | ||
|
|
4449eea79c |
No files matched your search
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="false" context="gettercomment_context" deleted="false" description="Comment for getter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name="gettercomment"/><template autoinsert="false" context="settercomment_context" deleted="false" description="Comment for setter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.settercomment" name="settercomment"/><template autoinsert="false" context="constructorcomment_context" deleted="false" description="Comment for created constructors" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name="constructorcomment"/><template autoinsert="false" context="filecomment_context" deleted="false" description="Comment for created Java files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.filecomment" name="filecomment">/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ${project_name} Mod.
|
||||
*
|
||||
* ${project_name} is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ${project_name} is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [${date}, ${time} (GMT)]
|
||||
*/</template><template autoinsert="false" context="typecomment_context" deleted="false" description="Comment for created types" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.typecomment" name="typecomment"/><template autoinsert="false" context="fieldcomment_context" deleted="false" description="Comment for fields" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name="fieldcomment"/><template autoinsert="false" context="methodcomment_context" deleted="false" description="Comment for non-overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name="methodcomment"/><template autoinsert="false" context="overridecomment_context" deleted="false" description="Comment for overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name="overridecomment"/><template autoinsert="false" context="delegatecomment_context" deleted="false" description="Comment for delegate methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name="delegatecomment"/><template autoinsert="true" context="newtype_context" deleted="false" description="Newly created files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.newtype" name="newtype">${filecomment}
|
||||
${package_declaration}
|
||||
|
||||
${typecomment}
|
||||
${type_declaration}</template><template autoinsert="true" context="classbody_context" deleted="false" description="Code in new class type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.classbody" name="classbody">
|
||||
</template><template autoinsert="true" context="interfacebody_context" deleted="false" description="Code in new interface type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name="interfacebody">
|
||||
</template><template autoinsert="true" context="enumbody_context" deleted="false" description="Code in new enum type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.enumbody" name="enumbody">
|
||||
</template><template autoinsert="true" context="annotationbody_context" deleted="false" description="Code in new annotation type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name="annotationbody">
|
||||
</template><template autoinsert="true" context="catchblock_context" deleted="false" description="Code in new catch blocks" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.catchblock" name="catchblock">// ${todo} Auto-generated catch block
|
||||
${exception_var}.printStackTrace();</template><template autoinsert="false" context="methodbody_context" deleted="false" description="Code in created method stubs" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodbody" name="methodbody"/><template autoinsert="true" context="constructorbody_context" deleted="false" description="Code in created constructor stubs" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name="constructorbody">${body_statement}
|
||||
// ${todo} Auto-generated constructor stub</template><template autoinsert="true" context="getterbody_context" deleted="false" description="Code in created getters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.getterbody" name="getterbody">return ${field};</template><template autoinsert="true" context="setterbody_context" deleted="false" description="Code in created setters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.setterbody" name="setterbody">${field} = ${param};</template></templates>
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Copyright (c) SpaceToad, 2011
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package buildcraft.api.core;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class SafeTimeTracker {
|
||||
|
||||
private long lastMark = 0;
|
||||
|
||||
/**
|
||||
* Return true if a given delay has passed since last time marked was called successfully.
|
||||
*/
|
||||
public boolean markTimeIfDelay(World world, long delay) {
|
||||
if (world == null)
|
||||
return false;
|
||||
|
||||
long currentTime = world.getWorldTime();
|
||||
|
||||
if (currentTime < lastMark) {
|
||||
lastMark = currentTime;
|
||||
return false;
|
||||
} else if (lastMark + delay <= currentTime) {
|
||||
lastMark = world.getWorldTime();
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public void markTime(World world) {
|
||||
lastMark = world.getWorldTime();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package buildcraft.api.power;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import buildcraft.api.core.SafeTimeTracker;
|
||||
|
||||
public interface IPowerProvider {
|
||||
|
||||
int getLatency();
|
||||
|
||||
int getMinEnergyReceived();
|
||||
|
||||
int getMaxEnergyReceived();
|
||||
|
||||
int getMaxEnergyStored();
|
||||
|
||||
int getActivationEnergy();
|
||||
|
||||
float getEnergyStored();
|
||||
|
||||
void configure(int latency, int minEnergyReceived, int maxEnergyReceived, int minActivationEnergy, int maxStoredEnergy);
|
||||
|
||||
void configurePowerPerdition(int powerLoss, int powerLossRegularity);
|
||||
|
||||
boolean update(IPowerReceptor receptor);
|
||||
|
||||
boolean preConditions(IPowerReceptor receptor);
|
||||
|
||||
float useEnergy(float min, float max, boolean doUse);
|
||||
|
||||
void readFromNBT(NBTTagCompound nbttagcompound);
|
||||
|
||||
void writeToNBT(NBTTagCompound nbttagcompound);
|
||||
|
||||
void receiveEnergy(float quantity, ForgeDirection from);
|
||||
|
||||
boolean isPowerSource(ForgeDirection from);
|
||||
|
||||
SafeTimeTracker getTimeTracker();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
|
||||
* 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.power;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public interface IPowerReceptor {
|
||||
|
||||
public void setPowerProvider(IPowerProvider provider);
|
||||
|
||||
public IPowerProvider getPowerProvider();
|
||||
|
||||
public void doWork();
|
||||
|
||||
/**
|
||||
* Used to request power from pipes. The return cannot be relied on to be
|
||||
* anything more than a approximate guide to the power needed. When
|
||||
* transferring power, you much check the return value of
|
||||
* PowerProvider.receiverEnergy().
|
||||
*
|
||||
* @param from
|
||||
* @return
|
||||
*/
|
||||
public int powerRequest(ForgeDirection from);
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* Copyright (c) SpaceToad, 2011
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package buildcraft.api.power;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public abstract class PowerFramework {
|
||||
|
||||
static private String baseNBTName = "net.minecraft.src.buildcarft.Power";
|
||||
|
||||
public static PowerFramework currentFramework;
|
||||
|
||||
public abstract IPowerProvider createPowerProvider();
|
||||
|
||||
public void loadPowerProvider(IPowerReceptor receptor, NBTTagCompound compound) {
|
||||
|
||||
IPowerProvider provider = createPowerProvider();
|
||||
|
||||
if (compound.hasKey(baseNBTName)) {
|
||||
NBTTagCompound cpt = compound.getCompoundTag(baseNBTName);
|
||||
if (cpt.getString("class").equals(this.getClass().getName())) {
|
||||
provider.readFromNBT(cpt.getCompoundTag("contents"));
|
||||
}
|
||||
}
|
||||
|
||||
receptor.setPowerProvider(provider);
|
||||
}
|
||||
|
||||
public void savePowerProvider(IPowerReceptor receptor, NBTTagCompound compound) {
|
||||
|
||||
IPowerProvider provider = receptor.getPowerProvider();
|
||||
|
||||
if (provider == null)
|
||||
return;
|
||||
|
||||
NBTTagCompound cpt = new NBTTagCompound();
|
||||
|
||||
cpt.setString("class", this.getClass().getName());
|
||||
|
||||
NBTTagCompound contents = new NBTTagCompound();
|
||||
|
||||
provider.writeToNBT(contents);
|
||||
|
||||
cpt.setTag("contents", contents);
|
||||
compound.setTag(baseNBTName, cpt);
|
||||
}
|
||||
|
||||
}
|
||||
+4
-4
@@ -2,14 +2,14 @@
|
||||
{
|
||||
"modid": "ThaumicTinkerer",
|
||||
"name": "Thaumic Tinkerer",
|
||||
"description": "An addon to Thaumcraft 3, implementing new content. This mod is a spiritual successor to Elemental Tinkerer. Compiled for Thaumcraft 3.0.5.",
|
||||
"version": "1.0.2",
|
||||
"mcversion": "1.5+",
|
||||
"description": "An addon to Thaumcraft 3, implementing new content. This mod is a spiritual successor to Elemental Tinkerer. Researches that come from this mod are prefixed by [TT]. Compiled for Thaumcraft 3.0.5h1.",
|
||||
"version": "1.0.8",
|
||||
"mcversion": "1.5.2",
|
||||
"logoFile": "/mods/ThaumicTinkerer/logo.png",
|
||||
"url": "minecraftforum.net/topic/1813058-",
|
||||
"updateUrl": "",
|
||||
"authors": ["Vazkii"],
|
||||
"credits": "azanor for creating Thaumcraft. TheAtlanticCraft, MartysGames, TheWhiteWolves.",
|
||||
"credits": "Azanor for creating Thaumcraft. TheAtlanticCraft, MartysGames, TheWhiteWolves, mDyio.",
|
||||
"parent": "",
|
||||
"screenshots": [],
|
||||
"dependencies": ["Thaumcraft"]
|
||||
|
||||
@@ -20,6 +20,7 @@ import thaumcraft.common.CommonProxy;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import vazkii.tinkerer.block.ModBlocks;
|
||||
import vazkii.tinkerer.core.proxy.TTCommonProxy;
|
||||
import vazkii.tinkerer.enchantment.ModEnchantments;
|
||||
import vazkii.tinkerer.item.ModItems;
|
||||
import vazkii.tinkerer.lib.LibMisc;
|
||||
import vazkii.tinkerer.lib.LibNetwork;
|
||||
@@ -34,6 +35,7 @@ import vazkii.tinkerer.research.ModResearchItems;
|
||||
import vazkii.tinkerer.util.handler.ConfigurationHandler;
|
||||
import vazkii.tinkerer.util.handler.EntityInteractionHandler;
|
||||
import vazkii.tinkerer.util.handler.GuiHandler;
|
||||
import vazkii.tinkerer.util.handler.SoulHeartHandler;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
@@ -76,12 +78,14 @@ public class ThaumicTinkerer {
|
||||
ModBlocks.initBlocks();
|
||||
ModItems.initItems();
|
||||
ModPotions.initPotions();
|
||||
ModEnchantments.initEnchantments();
|
||||
|
||||
proxy.initEntities();
|
||||
proxy.initTileEntities();
|
||||
proxy.initRenders();
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new EntityInteractionHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new SoulHeartHandler());
|
||||
|
||||
GameRegistry.registerPlayerTracker(new PlayerTracker());
|
||||
NetworkRegistry.instance().registerGuiHandler(modInstance, new GuiHandler());
|
||||
|
||||
@@ -29,6 +29,7 @@ import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
import vazkii.tinkerer.ThaumicTinkerer;
|
||||
import vazkii.tinkerer.client.util.helper.IconHelper;
|
||||
import vazkii.tinkerer.lib.LibGuiIDs;
|
||||
@@ -160,8 +161,20 @@ public class BlockAnimationTablet extends BlockModContainer {
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if(!par1World.isRemote) {
|
||||
TileEntity tile = par1World.getBlockTileEntity(par2, par3, par4);
|
||||
if(tile != null)
|
||||
par5EntityPlayer.openGui(ThaumicTinkerer.modInstance, LibGuiIDs.ID_ANIMATION_TABLET, par1World, par2, par3, par4);
|
||||
if(tile != null) {
|
||||
TileEntityAnimationTablet tablet = (TileEntityAnimationTablet) tile;
|
||||
if(par5EntityPlayer.getCurrentEquippedItem() != null && par5EntityPlayer.getCurrentEquippedItem().getItem() instanceof ItemWandCasting) {
|
||||
int meta = par1World.getBlockMetadata(par2, par3, par4);
|
||||
boolean activated = (meta & 8) != 0;
|
||||
if(!activated && !tablet.getIsBreaking() && tablet.swingProgress == 0) {
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, meta == 5 ? + 2 : meta + 1, 1 | 2);
|
||||
par1World.playSoundEffect(par2, par3, par4, "thaumcraft.tool", 0.6F, 1F);
|
||||
} else par5EntityPlayer.addChatMessage("You can not rotate the Tablet while it's activated.");
|
||||
// Rare chance this might happen, but better to cope for it.
|
||||
|
||||
return true;
|
||||
} else par5EntityPlayer.openGui(ThaumicTinkerer.modInstance, LibGuiIDs.ID_ANIMATION_TABLET, par1World, par2, par3, par4);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [26 Jul 2013, 02:13:54 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.block;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.tinkerer.tile.TileEntityInterface;
|
||||
|
||||
public class BlockInterface extends BlockModContainer {
|
||||
|
||||
public BlockInterface(int par1) {
|
||||
super(par1, Material.iron);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world) {
|
||||
return new TileEntityInterface();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [28 Jun 2013, 18:06:58 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.block;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.common.Config;
|
||||
import vazkii.tinkerer.lib.LibRenderIDs;
|
||||
import vazkii.tinkerer.tile.TileEntityMagnet;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockMagnet extends BlockModContainer {
|
||||
|
||||
public BlockMagnet(int par1) {
|
||||
super(par1, Material.iron);
|
||||
setBlockBounds(0.0625F, 0F, 0.0625F, 0.9375F, 1F / 16F * 2F, 0.9375F);
|
||||
setHardness(1.7F);
|
||||
setResistance(1F);
|
||||
setStepSound(soundWoodFootstep);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
int meta = par1World.getBlockMetadata(par2, par3, par4);
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, meta == 0 ? 1 : 0, 2);
|
||||
if(!par1World.isRemote)
|
||||
par1World.playSoundEffect(par2, par3, par4, "random.click", 1F, 0.5F);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIcon(int par1, int par2) {
|
||||
return Config.blockWooden.getIcon(par1, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return LibRenderIDs.idMagnet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world) {
|
||||
return new TileEntityMagnet();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
/**
|
||||
* This class was created by <TheWhiteWolves>. It's distributed as
|
||||
* part of the Thaumic Tinkerer Mod.
|
||||
*
|
||||
* Thaumic Tinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* Thaumic Tinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [6 Jul 2013, 15:16:20 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.common.Config;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
import vazkii.tinkerer.ThaumicTinkerer;
|
||||
import vazkii.tinkerer.lib.LibGuiIDs;
|
||||
import vazkii.tinkerer.lib.LibRenderIDs;
|
||||
import vazkii.tinkerer.tile.TileEntityMobMagnet;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockMobMagnet extends BlockModContainer {
|
||||
|
||||
Random random;
|
||||
|
||||
public BlockMobMagnet(int par1) {
|
||||
super(par1, Material.iron);
|
||||
setBlockBounds(0.0625F, 0F, 0.0625F, 0.9375F, 1F / 16F * 2F, 0.9375F);
|
||||
setHardness(1.7F);
|
||||
setResistance(1F);
|
||||
setStepSound(soundWoodFootstep);
|
||||
|
||||
random = new Random();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if(par5EntityPlayer.getCurrentEquippedItem() != null) {
|
||||
if(par5EntityPlayer.getCurrentEquippedItem().getItem() instanceof ItemWandCasting) {
|
||||
TileEntity tile = par1World.getBlockTileEntity(par2, par3, par4);
|
||||
if(tile != null) {
|
||||
par5EntityPlayer.openGui(ThaumicTinkerer.modInstance, LibGuiIDs.ID_MOB_MAGNET, par1World, par2, par3, par4);
|
||||
if(!par1World.isRemote) {
|
||||
par1World.playSoundEffect(par2, par3, par4, "thaumcraft.key", 1F, 0.5F);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
int meta = par1World.getBlockMetadata(par2, par3, par4);
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, meta == 0 ? 1 : 0, 2);
|
||||
if(!par1World.isRemote) {
|
||||
par1World.playSoundEffect(par2, par3, par4, "random.click", 1F, 0.5F);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) {
|
||||
TileEntityMobMagnet mobMagnet = (TileEntityMobMagnet) par1World.getBlockTileEntity(par2, par3, par4);
|
||||
|
||||
if (mobMagnet != null) {
|
||||
for (int j1 = 0; j1 < mobMagnet.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = mobMagnet.getStackInSlot(j1);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.itemID, k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float)random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float)random.nextGaussian() * f3;
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
par1World.func_96440_m(par2, par3, par4, par5);
|
||||
}
|
||||
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIcon(int par1, int par2) {
|
||||
return Config.blockWooden.getIcon(par1, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return LibRenderIDs.idMobMagnet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world) {
|
||||
return new TileEntityMobMagnet();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [27 Jun 2013, 18:24:35 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.block;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.tinkerer.item.ModItems;
|
||||
|
||||
public class BlockNitorGas extends BlockGas {
|
||||
|
||||
public BlockNitorGas(int par1) {
|
||||
super(par1);
|
||||
setLightValue(0.85F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int tickRate(World par1World) {
|
||||
return par1World.getWorldInfo().getDimension() == -1 ? 60 : 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
if(!par1World.isRemote) {
|
||||
List<EntityPlayer> players = par1World.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(par2, par3, par4, par2 + 1, par3 + 1, par4 + 1));
|
||||
if(players.isEmpty())
|
||||
par1World.setBlockToAir(par2, par3, par4);
|
||||
else {
|
||||
boolean has = false;
|
||||
for(EntityPlayer player : players)
|
||||
if(player.inventory.hasItem(ModItems.brightNitor.itemID)) {
|
||||
has = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!has)
|
||||
par1World.setBlockToAir(par2, par3, par4);
|
||||
}
|
||||
par1World.scheduleBlockUpdate(par2, par3, par4, blockID, tickRate(par1World));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World par1World, int par2, int par3, int par4) {
|
||||
if(!par1World.isRemote)
|
||||
par1World.scheduleBlockUpdate(par2, par3, par4, blockID, tickRate(par1World));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [27 May 2013, 12:27:14 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.common.Config;
|
||||
import thaumcraft.common.blocks.BlockWarded;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
import thaumcraft.common.tiles.TileOwned;
|
||||
import vazkii.tinkerer.util.helper.ModCreativeTab;
|
||||
|
||||
public class BlockPhantomStone extends BlockWarded {
|
||||
|
||||
public BlockPhantomStone(int par1) {
|
||||
super(par1);
|
||||
if(Config.wardedStone)
|
||||
setCreativeTab(ModCreativeTab.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCreatureSpawn(EnumCreatureType type, World world, int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockNormalCube(World world, int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
TileOwned tile = (TileOwned) par1World.getBlockTileEntity(par2, par3, par4);
|
||||
|
||||
if (tile != null) {
|
||||
String owner = tile.owner;
|
||||
|
||||
if(owner.equals(par5EntityPlayer.username)) {
|
||||
if(par5EntityPlayer.getCurrentEquippedItem() != null && par5EntityPlayer.getCurrentEquippedItem().getItem() instanceof ItemWandCasting) {
|
||||
if(!par1World.isRemote) {
|
||||
int id = par1World.getBlockId(par2, par3, par4);
|
||||
int meta = par1World.getBlockMetadata(par2, par3, par4);
|
||||
par1World.spawnEntityInWorld(new EntityItem(par1World, par2 + 0.5, par3 + 0.5, par4 + 0.5, new ItemStack(id, 1, meta)));
|
||||
par1World.playAuxSFX(2001, par2, par3, par4, blockID + (meta << 12));
|
||||
tile.safeToRemove = true;
|
||||
par1World.setBlock(par2, par3, par4, 0, 0, 1 & 2);
|
||||
} else par5EntityPlayer.swingItem();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) {
|
||||
TileOwned tile = (TileOwned) par1World.getBlockTileEntity(par2, par3, par4);
|
||||
if(!(par7Entity instanceof EntityPlayer && ((EntityPlayer) par7Entity).username.equals(tile.owner)))
|
||||
super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
||||
}
|
||||
}
|
||||
@@ -140,7 +140,7 @@ public class BlockWardChest extends BlockModContainer {
|
||||
par1World.playSoundEffect(par2, par3, par4, "thaumcraft.key", 1F, 1F);
|
||||
} else {
|
||||
par5EntityPlayer.addChatMessage("The Chest refuses to budge.");
|
||||
par1World.playSoundEffect(par2, par3, par4, "random.chestclosed", 1F, 0.2F);
|
||||
par1World.playSoundEffect(par2, par3, par4, "thaumcraft.doorfail", 1F, 0.2F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import thaumcraft.api.ObjectTags;
|
||||
import thaumcraft.api.ThaumcraftApi;
|
||||
import vazkii.tinkerer.item.ItemDarkQuartzBlock;
|
||||
import vazkii.tinkerer.item.ItemDarkQuartzSlab;
|
||||
import vazkii.tinkerer.item.ItemPhantomStoneBlock;
|
||||
import vazkii.tinkerer.lib.LibBlockIDs;
|
||||
import vazkii.tinkerer.lib.LibBlockNames;
|
||||
import vazkii.tinkerer.lib.LibMisc;
|
||||
@@ -37,6 +38,11 @@ public final class ModBlocks {
|
||||
public static Block darkQuartzSlabFull;
|
||||
public static Block animationTablet;
|
||||
public static Block darkGas;
|
||||
public static Block phantomStone;
|
||||
public static Block nitorGas;
|
||||
public static Block magnet;
|
||||
public static Block mobMagnet;
|
||||
public static Block interfase;
|
||||
|
||||
public static void initBlocks() {
|
||||
glowstoneGas = new BlockGlowstoneGas(LibBlockIDs.idGlowstoneGas).setUnlocalizedName(LibBlockNames.GLOWSTONE_GAS);
|
||||
@@ -48,6 +54,11 @@ public final class ModBlocks {
|
||||
darkQuartzSlabFull = new BlockDarkQuartzSlab(LibBlockIDs.idDarkQuartzSlabFull, true).setUnlocalizedName(LibBlockNames.DARK_QUARTZ_SLAB);
|
||||
animationTablet = new BlockAnimationTablet(LibBlockIDs.idAnimationTablet).setUnlocalizedName(LibBlockNames.ANIMATION_TABLET);
|
||||
darkGas = new BlockDarkGas(LibBlockIDs.idDarkGas).setUnlocalizedName(LibBlockNames.DARK_GAS);
|
||||
phantomStone = new BlockPhantomStone(LibBlockIDs.idPhantomStone).setUnlocalizedName(LibBlockNames.PHANTOM_STONE);
|
||||
nitorGas = new BlockNitorGas(LibBlockIDs.idNitorGas).setUnlocalizedName(LibBlockNames.NITOR_GAS);
|
||||
magnet = new BlockMagnet(LibBlockIDs.idMagnet).setUnlocalizedName(LibBlockNames.MAGNET);
|
||||
mobMagnet = new BlockMobMagnet(LibBlockIDs.idMobMagnet).setUnlocalizedName(LibBlockNames.MOB_MAGNET);
|
||||
interfase = new BlockInterface(LibBlockIDs.idInterface).setUnlocalizedName(LibBlockNames.INTERFACE);
|
||||
|
||||
registerBlocks();
|
||||
nameBlocks();
|
||||
@@ -63,6 +74,11 @@ public final class ModBlocks {
|
||||
GameRegistry.registerBlock(darkQuartzSlabFull, ItemDarkQuartzSlab.class, LibBlockNames.DARK_QUARTZ_SLAB_FULL);
|
||||
GameRegistry.registerBlock(animationTablet, LibBlockNames.ANIMATION_TABLET);
|
||||
GameRegistry.registerBlock(darkGas, LibBlockNames.DARK_GAS);
|
||||
GameRegistry.registerBlock(phantomStone, ItemPhantomStoneBlock.class, LibBlockNames.PHANTOM_STONE);
|
||||
GameRegistry.registerBlock(nitorGas, LibBlockNames.NITOR_GAS);
|
||||
GameRegistry.registerBlock(magnet, LibBlockNames.MAGNET);
|
||||
GameRegistry.registerBlock(mobMagnet, LibBlockNames.MOB_MAGNET);
|
||||
GameRegistry.registerBlock(interfase, LibBlockNames.INTERFACE);
|
||||
}
|
||||
|
||||
private static void nameBlocks() {
|
||||
@@ -70,6 +86,10 @@ public final class ModBlocks {
|
||||
LanguageRegistry.addName(wardChest, LibBlockNames.WARD_CHEST_D);
|
||||
LanguageRegistry.addName(darkQuartzStairs, LibBlockNames.DARK_QUARTZ_STAIRS_D);
|
||||
LanguageRegistry.addName(animationTablet, LibBlockNames.ANIMATION_TABLET_D);
|
||||
LanguageRegistry.addName(phantomStone, LibBlockNames.PHANTOM_STONE_D);
|
||||
LanguageRegistry.addName(magnet, LibBlockNames.MAGNET_D);
|
||||
LanguageRegistry.addName(mobMagnet, LibBlockNames.MOB_MAGNET_D);
|
||||
LanguageRegistry.addName(interfase, LibBlockNames.INTERFACE_D);
|
||||
}
|
||||
|
||||
public static void applyObjectTags() {
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/**
|
||||
* This class was created by <TheWhiteWolves>. It's distributed as
|
||||
* part of the Thaumic Tinkerer Mod.
|
||||
*
|
||||
* Thaumic Tinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* Thaumic Tinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [6 Jul 2013, 15:16:08 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.tinkerer.client.gui.button.GuiButtonMM;
|
||||
import vazkii.tinkerer.client.gui.button.GuiButtonMMRadio;
|
||||
import vazkii.tinkerer.client.gui.button.IRadioButton;
|
||||
import vazkii.tinkerer.inventory.container.ContainerMobMagnet;
|
||||
import vazkii.tinkerer.lib.LibResources;
|
||||
import vazkii.tinkerer.network.PacketManager;
|
||||
import vazkii.tinkerer.network.packet.PacketMobMagnetButton;
|
||||
import vazkii.tinkerer.tile.TileEntityMobMagnet;
|
||||
import vazkii.tinkerer.util.helper.ItemNBTHelper;
|
||||
|
||||
public class GuiMobMagnet extends GuiContainer {
|
||||
|
||||
int x, y;
|
||||
ItemStack stack = null;
|
||||
TileEntityMobMagnet mobMagnet;
|
||||
private static final String TAG_PATTERN = "pattern";
|
||||
private static final String NON_ASSIGNED = "Blank";
|
||||
private String filter = "All";
|
||||
|
||||
List<GuiButtonMM> buttonListMM = new ArrayList();
|
||||
List<IRadioButton> radioButtons = new ArrayList();
|
||||
|
||||
public GuiMobMagnet(TileEntityMobMagnet tile, InventoryPlayer playerInv) {
|
||||
super(new ContainerMobMagnet(tile, playerInv));
|
||||
mobMagnet = tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
x = (width - xSize) / 2;
|
||||
y = (height - ySize) / 2;
|
||||
buttonListMM.clear();
|
||||
addButton(new GuiButtonMMRadio(0, x + 100, y + 28, mobMagnet.adult, radioButtons));
|
||||
addButton(new GuiButtonMMRadio(1, x + 100, y + 48, !mobMagnet.adult, radioButtons));
|
||||
buttonList = buttonListMM;
|
||||
}
|
||||
|
||||
private void addButton(GuiButtonMM button) {
|
||||
buttonListMM.add(button);
|
||||
if(button instanceof IRadioButton)
|
||||
radioButtons.add((IRadioButton) button);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if(par1GuiButton instanceof IRadioButton)
|
||||
((IRadioButton) par1GuiButton).enableFromClick();
|
||||
else buttonListMM.get(0).enabled = !buttonListMM.get(0).enabled;
|
||||
|
||||
mobMagnet.adult = buttonListMM.get(0).enabled;
|
||||
|
||||
PacketManager.sendPacketToServer(new PacketMobMagnetButton(mobMagnet));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(LibResources.GUI_MOB_MAGNET);
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
filter = "All";
|
||||
String adult = "Adult";
|
||||
String child = "Child";
|
||||
stack = mobMagnet.getStackInSlot(0);
|
||||
if(stack != null) {
|
||||
filter = ItemNBTHelper.getString(stack, TAG_PATTERN, NON_ASSIGNED);
|
||||
}
|
||||
fontRenderer.drawString(filter, x + xSize/2 - fontRenderer.getStringWidth(filter)/2-26, y + 16, 0x999999);
|
||||
fontRenderer.drawString(adult, x + 120, y + 30, 0x999999);
|
||||
fontRenderer.drawString(child, x + 120, y + 50, 0x999999);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* This class was created by <TheWhiteWolves>. It's distributed as
|
||||
* part of the Thaumic Tinkerer Mod.
|
||||
*
|
||||
* Thaumic Tinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* Thaumic Tinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [12 Jul 2013, 22:12:30 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.client.gui.button;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import vazkii.tinkerer.lib.LibResources;
|
||||
|
||||
public class GuiButtonMM extends GuiButton {
|
||||
|
||||
public boolean enabled = false;;
|
||||
|
||||
public GuiButtonMM(int par1, int par2, int par3, boolean enabled) {
|
||||
super(par1, par2, par3, 13, 13, "");
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
if(drawButton) {
|
||||
par1Minecraft.renderEngine.bindTexture(LibResources.GUI_MOB_MAGNET);
|
||||
int y = enabled ? 13 : 0;
|
||||
drawTexturedModalRect(xPosition, yPosition, 176, y, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* This class was created by <TheWhiteWolves>. It's distributed as
|
||||
* part of the Thaumic Tinkerer Mod.
|
||||
*
|
||||
* Thaumic Tinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* Thaumic Tinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [12 Jul 2013, 22:12:43 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.client.gui.button;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GuiButtonMMRadio extends GuiButtonMM implements IRadioButton {
|
||||
|
||||
List<IRadioButton> linkedButtons;
|
||||
|
||||
public GuiButtonMMRadio(int par1, int par2, int par3, boolean enabled, List<IRadioButton> linkedButtons) {
|
||||
super(par1, par2, par3, enabled);
|
||||
this.linkedButtons = linkedButtons;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableFromClick() {
|
||||
setEnabled(true);
|
||||
for(IRadioButton button : linkedButtons)
|
||||
if(button != this)
|
||||
button.updateStatus(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(IRadioButton otherButton) {
|
||||
if(otherButton.isEnabled())
|
||||
setEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It can be integrated in any of your
|
||||
* minecraft projects at will. If your mod is open source, this header must
|
||||
* be present.
|
||||
*
|
||||
* This class is licensed under a CC-BY 3.0 license.
|
||||
* http://creativecommons.org/licenses/by/3.0/
|
||||
*/
|
||||
package vazkii.tinkerer.client.model;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D;
|
||||
import static org.lwjgl.opengl.GL11.glColor3ub;
|
||||
import static org.lwjgl.opengl.GL11.glDisable;
|
||||
import static org.lwjgl.opengl.GL11.glEnable;
|
||||
import static org.lwjgl.opengl.GL11.glPopMatrix;
|
||||
import static org.lwjgl.opengl.GL11.glPushMatrix;
|
||||
import static org.lwjgl.opengl.GL11.glRotatef;
|
||||
import static org.lwjgl.opengl.GL11.glScalef;
|
||||
import static org.lwjgl.opengl.GL11.glTranslatef;
|
||||
import static org.lwjgl.opengl.GL12.GL_RESCALE_NORMAL;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class ModelCubeWorld extends ModelBase {
|
||||
|
||||
byte[][][][] modelData;
|
||||
int[] pointers;
|
||||
|
||||
final ModelRenderer cube;
|
||||
|
||||
/**
|
||||
* @param stream An InputStream where the model can be loaded from. You can get one using
|
||||
* {@link Class#getResourceAsStream(String)}, for loading resources in the mod's package.
|
||||
* Input streams are diverse, so this constructor can be called from a URL connection, a file
|
||||
* in the local file system, or even an incoming packet.
|
||||
*/
|
||||
public ModelCubeWorld(InputStream stream) {
|
||||
cube = new ModelRenderer(this, 0, 0).addBox(0F, 0F, 0F, 1, 1, 1);
|
||||
|
||||
int i;
|
||||
int it = 0;
|
||||
int area = 0;
|
||||
|
||||
byte[] sizesBuffer = new byte[12];
|
||||
|
||||
try {
|
||||
while ((i = stream.read()) != -1) {
|
||||
final byte val = (byte) (i & 0xFF);
|
||||
if (it < 12)
|
||||
sizesBuffer[it] = val;
|
||||
else {
|
||||
if (it == 12) {
|
||||
final int x = sizesBuffer[0] | sizesBuffer[1] << 8 | sizesBuffer[2] << 16 | sizesBuffer[3] << 24;
|
||||
final int y = sizesBuffer[4] | sizesBuffer[5] << 8 | sizesBuffer[6] << 16 | sizesBuffer[7] << 24;
|
||||
final int z = sizesBuffer[8] | sizesBuffer[9] << 8 | sizesBuffer[10] << 16 | sizesBuffer[11] << 24;
|
||||
|
||||
modelData = new byte[x][y][z][3];
|
||||
area = x * y;
|
||||
|
||||
sizesBuffer = null;
|
||||
}
|
||||
|
||||
final int it1 = it - 12;
|
||||
final int it1d = it1 / 3;
|
||||
|
||||
final int z = it1d / area;
|
||||
|
||||
final int it2d = it1d - area * z; // Exploiting the lack of rounding in integer values
|
||||
final int x = it2d % modelData.length;
|
||||
final int y = it2d / modelData.length;
|
||||
|
||||
if (x >= modelData.length || y >= modelData[0].length || z >= modelData[0][0].length) {
|
||||
it++;
|
||||
continue;
|
||||
}
|
||||
|
||||
modelData[x][y][z][it1 % 3] = val;
|
||||
}
|
||||
|
||||
it++;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
calculatePointers(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the data of the model, in a four dimensional byte array.<br><br>
|
||||
* Dimension 0 - The X coordinates<br>
|
||||
* Dimension 1 - The Y coordinates<br>
|
||||
* Dimension 2 - The Z coordinates<br>
|
||||
* Dimension 3 - Always of length 3, contains, respectively, red, green and blue values.
|
||||
*
|
||||
*/
|
||||
public byte[][][][] getModelData() {
|
||||
return modelData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recalculates the pointers for the rendering. Must be done if you change the model data, otherwise it
|
||||
* won't make use of the new data.
|
||||
* @param renderHidden If true, the renderer will draw every single cube, even cubes that are obstructed
|
||||
* on all 6 sides. Not recommended!
|
||||
*/
|
||||
public void calculatePointers(final boolean renderHidden) {
|
||||
List<Integer> newPointers = new ArrayList();
|
||||
|
||||
for (int x = 0; x < modelData.length; x++)
|
||||
for (int y = 0; y < modelData[0].length; y++)
|
||||
for (int z = 0; z < modelData[0][0].length; z++) {
|
||||
if (cubeExists(x, y, z)) {
|
||||
if (!renderHidden) {
|
||||
int hiddenSides = 0;
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
if (cubeExists(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ))
|
||||
++hiddenSides;
|
||||
|
||||
if (hiddenSides == 6)
|
||||
continue;
|
||||
}
|
||||
|
||||
newPointers.add(x & 1023 | (y & 1023) << 10 | (z & 1023) << 20);
|
||||
}
|
||||
}
|
||||
|
||||
pointers = new int[newPointers.size()];
|
||||
int it = 0;
|
||||
for (int i : newPointers) {
|
||||
pointers[it] = i;
|
||||
it++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if a cube exists at the coordinates passed in.
|
||||
*/
|
||||
public boolean cubeExists(final int x, final int y, final int z) {
|
||||
final int xs = modelData.length;
|
||||
final int ys = modelData[0].length;
|
||||
final int zs = modelData[0][0].length;
|
||||
|
||||
if (x >= xs || x < 0 || y >= ys || y < 0 || z >= zs || z < 0)
|
||||
return false;
|
||||
|
||||
final byte[] values = modelData[x][y][z];
|
||||
return values[0] != 0 || values[1] != 0 || values[2] != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Actually renders the model, requires previous translation. The model is rendered in a scale of
|
||||
* 0.0625F, or 1/16, the side of each voxel is one 16th of the side of a regular minecraft block.
|
||||
*/
|
||||
public void render() {
|
||||
glPushMatrix();
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
|
||||
final float scale = 0.0625F;
|
||||
glScalef(scale, scale, scale);
|
||||
glRotatef(-90F, 1F, 0F, 0F);
|
||||
|
||||
for (int i : pointers) {
|
||||
final int x = i & 1023;
|
||||
final int y = i >> 10 & 1023;
|
||||
final int z = i >> 20 & 1023;
|
||||
|
||||
glTranslatef(x, y, z);
|
||||
|
||||
final byte[] color = modelData[x][y][z];
|
||||
glColor3ub(color[0], color[1], color[2]);
|
||||
|
||||
cube.render(1F);
|
||||
|
||||
glTranslatef(-x, -y, -z);
|
||||
}
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [28 Jun 2013, 17:35:43 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.client.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import vazkii.tinkerer.lib.LibMisc;
|
||||
|
||||
public class ModelMagnet extends ModelBase {
|
||||
|
||||
ModelRenderer panel;
|
||||
ModelRenderer magnet;
|
||||
ModelRenderer box1;
|
||||
ModelRenderer box2;
|
||||
ModelRenderer box3;
|
||||
ModelRenderer box4;
|
||||
ModelRenderer box5;
|
||||
|
||||
public ModelMagnet() {
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
panel = new ModelRenderer(this, 0, 0);
|
||||
panel.addBox(0F, 0F, 0F, 14, 2, 14);
|
||||
panel.setRotationPoint(-7F, 22F, -7F);
|
||||
panel.setTextureSize(64, 64);
|
||||
setRotation(panel, 0F, 0F, 0F);
|
||||
magnet = new ModelRenderer(this, 0, 16);
|
||||
magnet.addBox(0F, 0F, 0F, 4, 13, 4);
|
||||
magnet.setRotationPoint(-2F, 9F, -2F);
|
||||
magnet.setTextureSize(64, 64);
|
||||
setRotation(magnet, 0F, 0F, 0F);
|
||||
box1 = new ModelRenderer(this, 28, 19);
|
||||
box1.addBox(0F, -2F, 0F, 6, 14, 0);
|
||||
box1.setRotationPoint(3F, 10F, -3F);
|
||||
box1.setTextureSize(64, 64);
|
||||
setRotation(box1, 0F, -1.570796F, 0F);
|
||||
box2 = new ModelRenderer(this, 28, 33);
|
||||
box2.addBox(0F, 0F, 0F, 6, 14, 0);
|
||||
box2.setRotationPoint(-3F, 8F, 3F);
|
||||
box2.setTextureSize(64, 64);
|
||||
setRotation(box2, 0F, 1.570796F, 0F);
|
||||
box3 = new ModelRenderer(this, 40, 19);
|
||||
box3.addBox(0F, 0F, 0F, 6, 14, 0);
|
||||
box3.setRotationPoint(3F, 8F, 3F);
|
||||
box3.setTextureSize(64, 64);
|
||||
setRotation(box3, 0F, 3.141593F, 0F);
|
||||
box4 = new ModelRenderer(this, 40, 33);
|
||||
box4.addBox(0F, 0F, 0F, 6, 14, 0);
|
||||
box4.setRotationPoint(-3F, 8F, -3F);
|
||||
box4.setTextureSize(64, 64);
|
||||
setRotation(box4, 0F, 0F, 0F);
|
||||
box5 = new ModelRenderer(this, 28, 49);
|
||||
box5.addBox(0F, 0F, 0F, 6, 0, 6);
|
||||
box5.setRotationPoint(-3F, 8F, -3F);
|
||||
box5.setTextureSize(64, 64);
|
||||
setRotation(box5, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render() {
|
||||
panel.render(LibMisc.MODEL_DEFAULT_RENDER_SCALE);
|
||||
magnet.render(LibMisc.MODEL_DEFAULT_RENDER_SCALE);
|
||||
box1.render(LibMisc.MODEL_DEFAULT_RENDER_SCALE);
|
||||
box2.render(LibMisc.MODEL_DEFAULT_RENDER_SCALE);
|
||||
box3.render(LibMisc.MODEL_DEFAULT_RENDER_SCALE);
|
||||
box4.render(LibMisc.MODEL_DEFAULT_RENDER_SCALE);
|
||||
box5.render(LibMisc.MODEL_DEFAULT_RENDER_SCALE);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [28 Jun 2013, 21:27:36 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.client.render.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.tinkerer.lib.LibRenderIDs;
|
||||
import vazkii.tinkerer.tile.TileEntityMagnet;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
|
||||
public class RenderMagnet implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
TileEntityRenderer.instance.renderTileEntityAt(new TileEntityMagnet(), 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return LibRenderIDs.idMagnet;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* This class was created by <TheWhiteWolves>. It's distributed as
|
||||
* part of the Thaumic Tinkerer Mod.
|
||||
*
|
||||
* Thaumic Tinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* Thaumic Tinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [6 Jul 2013, 17:49:35 (GMT)]
|
||||
*/
|
||||
|
||||
package vazkii.tinkerer.client.render.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.tinkerer.lib.LibRenderIDs;
|
||||
import vazkii.tinkerer.tile.TileEntityMobMagnet;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
|
||||
public class RenderMobMagnet implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
TileEntityRenderer.instance.renderTileEntityAt(new TileEntityMobMagnet(), 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return LibRenderIDs.idMobMagnet;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [26 Jul 2013, 02:27:58 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.client.render.item;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.tinkerer.ThaumicTinkerer;
|
||||
import vazkii.tinkerer.client.model.ModelCubeWorld;
|
||||
import vazkii.tinkerer.lib.LibResources;
|
||||
|
||||
public class RenderItemConnector implements IItemRenderer {
|
||||
|
||||
ModelCubeWorld model;
|
||||
|
||||
public RenderItemConnector() {
|
||||
model = new ModelCubeWorld(ThaumicTinkerer.class.getResourceAsStream(LibResources.MODEL_CONNECTOR));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(90F, 0F, 0F, 1F);
|
||||
GL11.glRotatef(90F, 0F, 1F, 0F);
|
||||
GL11.glScalef(0.75F, 0.75F, 0.75F);
|
||||
GL11.glTranslatef(-0.45F, -1.5F, 0.4F);
|
||||
GL11.glRotatef(25F, 1F, 0F, 0F);
|
||||
|
||||
if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
|
||||
GL11.glTranslatef(0F, 0F, -0.3F);
|
||||
GL11.glRotatef(25F, 1F, 0F, 0F);
|
||||
GL11.glRotatef(-15F, 0F, 1F, 0F);
|
||||
}
|
||||
|
||||
model.render();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [20 May 2013, 22:38:51 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.client.render.item;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import net.minecraft.client.renderer.RenderEngine;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import thaumcraft.api.EnumTag;
|
||||
import thaumcraft.api.ObjectTags;
|
||||
import thaumcraft.client.lib.UtilsFX;
|
||||
import thaumcraft.client.renderers.item.HandheldItemRenderer;
|
||||
import thaumcraft.common.items.armor.ItemGoggles;
|
||||
import vazkii.tinkerer.client.util.handler.ClientTickHandler;
|
||||
import vazkii.tinkerer.item.ItemFluxDetector;
|
||||
import vazkii.tinkerer.util.helper.MiscHelper;
|
||||
|
||||
public class RenderItemFluxDetector extends HandheldItemRenderer {
|
||||
// Because I'm a lasy bastard and don't want to code
|
||||
// the whole renderer. <3 you Azanor.
|
||||
|
||||
@Override
|
||||
public void renderThaumometer(ItemStack arg0, EntityPlayer arg1, RenderEngine arg2, float arg3) {
|
||||
MiscHelper.getMc();
|
||||
|
||||
boolean goggles = arg1.getCurrentItemOrArmor(4) != null && arg1.getCurrentItemOrArmor(4).getItem() instanceof ItemGoggles;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5F, -0.5F, 0F);
|
||||
GL11.glScalef(3F, 3F, 3F);
|
||||
renderItemStack(arg1, arg0, 0, false);
|
||||
GL11.glScalef(0.3334F, 0.3334F, 0.3334F);
|
||||
|
||||
GL11.glScalef(-1F, -1F, 1F);
|
||||
GL11.glTranslatef(-1.5F, -1.25F, 0F);
|
||||
|
||||
|
||||
float zLevel = 5F;
|
||||
ObjectTags tags = ItemFluxDetector.getTags(arg0);
|
||||
if(tags != null && tags.size() > 0 && !arg1.isSwingInProgress) {
|
||||
int degPerTag = 360 / tags.size();
|
||||
int renderDeg = -90 + (int) (ClientTickHandler.clientTicksElapsed % 360);
|
||||
for(EnumTag tag : tags.getAspects()) {
|
||||
int amount = tags.getAmount(tag);
|
||||
float radius = Math.max(0, Math.min(60, arg1.rotationPitch - 30)) / 30F;
|
||||
float xpos = (float) (radius * Math.cos(renderDeg * Math.PI / 180));
|
||||
float ypos = (float) (radius * Math.sin(renderDeg * Math.PI / 180));
|
||||
if(amount == 100 && arg1.rotationPitch >= 90 && goggles) {
|
||||
xpos += (Math.random() - 0.5) / 25F;
|
||||
ypos += (Math.random() - 0.5) / 25F;
|
||||
}
|
||||
GL11.glPushMatrix();
|
||||
float opacity = Math.min(arg1.rotationPitch / 100F, Math.max(0.3F, amount / 100F));
|
||||
if(!goggles)
|
||||
opacity = (float) Math.min(arg1.rotationPitch / 100F, Math.cos(ClientTickHandler.clientTicksElapsed / 5F) + 1.5F);
|
||||
drawTag(goggles ? tag : EnumTag.UNKNOWN, 1.5F - arg1.rotationPitch / 100F, xpos, ypos, zLevel, opacity);
|
||||
GL11.glTranslatef(0F, 0F, -1F);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
renderDeg += degPerTag;
|
||||
zLevel -= 0.001F;
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void drawTag(EnumTag tag, float defScale, float x, float y, float z, float opacity) {
|
||||
final String tex = "/mods/thaumcraft/textures/misc/ss_tags_1.png";
|
||||
Color color = new Color(tag.color);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glTranslatef(x, y, z);
|
||||
UtilsFX.renderQuadCenteredFromTexture(tex, 8, tag.id, defScale + (float) Math.cos(ClientTickHandler.clientTicksElapsed / 5F) / 20F, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, 255, GL11.GL_ONE_MINUS_SRC_ALPHA, opacity);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -38,30 +38,32 @@ import vazkii.tinkerer.util.helper.MiscHelper;
|
||||
public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
|
||||
|
||||
private static final float[][] TRANSLATIONS = new float[][] {
|
||||
{ 0F, 0F, -1.25F },
|
||||
{ -1.25F, 0F, 0F },
|
||||
{ 0F, 0F, -1F },
|
||||
{ -1F, 0F, 0F },
|
||||
{ 0F, 0F, 0F },
|
||||
{ -1.25F, 0F, -1.25F }
|
||||
{ -1F, 0F, -1F }
|
||||
};
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float partialTicks) {
|
||||
TileEntityAnimationTablet tile = (TileEntityAnimationTablet) tileentity;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
renderOverlay(tile, LibResources.MISC_AT_OVERLAY_DIAL, -1, false, false, 0.65, 0.13F);
|
||||
if(tile.leftClick)
|
||||
renderOverlay(tile, LibResources.MISC_AT_OVERLAY_LEFT, 1, false, true, 1, 0.13F);
|
||||
else renderOverlay(tile, LibResources.MISC_AT_OVERLAY_RIGHT, 1, false, true, 1, 0.13F);
|
||||
|
||||
int meta = tile.getBlockMetadata() & 7;
|
||||
int rotation = meta == 2 ? 270 : meta == 3 ? 90 : meta == 4 ? 0 : 180;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
renderOverlay(tile, LibResources.MISC_AT_OVERLAY_DIAL, -1, false, false, 0.65, 0.13F, 0F);
|
||||
if(tile.leftClick)
|
||||
renderOverlay(tile, LibResources.MISC_AT_OVERLAY_LEFT, 1, false, true, 1, 0.13F, 0F);
|
||||
else renderOverlay(tile, LibResources.MISC_AT_OVERLAY_RIGHT, 1, false, true, 1, 0.131F, 0F);
|
||||
renderOverlay(tile, LibResources.MISC_AT_OVERLAY_FACING, 0, false, false, 0.5F, 0.13F, rotation + 90F);
|
||||
|
||||
GL11.glRotatef(rotation, 0F, 1F, 0F);
|
||||
GL11.glTranslated(0.1, 0.2 + Math.cos(ClientTickHandler.clientTicksElapsed / 12D) / 18F, 0.5);
|
||||
GL11.glScalef(0.8F, 0.8F, 0.8F);
|
||||
float[] translations = TRANSLATIONS[meta - 2];
|
||||
GL11.glTranslatef(translations[0], translations[1], translations[2]);
|
||||
GL11.glScalef(0.8F, 0.8F, 0.8F);
|
||||
GL11.glTranslatef(0.5F, 0F, 0.5F);
|
||||
GL11.glRotatef(tile.swingProgress, 0F, 0F, 1F);
|
||||
GL11.glTranslatef(-0.5F, 0F, -0.5F);
|
||||
@@ -101,7 +103,7 @@ public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
private void renderOverlay(TileEntityAnimationTablet tablet, String texture, int rotationMod, boolean useLighting, boolean useBlend, double size, float height) {
|
||||
private void renderOverlay(TileEntityAnimationTablet tablet, String texture, int rotationMod, boolean useLighting, boolean useBlend, double size, float height, float forceDeg) {
|
||||
Minecraft mc = MiscHelper.getMc();
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
GL11.glPushMatrix();
|
||||
@@ -113,7 +115,7 @@ public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
GL11.glTranslatef(0.5F, height, 0.5F);
|
||||
float deg = (float) (tablet.ticksExisted * rotationMod % 360F);
|
||||
float deg = rotationMod == 0 ? forceDeg : (float) (tablet.ticksExisted * rotationMod % 360F);
|
||||
GL11.glRotatef(deg, 0F, 1F, 0F);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [28 Jun 2013, 18:28:15 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.client.render.tile;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import thaumcraft.client.lib.UtilsFX;
|
||||
import thaumcraft.common.Config;
|
||||
import thaumcraft.common.items.armor.ItemHoverHarness;
|
||||
import vazkii.tinkerer.client.model.ModelMagnet;
|
||||
import vazkii.tinkerer.client.util.handler.ClientTickHandler;
|
||||
import vazkii.tinkerer.lib.LibResources;
|
||||
|
||||
public class RenderTileMagnet extends TileEntitySpecialRenderer {
|
||||
|
||||
ModelMagnet model = new ModelMagnet();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslatef((float)x, (float)y , (float)z);
|
||||
boolean blue = tileentity.worldObj == null || tileentity.getBlockMetadata() == 0;
|
||||
bindTextureByName(blue ? LibResources.MODEL_MAGNET_S : LibResources.MODEL_MAGNET_N);
|
||||
|
||||
int redstone = 0;
|
||||
if(tileentity.worldObj != null) {
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
redstone = Math.max(redstone, tileentity.worldObj.getIndirectPowerLevelTo(tileentity.xCoord + dir.offsetX, tileentity.yCoord + dir.offsetY, tileentity.zCoord + dir.offsetZ, dir.ordinal()));
|
||||
} else redstone = 15;
|
||||
|
||||
GL11.glTranslatef(0.5F, 1.5F, 0.5F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
model.render();
|
||||
|
||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||
GL11.glTranslatef(0F, 0F, -0.6F);
|
||||
Icon icon = ((ItemHoverHarness) Config.itemHoverHarness).iconLightningRing;
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 2; j++) {
|
||||
GL11.glScalef(1F, -1F, 1F);
|
||||
UtilsFX.renderQuadCenteredFromIcon(false, icon, redstone / 15F * 0.7F + (redstone == 0 ? 0 : 0.4F), blue ? 0F : 1F, 0F, blue ? 1F : 0F, 225, GL11.GL_ONE_MINUS_SRC_ALPHA, 0.9F);
|
||||
}
|
||||
|
||||
GL11.glTranslated(0, 0, -(Math.cos(ClientTickHandler.clientTicksElapsed / 10F) + 1) * 0.09 - 0.1);
|
||||
}
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* This class was created by <TheWhiteWolves>. It's distributed as
|
||||
* part of the Thaumic Tinkerer Mod.
|
||||
*
|
||||
* Thaumic Tinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* Thaumic Tinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [6 Jul 2013, 17:49:49 (GMT)]
|
||||
*/
|
||||
|
||||
package vazkii.tinkerer.client.render.tile;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import thaumcraft.client.lib.UtilsFX;
|
||||
import thaumcraft.common.Config;
|
||||
import thaumcraft.common.items.armor.ItemHoverHarness;
|
||||
import vazkii.tinkerer.client.model.ModelMagnet;
|
||||
import vazkii.tinkerer.client.util.handler.ClientTickHandler;
|
||||
import vazkii.tinkerer.lib.LibResources;
|
||||
|
||||
public class RenderTileMobMagnet extends TileEntitySpecialRenderer {
|
||||
|
||||
ModelMagnet model = new ModelMagnet();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslatef((float)x, (float)y , (float)z);
|
||||
boolean blue = tileentity.worldObj == null || tileentity.getBlockMetadata() == 0;
|
||||
bindTextureByName(blue ? LibResources.MODEL_MOB_MAGNET_S : LibResources.MODEL_MOB_MAGNET_N);
|
||||
|
||||
int redstone = 0;
|
||||
if(tileentity.worldObj != null) {
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
redstone = Math.max(redstone, tileentity.worldObj.getIndirectPowerLevelTo(tileentity.xCoord + dir.offsetX, tileentity.yCoord + dir.offsetY, tileentity.zCoord + dir.offsetZ, dir.ordinal()));
|
||||
} else redstone = 15;
|
||||
|
||||
GL11.glTranslatef(0.5F, 1.5F, 0.5F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
model.render();
|
||||
|
||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||
GL11.glTranslatef(0F, 0F, -0.6F);
|
||||
Icon icon = ((ItemHoverHarness) Config.itemHoverHarness).iconLightningRing;
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 2; j++) {
|
||||
GL11.glScalef(1F, -1F, 1F);
|
||||
UtilsFX.renderQuadCenteredFromIcon(false, icon, redstone / 15F * 0.7F + (redstone == 0 ? 0 : 0.4F), blue ? 0F : 1F, 0F, blue ? 1F : 0F, 225, GL11.GL_ONE_MINUS_SRC_ALPHA, 0.9F);
|
||||
}
|
||||
|
||||
GL11.glTranslated(0, 0, -(Math.cos(ClientTickHandler.clientTicksElapsed / 10F) + 1) * 0.09 - 0.1);
|
||||
}
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,6 @@ public class RenderTileWardChest extends TileEntitySpecialRenderer {
|
||||
GL11.glRotatef(rotation, 0F, 1F, 0F);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
chestModel.chestLid.render(LibMisc.MODEL_DEFAULT_RENDER_SCALE);
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [4 Jul 2013, 00:39:50 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.client.util.handler;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.tinkerer.lib.LibResources;
|
||||
import vazkii.tinkerer.util.helper.MiscHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class SoulHeartClientHandler {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static int clientPlayerHP = 0;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@ForgeSubscribe
|
||||
public void renderHealthBar(RenderGameOverlayEvent event) {
|
||||
if(event.type == ElementType.FOOD && clientPlayerHP > 0) {
|
||||
if(event instanceof RenderGameOverlayEvent.Post) {
|
||||
Minecraft mc = MiscHelper.getMc();
|
||||
|
||||
int x = event.resolution.getScaledWidth() / 2 + 10;
|
||||
int y = event.resolution.getScaledHeight() - 39;
|
||||
|
||||
GL11.glTranslatef(0F, 10F, 0F);
|
||||
mc.renderEngine.bindTexture(LibResources.GUI_SOUL_HEARTS);
|
||||
int it = 0;
|
||||
for(int i = 0; i < clientPlayerHP; i++) {
|
||||
boolean half = i == clientPlayerHP - 1 && clientPlayerHP % 2 != 0;
|
||||
if(half || i % 2 == 0) {
|
||||
renderHeart(x + it * 8, y, !half);
|
||||
it++;
|
||||
}
|
||||
}
|
||||
|
||||
mc.renderEngine.bindTexture("/gui/icons.png");
|
||||
}
|
||||
|
||||
GL11.glTranslatef(0F, -10F, 0F);
|
||||
}
|
||||
|
||||
if(event.type == ElementType.AIR && event instanceof RenderGameOverlayEvent.Post && clientPlayerHP > 0)
|
||||
GL11.glTranslatef(0F, 10F, 0F);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static void renderHeart(int x, int y, boolean full) {
|
||||
Tessellator tess = Tessellator.instance;
|
||||
float size = 1 / 16F;
|
||||
|
||||
float startX = full ? 0 : 9 * size;
|
||||
float endX = full ? 9 * size : 1;
|
||||
float startY = 0;
|
||||
float endY = 9 * size;
|
||||
|
||||
tess.startDrawingQuads();
|
||||
tess.addVertexWithUV(x, y + 9, 0, startX, endY);
|
||||
tess.addVertexWithUV(x + (full ? 9 : 7), y + 9, 0, endX, endY);
|
||||
tess.addVertexWithUV(x + (full ? 9 : 7), y, 0, endX, startY);
|
||||
tess.addVertexWithUV(x, y, 0, startX, startY);
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,25 +14,44 @@
|
||||
*/
|
||||
package vazkii.tinkerer.core.proxy;
|
||||
|
||||
import net.minecraft.client.renderer.entity.RenderSnowball;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import thaumcraft.client.fx.FXLightningBolt;
|
||||
import vazkii.tinkerer.ThaumicTinkerer;
|
||||
import vazkii.tinkerer.client.render.block.RenderMagnet;
|
||||
import vazkii.tinkerer.client.render.block.RenderMobMagnet;
|
||||
import vazkii.tinkerer.client.render.block.RenderWardChest;
|
||||
import vazkii.tinkerer.client.render.entity.RenderDeathRune;
|
||||
import vazkii.tinkerer.client.render.item.RenderItemConnector;
|
||||
import vazkii.tinkerer.client.render.item.RenderItemFluxDetector;
|
||||
import vazkii.tinkerer.client.render.tile.RenderTileAnimationTablet;
|
||||
import vazkii.tinkerer.client.render.tile.RenderTileMagnet;
|
||||
import vazkii.tinkerer.client.render.tile.RenderTileMobMagnet;
|
||||
import vazkii.tinkerer.client.render.tile.RenderTileTransmutator;
|
||||
import vazkii.tinkerer.client.render.tile.RenderTileWardChest;
|
||||
import vazkii.tinkerer.client.util.handler.ClientTickHandler;
|
||||
import vazkii.tinkerer.client.util.handler.SoulHeartClientHandler;
|
||||
import vazkii.tinkerer.entity.EntityDeathRune;
|
||||
import vazkii.tinkerer.entity.EntityLovePotion;
|
||||
import vazkii.tinkerer.item.ModItems;
|
||||
import vazkii.tinkerer.lib.LibRenderIDs;
|
||||
import vazkii.tinkerer.network.PacketManager;
|
||||
import vazkii.tinkerer.network.packet.PacketAnimationTabletSync;
|
||||
import vazkii.tinkerer.network.packet.PacketMobMagnetSync;
|
||||
import vazkii.tinkerer.network.packet.PacketSoulHeartSync;
|
||||
import vazkii.tinkerer.network.packet.PacketTransmutatorSync;
|
||||
import vazkii.tinkerer.network.packet.PacketVerification;
|
||||
import vazkii.tinkerer.tile.TileEntityAnimationTablet;
|
||||
import vazkii.tinkerer.tile.TileEntityMagnet;
|
||||
import vazkii.tinkerer.tile.TileEntityMobMagnet;
|
||||
import vazkii.tinkerer.tile.TileEntityTransmutator;
|
||||
import vazkii.tinkerer.tile.TileEntityWardChest;
|
||||
import vazkii.tinkerer.util.helper.MiscHelper;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.registry.TickRegistry;
|
||||
@@ -45,6 +64,8 @@ public class TTClientProxy extends TTCommonProxy {
|
||||
super.initTickHandlers();
|
||||
|
||||
TickRegistry.registerTickHandler(new ClientTickHandler(), Side.CLIENT);
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new SoulHeartClientHandler());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -54,6 +75,8 @@ public class TTClientProxy extends TTCommonProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTransmutator.class, new RenderTileTransmutator());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityWardChest.class, new RenderTileWardChest());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAnimationTablet.class, new RenderTileAnimationTablet());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMagnet.class, new RenderTileMagnet());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMobMagnet.class, new RenderTileMobMagnet());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,6 +84,7 @@ public class TTClientProxy extends TTCommonProxy {
|
||||
super.initEntities();
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityDeathRune.class, new RenderDeathRune());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityLovePotion.class, new RenderSnowball(ModItems.lovePotion, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,13 +94,22 @@ public class TTClientProxy extends TTCommonProxy {
|
||||
PacketManager.packetHandlers.add(new PacketVerification());
|
||||
PacketManager.packetHandlers.add(new PacketTransmutatorSync());
|
||||
PacketManager.packetHandlers.add(new PacketAnimationTabletSync());
|
||||
PacketManager.packetHandlers.add(new PacketSoulHeartSync());
|
||||
PacketManager.packetHandlers.add(new PacketMobMagnetSync());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initRenders() {
|
||||
LibRenderIDs.idWardChest = RenderingRegistry.getNextAvailableRenderId();
|
||||
LibRenderIDs.idMagnet = RenderingRegistry.getNextAvailableRenderId();
|
||||
LibRenderIDs.idMobMagnet = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
RenderingRegistry.registerBlockHandler(new RenderWardChest());
|
||||
RenderingRegistry.registerBlockHandler(new RenderMagnet());
|
||||
RenderingRegistry.registerBlockHandler(new RenderMobMagnet());
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.fluxDetector.itemID, new RenderItemFluxDetector());
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.connector.itemID, new RenderItemConnector());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -87,4 +120,33 @@ public class TTClientProxy extends TTCommonProxy {
|
||||
lightning.finalizeBolt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sanityCheckedFrozenParticles(EntityLiving entity) {
|
||||
for(int i = 0; i < 6; i++) {
|
||||
float x = (float) (entity.posX + (entity.worldObj.rand.nextDouble() - 0.5F) * (entity.width * 2F));
|
||||
float y = (float) (entity.posY + entity.worldObj.rand.nextDouble() * entity.height);
|
||||
float z = (float) (entity.posZ + (entity.worldObj.rand.nextDouble() - 0.5F) * (entity.width * 2F));
|
||||
|
||||
float size = (float) Math.random();
|
||||
float gravity = (float) (Math.random() / 20F);
|
||||
|
||||
if(MiscHelper.getMc().renderViewEntity != null)
|
||||
ThaumicTinkerer.tcProxy.sparkle(x, y, z, size, 2, gravity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sanityCheckedPossessedParticles(EntityLiving entity) {
|
||||
for(int i = 0; i < 3; i++) {
|
||||
float x = (float) (entity.posX + (entity.worldObj.rand.nextDouble() - 0.5F) * (entity.width * 2F));
|
||||
float y = (float) (entity.posY + entity.worldObj.rand.nextDouble() * entity.height);
|
||||
float z = (float) (entity.posZ + (entity.worldObj.rand.nextDouble() - 0.5F) * (entity.width * 2F));
|
||||
|
||||
float size = (float) (Math.random() / 2F);
|
||||
float gravity = (float) (Math.random() / 20F);
|
||||
|
||||
if(MiscHelper.getMc().renderViewEntity != null)
|
||||
ThaumicTinkerer.tcProxy.wispFX2(entity.worldObj, x, y, z, size, 5, false, gravity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,16 +15,22 @@
|
||||
package vazkii.tinkerer.core.proxy;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.tinkerer.ThaumicTinkerer;
|
||||
import vazkii.tinkerer.entity.EntityDeathRune;
|
||||
import vazkii.tinkerer.entity.EntityLovePotion;
|
||||
import vazkii.tinkerer.lib.LibBlockNames;
|
||||
import vazkii.tinkerer.lib.LibItemNames;
|
||||
import vazkii.tinkerer.lib.LibMisc;
|
||||
import vazkii.tinkerer.network.PacketManager;
|
||||
import vazkii.tinkerer.network.packet.PacketAnimationTabletButton;
|
||||
import vazkii.tinkerer.network.packet.PacketMobMagnetButton;
|
||||
import vazkii.tinkerer.tile.TileEntityAnimationTablet;
|
||||
import vazkii.tinkerer.tile.TileEntityInterface;
|
||||
import vazkii.tinkerer.tile.TileEntityMagnet;
|
||||
import vazkii.tinkerer.tile.TileEntityMobMagnet;
|
||||
import vazkii.tinkerer.tile.TileEntityTransmutator;
|
||||
import vazkii.tinkerer.tile.TileEntityWardChest;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
@@ -38,16 +44,22 @@ public class TTCommonProxy {
|
||||
GameRegistry.registerTileEntity(TileEntityTransmutator.class, tileName(LibBlockNames.TRANSMUTATOR));
|
||||
GameRegistry.registerTileEntity(TileEntityWardChest.class, tileName(LibBlockNames.WARD_CHEST));
|
||||
GameRegistry.registerTileEntity(TileEntityAnimationTablet.class, tileName(LibBlockNames.ANIMATION_TABLET));
|
||||
GameRegistry.registerTileEntity(TileEntityMagnet.class, tileName(LibBlockNames.MAGNET));
|
||||
GameRegistry.registerTileEntity(TileEntityMobMagnet.class, tileName(LibBlockNames.MOB_MAGNET));
|
||||
GameRegistry.registerTileEntity(TileEntityInterface.class, tileName(LibBlockNames.INTERFACE));
|
||||
}
|
||||
|
||||
public void initRenders() { }
|
||||
|
||||
public void initEntities() {
|
||||
EntityRegistry.registerModEntity(EntityDeathRune.class, LibMisc.MOD_ID + "_" + LibItemNames.DEATH_RUNE, 0, ThaumicTinkerer.modInstance, 64, 10, false);
|
||||
int id = 0;
|
||||
EntityRegistry.registerModEntity(EntityDeathRune.class, LibMisc.MOD_ID + "_" + LibItemNames.DEATH_RUNE, id++, ThaumicTinkerer.modInstance, 64, 10, false);
|
||||
EntityRegistry.registerModEntity(EntityLovePotion.class, LibMisc.MOD_ID + "_" + LibItemNames.LOVE_POTION, id++, ThaumicTinkerer.modInstance, 64, 10, true);
|
||||
}
|
||||
|
||||
public void initPackets() {
|
||||
PacketManager.packetHandlers.add(new PacketAnimationTabletButton());
|
||||
PacketManager.packetHandlers.add(new PacketMobMagnetButton());
|
||||
}
|
||||
|
||||
private static String tileName(String name) {
|
||||
@@ -55,4 +67,8 @@ public class TTCommonProxy {
|
||||
}
|
||||
|
||||
public void sigilLightning(World world, Entity entity, Vec3 end) { }
|
||||
}
|
||||
|
||||
public void sanityCheckedFrozenParticles(EntityLiving entity) { }
|
||||
|
||||
public void sanityCheckedPossessedParticles(EntityLiving entity) { }
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [25 May 2013, 12:18:48 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.enchantment;
|
||||
|
||||
import net.minecraft.enchantment.EnumEnchantmentType;
|
||||
|
||||
public class EnchantmentAshes extends EnchantmentLost {
|
||||
|
||||
protected EnchantmentAshes(int par1) {
|
||||
super(par1, EnumEnchantmentType.all);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [25 May 2013, 11:03:55 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.enchantment;
|
||||
|
||||
import net.minecraft.enchantment.EnumEnchantmentType;
|
||||
|
||||
public class EnchantmentFreezing extends EnchantmentLost {
|
||||
|
||||
protected EnchantmentFreezing(int par1) {
|
||||
super(par1, EnumEnchantmentType.weapon);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [25 May 2013, 11:21:12 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.enchantment;
|
||||
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnumEnchantmentType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class EnchantmentLost extends Enchantment {
|
||||
|
||||
protected EnchantmentLost(int par1, EnumEnchantmentType par3EnumEnchantmentType) {
|
||||
super(par1, 1, par3EnumEnchantmentType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canApplyAtEnchantingTable(ItemStack stack) {
|
||||
return false; // Thank god for forge hooks :D
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canApplyTogether(Enchantment par1Enchantment) {
|
||||
return !(par1Enchantment instanceof EnchantmentLost);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [25 May 2013, 12:14:21 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.enchantment;
|
||||
|
||||
import net.minecraft.enchantment.EnumEnchantmentType;
|
||||
|
||||
public class EnchantmentSoulbringer extends EnchantmentLost {
|
||||
|
||||
protected EnchantmentSoulbringer(int par1) {
|
||||
super(par1, EnumEnchantmentType.weapon);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [25 May 2013, 12:17:08 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.enchantment;
|
||||
|
||||
import net.minecraft.enchantment.EnumEnchantmentType;
|
||||
|
||||
public class EnchantmentVampirism extends EnchantmentLost {
|
||||
|
||||
protected EnchantmentVampirism(int par1) {
|
||||
super(par1, EnumEnchantmentType.weapon);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [25 May 2013, 22:57:41 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.enchantment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EnumCreatureAttribute;
|
||||
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
|
||||
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
|
||||
import net.minecraft.entity.ai.EntityAITaskEntry;
|
||||
import net.minecraft.entity.ai.EntityAIWatchClosest;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.event.EventPriority;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
|
||||
import vazkii.tinkerer.ThaumicTinkerer;
|
||||
import vazkii.tinkerer.lib.LibEnchantmentIDs;
|
||||
import vazkii.tinkerer.lib.LibPotions;
|
||||
import vazkii.tinkerer.potion.ModPotions;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
public class ModEnchantmentHandler {
|
||||
|
||||
@ForgeSubscribe
|
||||
public void onEntityDamaged(LivingHurtEvent event) {
|
||||
if(event.source.getEntity() instanceof EntityLiving) {
|
||||
EntityLiving attacker = (EntityLiving) event.source.getEntity();
|
||||
ItemStack heldItem = attacker.getHeldItem();
|
||||
|
||||
if(heldItem == null)
|
||||
return;
|
||||
|
||||
if(EnchantmentHelper.getEnchantmentLevel(LibEnchantmentIDs.freezing, heldItem) > 0) {
|
||||
event.entityLiving.addPotionEffect(new PotionEffect(ModPotions.effectFrozen.id, 60));
|
||||
event.entityLiving.worldObj.playSoundAtEntity(event.entityLiving, "thaumcraft.ice", 0.6F, 1F);
|
||||
}
|
||||
|
||||
if(EnchantmentHelper.getEnchantmentLevel(LibEnchantmentIDs.soulbringer, heldItem) > 0 && event.entityLiving.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD && !isEntityPossessed(event.entityLiving) && Math.random() < 0.05F) {
|
||||
event.entityLiving.addPotionEffect(new PotionEffect(ModPotions.effectPossessed.id, 12000));
|
||||
if(attacker instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) attacker;
|
||||
if(!player.worldObj.isRemote)
|
||||
player.addChatMessage(EnumChatFormatting.GOLD + "" + EnumChatFormatting.ITALIC + "The " + event.entityLiving.getEntityName() + " was possessed to join your fight.");
|
||||
}
|
||||
event.entityLiving.heal(event.entityLiving.getMaxHealth());
|
||||
event.entityLiving.worldObj.playSoundAtEntity(event.entityLiving, "thaumcraft.wand", 0.6F, 1F);
|
||||
}
|
||||
|
||||
if(EnchantmentHelper.getEnchantmentLevel(LibEnchantmentIDs.vampirism, heldItem) > 0) {
|
||||
attacker.heal((int) Math.ceil(event.ammount / 4D));
|
||||
event.entityLiving.worldObj.playSoundAtEntity(event.entityLiving, "thaumcraft.zap", 0.6F, 1F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ForgeSubscribe(priority = EventPriority.HIGHEST)
|
||||
public void onItemBroken(PlayerDestroyItemEvent event) {
|
||||
if(EnchantmentHelper.getEnchantmentLevel(LibEnchantmentIDs.ashes, event.original) > 0) {
|
||||
event.original.setItemDamage(0);
|
||||
NBTTagList list = event.original.getEnchantmentTagList();
|
||||
int remLoc = -1;
|
||||
for(int i = 0; i < list.tagCount(); i++) {
|
||||
short id = ((NBTTagCompound) list.tagAt(i)).getShort("id");
|
||||
if(id == LibEnchantmentIDs.ashes) {
|
||||
remLoc = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(remLoc >= 0)
|
||||
list.removeTag(remLoc);
|
||||
|
||||
for(int i = 0; list.tagCount() > 0 && i < 2; i++) {
|
||||
int loc = event.entity.worldObj.rand.nextInt(list.tagCount());
|
||||
list.removeTag(loc);
|
||||
}
|
||||
|
||||
if(list.tagCount() == 0)
|
||||
event.original.getTagCompound().removeTag("ench");
|
||||
|
||||
event.original.stackSize++;
|
||||
event.entityPlayer.inventory.mainInventory[event.entityPlayer.inventory.currentItem] = event.original.copy();
|
||||
|
||||
if(!event.entityPlayer.worldObj.isRemote)
|
||||
event.entityPlayer.addChatMessage(EnumChatFormatting.GOLD + "" + EnumChatFormatting.ITALIC + "Your " + event.original.getDisplayName() + " was reborn from the Ashes.");
|
||||
event.entityPlayer.worldObj.playSoundAtEntity(event.entityPlayer, "thaumcraft.fireloop", 0.6F, 1F);
|
||||
}
|
||||
}
|
||||
|
||||
@ForgeSubscribe(priority = EventPriority.HIGHEST)
|
||||
public void onEntityUpdate(LivingUpdateEvent event) {
|
||||
if(isEntityFrozen(event.entityLiving)) {
|
||||
event.entityLiving.landMovementFactor = 0F;
|
||||
event.entityLiving.jumpMovementFactor = 0F;
|
||||
event.entityLiving.setJumping(false);
|
||||
event.entityLiving.motionY = 0;
|
||||
|
||||
ThaumicTinkerer.proxy.sanityCheckedFrozenParticles(event.entityLiving);
|
||||
} else if(event.entityLiving.landMovementFactor == 0F && event.entityLiving.jumpMovementFactor == 0F){
|
||||
event.entityLiving.landMovementFactor = 0.1F;
|
||||
event.entityLiving.jumpMovementFactor = 0.02F;
|
||||
// This gets calibrated after, but for some entities (e.g. slimes)
|
||||
// it doesn't get calibrated automatically, so they stay
|
||||
// in the same place.
|
||||
}
|
||||
|
||||
if(isEntityPossessed(event.entityLiving)) {
|
||||
List<EntityAITaskEntry> entries = new ArrayList(event.entityLiving.tasks.taskEntries);
|
||||
entries.addAll(new ArrayList(event.entityLiving.targetTasks.taskEntries));
|
||||
|
||||
for(EntityAITaskEntry entry : entries) {
|
||||
if(entry.action instanceof EntityAIAttackOnCollide)
|
||||
messWithAttackAI((EntityAIAttackOnCollide) entry.action);
|
||||
else if(entry.action instanceof EntityAINearestAttackableTarget)
|
||||
messWithFollowAI((EntityAINearestAttackableTarget) entry.action);
|
||||
else if(entry.action instanceof EntityAIWatchClosest)
|
||||
messWithWatchAI((EntityAIWatchClosest) entry.action);
|
||||
}
|
||||
if(event.entityLiving.getAttackTarget() instanceof EntityPlayer)
|
||||
event.entityLiving.setAttackTarget(null);
|
||||
|
||||
ThaumicTinkerer.proxy.sanityCheckedPossessedParticles(event.entityLiving);
|
||||
}
|
||||
}
|
||||
|
||||
private void messWithAttackAI(EntityAIAttackOnCollide aiEntry) {
|
||||
// EntityAIAttackOnCollide.classTarget
|
||||
ReflectionHelper.setPrivateValue(EntityAIAttackOnCollide.class, aiEntry, EntityMob.class, 7);
|
||||
}
|
||||
|
||||
private void messWithFollowAI(EntityAINearestAttackableTarget aiEntry) {
|
||||
// EntityAINearestAttackableTarget.classTarget
|
||||
ReflectionHelper.setPrivateValue(EntityAINearestAttackableTarget.class, aiEntry, EntityMob.class, 1);
|
||||
}
|
||||
|
||||
public void messWithWatchAI(EntityAIWatchClosest aiEntry) {
|
||||
// EntityAIWatchClosest.watchedClass
|
||||
ReflectionHelper.setPrivateValue(EntityAIWatchClosest.class, aiEntry, EntityMob.class, 5);
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
public void onEntityDamage(LivingHurtEvent event) {
|
||||
if(isEntityFrozen(event.entityLiving) && event.source.isFireDamage())
|
||||
event.entityLiving.removePotionEffect(LibPotions.idFrozen);
|
||||
}
|
||||
|
||||
public static boolean isEntityFrozen(EntityLiving entity) {
|
||||
return entity.isPotionActive(LibPotions.idFrozen);
|
||||
}
|
||||
|
||||
public static boolean isEntityPossessed(EntityLiving entity) {
|
||||
return entity.isPotionActive(LibPotions.idPossessed);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [25 May 2013, 11:06:00 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.enchantment;
|
||||
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import vazkii.tinkerer.lib.LibEnchantmentIDs;
|
||||
import vazkii.tinkerer.lib.LibEnchantmentNames;
|
||||
import vazkii.tinkerer.util.handler.EnchantedBookCraftingHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
public final class ModEnchantments {
|
||||
|
||||
public static Enchantment freezing;
|
||||
public static Enchantment soulbringer;
|
||||
public static Enchantment vampirism;
|
||||
public static Enchantment ashes;
|
||||
|
||||
public static void initEnchantments(){
|
||||
freezing = new EnchantmentFreezing(LibEnchantmentIDs.freezing).setName(LibEnchantmentNames.FREEZING);
|
||||
soulbringer = new EnchantmentSoulbringer(LibEnchantmentIDs.soulbringer).setName(LibEnchantmentNames.SOULBRINGER);
|
||||
vampirism = new EnchantmentVampirism(LibEnchantmentIDs.vampirism).setName(LibEnchantmentNames.VAMPIRISM);
|
||||
ashes = new EnchantmentAshes(LibEnchantmentIDs.ashes).setName(LibEnchantmentNames.ASHES);
|
||||
|
||||
nameEnchantments();
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new ModEnchantmentHandler());
|
||||
GameRegistry.registerCraftingHandler(new EnchantedBookCraftingHandler());
|
||||
}
|
||||
|
||||
private static void nameEnchantments() {
|
||||
nameEnchant(freezing, LibEnchantmentNames.FREEZING_D);
|
||||
nameEnchant(soulbringer, LibEnchantmentNames.SOULBRINGER_D);
|
||||
nameEnchant(vampirism, LibEnchantmentNames.VAMPIRISM_D);
|
||||
nameEnchant(ashes, LibEnchantmentNames.ASHES_D);
|
||||
}
|
||||
|
||||
private static void nameEnchant(Enchantment enchant, String name) {
|
||||
LanguageRegistry.instance().addStringLocalization(enchant.getName(), name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [3 Jul 2013, 17:46:58 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.entity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.tinkerer.ThaumicTinkerer;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class EntityLovePotion extends EntityThrowable {
|
||||
|
||||
public EntityLovePotion(World par1World) {
|
||||
super(par1World);
|
||||
}
|
||||
|
||||
public EntityLovePotion(World par1World, EntityPlayer par2EntityPlayer) {
|
||||
super(par1World, par2EntityPlayer);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EntityLovePotion(World par1World, double par2, double par4, double par6, int par8) {
|
||||
this(par1World, par2, par4, par6);
|
||||
}
|
||||
|
||||
public EntityLovePotion(World par1World, double par2, double par4, double par6) {
|
||||
super(par1World, par2, par4, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getGravityVelocity() {
|
||||
return 0.3F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) posX, (float) posY, (float) posZ, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition mop) {
|
||||
spawnParticles();
|
||||
AxisAlignedBB bb = boundingBox.expand(4.0D, 2.0D, 4.0D);
|
||||
List<EntityAnimal> animals = worldObj.getEntitiesWithinAABB(EntityAnimal.class, bb);
|
||||
for(EntityAnimal e : animals) {
|
||||
if (e.getGrowingAge() < 0)
|
||||
continue;
|
||||
|
||||
e.inLove = 600;
|
||||
for (int i = 0; i < 7; i++) {
|
||||
double var4 = rand.nextGaussian() * 0.02D;
|
||||
double var6 = rand.nextGaussian() * 0.02D;
|
||||
double var8 = rand.nextGaussian() * 0.02D;
|
||||
worldObj.spawnParticle("heart", e.posX + rand.nextFloat() * e.width * 2.0F - e.width, e.posY + 0.5D + rand.nextFloat() * e.height, e.posZ + rand.nextFloat() * e.width * 2.0F - e.width, var4, var6, var8);
|
||||
}
|
||||
}
|
||||
|
||||
setDead();
|
||||
}
|
||||
|
||||
private void spawnParticles() {
|
||||
double var8 = posX;
|
||||
double var10 = posY;
|
||||
double var12 = posZ;
|
||||
String var14 = "iconcrack_" + Item.potion.itemID;
|
||||
Random var7 = rand;
|
||||
for (int var15 = 0; var15 < 8; ++var15) {
|
||||
worldObj.spawnParticle(var14, var8, var10, var12, var7.nextGaussian() * 0.15D, var7.nextDouble() * 0.2D, var7.nextGaussian() * 0.15D);
|
||||
}
|
||||
float red = 1.0F;
|
||||
float green = 0.0F;
|
||||
float blue = 0.0F;
|
||||
String var19 = "spell";
|
||||
for (int var20 = 0; var20 < 100; ++var20) {
|
||||
double var39 = var7.nextDouble() * 4.0D;
|
||||
double var23 = var7.nextDouble() * Math.PI * 2.0D;
|
||||
double var25 = Math.cos(var23) * var39;
|
||||
double var27 = 0.01D + var7.nextDouble() * 0.5D;
|
||||
double var29 = Math.sin(var23) * var39;
|
||||
if (worldObj.isRemote) {
|
||||
EntityFX var31 = Minecraft.getMinecraft().renderGlobal.doSpawnParticle(var19, var8 + var25 * 0.1D, var10 + 0.3D, var12 + var29 * 0.1D, var25, var27, var29);
|
||||
if (var31 != null) {
|
||||
float var32 = 0.75F + var7.nextFloat() * 0.25F;
|
||||
var31.setRBGColorF(red * var32, green * var32, blue * var32);
|
||||
var31.multiplyVelocity((float)var39);
|
||||
}
|
||||
}
|
||||
}
|
||||
worldObj.playSoundEffect(posX + 0.5D, posY + 0.5D, posZ + 0.5D, "random.glass", 1.0F, worldObj.rand.nextFloat() * 0.1F + 0.9F);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* This class was created by <TheWhiteWolves>. It's distributed as
|
||||
* part of the Thaumic Tinkerer Mod.
|
||||
*
|
||||
* Thaumic Tinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* Thaumic Tinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [6 Jul 2013, 15:13:39 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.inventory.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.tinkerer.inventory.slot.SlotMobMagnet;
|
||||
import vazkii.tinkerer.item.ItemSoulMould;
|
||||
import vazkii.tinkerer.tile.TileEntityMobMagnet;
|
||||
|
||||
public class ContainerMobMagnet extends ContainerPlayerInv {
|
||||
|
||||
public TileEntityMobMagnet mobMagnet;
|
||||
|
||||
public ContainerMobMagnet(TileEntityMobMagnet mobMagnet, InventoryPlayer playerInv) {
|
||||
super(playerInv);
|
||||
|
||||
this.mobMagnet = mobMagnet;
|
||||
|
||||
addSlotToContainer(new SlotMobMagnet(mobMagnet, 0, 53, 37));
|
||||
|
||||
initPlayerInv();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
return mobMagnet.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot)inventorySlots.get(par2);
|
||||
|
||||
if (var4 != null && var4.getHasStack()) {
|
||||
ItemStack var5 = var4.getStack();
|
||||
|
||||
if(var5.getItem() instanceof ItemSoulMould) {
|
||||
var3 = var5.copy();
|
||||
|
||||
if (par2 < 1) {
|
||||
if(!mergeItemStack(var5, 1, 37, false))
|
||||
return null;
|
||||
} else if(!mergeItemStack(var5, 0, 1, false))
|
||||
return null;
|
||||
|
||||
if (var5.stackSize == 0)
|
||||
var4.putStack((ItemStack)null);
|
||||
else
|
||||
var4.onSlotChanged();
|
||||
|
||||
if (var5.stackSize == var3.stackSize)
|
||||
return null;
|
||||
|
||||
var4.onPickupFromSlot(par1EntityPlayer, var5);
|
||||
}
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* This class was created by <TheWhiteWolves>. It's distributed as
|
||||
* part of the Thaumic Tinkerer Mod.
|
||||
*
|
||||
* Thaumic Tinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* Thaumic Tinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [12 Jul 2013, 21:37:48 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.inventory.slot;
|
||||
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.tinkerer.item.ItemSoulMould;
|
||||
import vazkii.tinkerer.tile.TileEntityMobMagnet;
|
||||
|
||||
public class SlotMobMagnet extends Slot {
|
||||
|
||||
public SlotMobMagnet(TileEntityMobMagnet mobMagnet, int par2, int par3, int par4) {
|
||||
super(mobMagnet, par2, par3, par4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
if(par1ItemStack.getItem() instanceof ItemSoulMould) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [27 Jun 2013, 18:00:05 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.item;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.tinkerer.block.ModBlocks;
|
||||
|
||||
public class ItemBrightNitor extends ItemMod {
|
||||
|
||||
public ItemBrightNitor(int par1) {
|
||||
super(par1);
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) {
|
||||
int x = (int) par3Entity.posX;
|
||||
int y = (int) par3Entity.posY + 1;
|
||||
int z = (int) par3Entity.posZ;
|
||||
|
||||
if((par2World.getBlockId(x, y, z) == 0 || par2World.getBlockId(x, y, z) == ModBlocks.nitorGas.blockID) && !par2World.isRemote)
|
||||
par2World.setBlock(x, y, z, ModBlocks.nitorGas.blockID, 0, 2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
/**
|
||||
* This class was created by <TheWhiteWolves>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [20 May 2013, 19:35:05 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.common.aura.AuraManager;
|
||||
import vazkii.tinkerer.client.util.helper.IconHelper;
|
||||
import vazkii.tinkerer.lib.LibFeatures;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemCleansingTalisman extends ItemMod {
|
||||
|
||||
private Icon enabledIcon;
|
||||
private long timer = 0L;
|
||||
|
||||
private static final int[] POTIONS_TO_REMOVE = new int[] {
|
||||
Potion.blindness.id,
|
||||
Potion.confusion.id,
|
||||
Potion.poison.id,
|
||||
Potion.weakness.id,
|
||||
Potion.moveSlowdown.id,
|
||||
Potion.wither.id
|
||||
};
|
||||
|
||||
public ItemCleansingTalisman(int par1) {
|
||||
super(par1);
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if(par3EntityPlayer.isSneaking()) {
|
||||
int damage = par1ItemStack.getItemDamage();
|
||||
par1ItemStack.setItemDamage(damage == 0 ? 1 : 0);
|
||||
par2World.playSoundAtEntity(par3EntityPlayer, "random.orb", 0.3F, 0.1F);
|
||||
}
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) {
|
||||
if(par1ItemStack.getItemDamage() == 1 && !par2World.isRemote) {
|
||||
if(timer < System.currentTimeMillis()) {
|
||||
timer = System.currentTimeMillis() + 1000L;
|
||||
|
||||
if (par3Entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer)par3Entity;
|
||||
boolean removed = false;
|
||||
if(player.isBurning()) {
|
||||
player.extinguish();
|
||||
removed = true;
|
||||
} else for(int potion : POTIONS_TO_REMOVE) {
|
||||
if(player.isPotionActive(potion)) {
|
||||
player.removePotionEffect(potion);
|
||||
removed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(removed) {
|
||||
AuraManager.decreaseClosestAura(par2World, player.posX, player.posY, player.posZ, LibFeatures.CLEANSING_TALISMAN_VIS);
|
||||
par2World.playSoundAtEntity(player, "thaumcraft.wand", 0.3F, 0.1F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister par1IconRegister) {
|
||||
itemIcon = IconHelper.forItem(par1IconRegister, this, 0);
|
||||
enabledIcon = IconHelper.forItem(par1IconRegister, this, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
||||
if(par1ItemStack.getItemDamage() == 0)
|
||||
par3List.add(EnumChatFormatting.RED + "Inactive");
|
||||
else par3List.add(EnumChatFormatting.GREEN + "Active");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage(int par1) {
|
||||
return par1 == 1 ? enabledIcon : itemIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EnumRarity getRarity(ItemStack par1ItemStack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [26 Jul 2013, 02:22:00 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.item;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.tinkerer.lib.LibBlockNames;
|
||||
import vazkii.tinkerer.tile.TileEntityInterface;
|
||||
import vazkii.tinkerer.util.helper.ItemNBTHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemConnector extends ItemMod {
|
||||
|
||||
public ItemConnector(int par1) {
|
||||
super(par1);
|
||||
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
|
||||
if (par3World.isRemote)
|
||||
return false;
|
||||
|
||||
TileEntity tile = par3World.getBlockTileEntity(par4, par5, par6);
|
||||
|
||||
if (getY(par1ItemStack) == -1) {
|
||||
if (tile != null && tile instanceof TileEntityInterface) {
|
||||
setX(par1ItemStack, par4);
|
||||
setY(par1ItemStack, par5);
|
||||
setZ(par1ItemStack, par6);
|
||||
|
||||
if(par3World.isRemote)
|
||||
par2EntityPlayer.swingItem();
|
||||
|
||||
playSound(par3World, par4, par5, par6);
|
||||
par2EntityPlayer.addChatMessage("Location Bound!");
|
||||
} else
|
||||
par2EntityPlayer.addChatMessage("Not a " + LibBlockNames.INTERFACE_D + ".");
|
||||
} else {
|
||||
if (tile != null && tile instanceof TileEntityInterface) {
|
||||
par2EntityPlayer.addChatMessage("Can't bind an Interface to another.");
|
||||
return true;
|
||||
}
|
||||
|
||||
int x = getX(par1ItemStack);
|
||||
int y = getY(par1ItemStack);
|
||||
int z = getZ(par1ItemStack);
|
||||
|
||||
TileEntity tile1 = par3World.getBlockTileEntity(x, y, z);
|
||||
if (tile1 == null || !(tile1 instanceof TileEntityInterface)) {
|
||||
setY(par1ItemStack, -1);
|
||||
|
||||
par2EntityPlayer.addChatMessage(LibBlockNames.INTERFACE_D + " isn't present.");
|
||||
} else {
|
||||
TileEntityInterface interf = (TileEntityInterface) tile1;
|
||||
|
||||
if(Math.abs(x - par4) > 3 || Math.abs(y - par5) > 3 || Math.abs(z - par6) > 3) {
|
||||
par2EntityPlayer.addChatMessage("The Interface is too far away.");
|
||||
return true;
|
||||
}
|
||||
|
||||
interf.x = par4;
|
||||
interf.y = par5;
|
||||
interf.z = par6;
|
||||
|
||||
setY(par1ItemStack, -1);
|
||||
|
||||
if(par3World.isRemote)
|
||||
par2EntityPlayer.swingItem();
|
||||
|
||||
playSound(par3World, par4, par5, par6);
|
||||
par2EntityPlayer.addChatMessage("Locations bound!");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void playSound(World world, int x, int y, int z) {
|
||||
if(!world.isRemote)
|
||||
world.playSoundEffect(x, y, z, "random.orb", 0.8F, 1F);
|
||||
}
|
||||
|
||||
public static void setX(ItemStack stack, int x) {
|
||||
ItemNBTHelper.setInt(stack, "posx", x);
|
||||
}
|
||||
|
||||
public static void setY(ItemStack stack, int y) {
|
||||
ItemNBTHelper.setInt(stack, "posy", y);
|
||||
}
|
||||
|
||||
public static void setZ(ItemStack stack, int z) {
|
||||
ItemNBTHelper.setInt(stack, "posz", z);
|
||||
}
|
||||
|
||||
public static int getX(ItemStack stack) {
|
||||
return ItemNBTHelper.getInt(stack, "posx", 0);
|
||||
}
|
||||
|
||||
public static int getY(ItemStack stack) {
|
||||
return ItemNBTHelper.getInt(stack, "posy", -1);
|
||||
}
|
||||
|
||||
public static int getZ(ItemStack stack) {
|
||||
return ItemNBTHelper.getInt(stack, "posz", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [27 May 2013, 21:05:58 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemEnchantedBook;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import thaumcraft.client.gui.GuiInfusionWorkbench;
|
||||
import thaumcraft.client.gui.GuiResearchRecipe;
|
||||
import vazkii.tinkerer.util.helper.MiscHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemDummyEnchantbook extends ItemEnchantedBook {
|
||||
|
||||
public ItemDummyEnchantbook(int par1) {
|
||||
super(par1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
||||
if(MiscHelper.getMc().currentScreen != null && MiscHelper.getMc().currentScreen instanceof GuiResearchRecipe)
|
||||
return;
|
||||
|
||||
if(MiscHelper.getMc().currentScreen != null && !(MiscHelper.getMc().currentScreen instanceof GuiInfusionWorkbench)) {
|
||||
par3List.add("A dummy book for enchanting. It's an internal item");
|
||||
par3List.add("and is of no use to the player.");
|
||||
} else par3List.add("This book will be enchanted upon creation.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack par1ItemStack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemDisplayName(ItemStack par1ItemStack) {
|
||||
return Item.enchantedBook.getItemDisplayName(par1ItemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage(int par1) {
|
||||
return Item.enchantedBook.getIconFromDamage(par1);
|
||||
}
|
||||
}
|
||||
@@ -70,6 +70,8 @@ public class ItemFireBracelet extends ItemMod {
|
||||
par3World.playSoundAtEntity(par2EntityPlayer, "thaumcraft.brain", 1F, 1F);
|
||||
|
||||
did = true;
|
||||
onItemUseFirst(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10);
|
||||
|
||||
return did;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [20 May 2013, 22:15:39 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.item;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagInt;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.EnumTag;
|
||||
import thaumcraft.api.ObjectTags;
|
||||
import thaumcraft.api.aura.AuraNode;
|
||||
import thaumcraft.common.items.ItemThaumometer;
|
||||
import vazkii.tinkerer.util.helper.MiscHelper;
|
||||
import vazkii.tinkerer.util.helper.ModCreativeTab;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemFluxDetector extends ItemThaumometer {
|
||||
|
||||
private static final String TAG_OBJECT_TAGS_CMP = "tagsCmp";
|
||||
private static final String TAG_OBJECT_TAG = "tag%s";
|
||||
private static final String TAG_OBJECT_TAG_REPLACE = "tag";
|
||||
|
||||
public ItemFluxDetector(int par1) {
|
||||
super(par1);
|
||||
setCreativeTab(ModCreativeTab.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) {
|
||||
if(!par2World.isRemote) {
|
||||
AuraNode node = MiscHelper.getClosestNode(par2World, par3Entity.posX, par3Entity.posY, par3Entity.posZ);
|
||||
setTagCompoundForNode(par1ItemStack, node);
|
||||
}
|
||||
}
|
||||
|
||||
private void setTagCompoundForNode(ItemStack stack, AuraNode node) {
|
||||
NBTTagCompound cmp = new NBTTagCompound();
|
||||
|
||||
if(node == null) {
|
||||
if(stack.hasTagCompound())
|
||||
cmp.setCompoundTag(TAG_OBJECT_TAGS_CMP, new NBTTagCompound());
|
||||
} else {
|
||||
NBTTagCompound cmp1 = new NBTTagCompound();
|
||||
ObjectTags flux = node.flux;
|
||||
if(flux != null && flux.getAspects().length > 0) // Nice clean aura :D
|
||||
for(EnumTag tag : flux.getAspects())
|
||||
if(tag != null)
|
||||
cmp1.setInteger(String.format(TAG_OBJECT_TAG, tag.id), flux.getAmount(tag));
|
||||
cmp.setCompoundTag(TAG_OBJECT_TAGS_CMP, cmp1);
|
||||
stack.setTagCompound(cmp);
|
||||
}
|
||||
}
|
||||
|
||||
public static ObjectTags getTags(ItemStack stack) {
|
||||
if(stack.hasTagCompound()) {
|
||||
NBTTagCompound cmp = stack.getTagCompound();
|
||||
if(cmp.hasKey(TAG_OBJECT_TAGS_CMP)) {
|
||||
NBTTagCompound cmp1 = cmp.getCompoundTag(TAG_OBJECT_TAGS_CMP);
|
||||
if(cmp1 != null) {
|
||||
ObjectTags tags = new ObjectTags();
|
||||
Collection<NBTBase> cmpTags = cmp1.getTags();
|
||||
for(NBTBase tag : cmpTags) {
|
||||
if(tag instanceof NBTTagInt) {
|
||||
NBTTagInt integer = (NBTTagInt) tag;
|
||||
int tagID = Integer.parseInt(tag.getName().replaceAll(TAG_OBJECT_TAG_REPLACE, ""));
|
||||
int amount = integer.data;
|
||||
tags.add(EnumTag.get(tagID), amount);
|
||||
}
|
||||
}
|
||||
|
||||
return tags;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getShareTag() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage(int par1) {
|
||||
return iconRing;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [20 May 2013, 21:01:32 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.item;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.tinkerer.block.BlockGas;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemGasRemover extends ItemMod {
|
||||
|
||||
public ItemGasRemover(int par1) {
|
||||
super(par1);
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if(par3EntityPlayer.isSneaking()) {
|
||||
int xs = (int) par3EntityPlayer.posX;
|
||||
int ys = (int) par3EntityPlayer.posY;
|
||||
int zs = (int) par3EntityPlayer.posZ;
|
||||
|
||||
for(int x = xs - 2; x < xs + 2; x++)
|
||||
for(int y = ys - 3; y < ys + 3; y++)
|
||||
for(int z = zs - 2; z < zs + 2; z++) {
|
||||
int id = par2World.getBlockId(x, y, z);
|
||||
if(Block.blocksList[id] != null && Block.blocksList[id] instanceof BlockGas) {
|
||||
BlockGas gas = (BlockGas) Block.blocksList[id];
|
||||
gas.placeParticle(par2World, x, y, z);
|
||||
par2World.setBlock(x, y, z, 0, 0, 1 | 2);
|
||||
}
|
||||
}
|
||||
|
||||
par2World.playSoundAtEntity(par3EntityPlayer, "thaumcraft.wand", 0.2F, 1F);
|
||||
}
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EnumRarity getRarity(ItemStack par1ItemStack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
}
|
||||
@@ -16,12 +16,15 @@ package vazkii.tinkerer.item;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import thaumcraft.api.IVisDiscounter;
|
||||
import thaumcraft.api.IVisRepairable;
|
||||
import thaumcraft.api.ThaumcraftApi;
|
||||
import thaumcraft.common.aura.AuraManager;
|
||||
import vazkii.tinkerer.client.util.helper.IconHelper;
|
||||
import vazkii.tinkerer.lib.LibResources;
|
||||
import vazkii.tinkerer.util.handler.PlayerDamageHandler;
|
||||
@@ -29,7 +32,7 @@ import vazkii.tinkerer.util.helper.ModCreativeTab;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemGoliathLegs extends ItemArmor implements IVisDiscounter {
|
||||
public class ItemGoliathLegs extends ItemArmor implements IVisRepairable, IVisDiscounter {
|
||||
|
||||
public ItemGoliathLegs(int par1) {
|
||||
super(par1, ThaumcraftApi.armorMatSpecial, 0, 2);
|
||||
@@ -59,4 +62,12 @@ public class ItemGoliathLegs extends ItemArmor implements IVisDiscounter {
|
||||
public int getVisDiscount() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRepair(ItemStack stack, Entity player)
|
||||
{
|
||||
if (AuraManager.decreaseClosestAura(player.worldObj, player.posX, player.posY, player.posZ, 1)) {
|
||||
stack.damageItem(-1, (EntityLiving)player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [26 Jul 2013, 15:27:45 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.item;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
public class ItemIceGlobe extends ItemMod {
|
||||
|
||||
public ItemIceGlobe(int par1) {
|
||||
super(par1);
|
||||
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
|
||||
if(!(entity instanceof EntityLiving))
|
||||
return false;
|
||||
|
||||
EntityLiving living = (EntityLiving) entity;
|
||||
|
||||
if(!living.func_104002_bU()) { // Check if presistanceRequired
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||
ReflectionHelper.setPrivateValue(EntityLiving.class, living, true, 72); // Set presistanceRequired to true
|
||||
if(!player.worldObj.isRemote)
|
||||
player.worldObj.playSoundAtEntity(entity, "mob.zombie.remedy", 1F, 1F);
|
||||
} else {
|
||||
if(player.worldObj.isRemote)
|
||||
player.addChatMessage("This entity is already preserved.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [3 Jul 2013, 17:45:49 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.item;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.tinkerer.entity.EntityLovePotion;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemLovePotion extends ItemMod {
|
||||
|
||||
public ItemLovePotion(int par1) {
|
||||
super(par1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if(!par2World.isRemote) {
|
||||
EntityLovePotion entity = new EntityLovePotion(par2World, par3EntityPlayer);
|
||||
par2World.spawnEntityInWorld(entity);
|
||||
par1ItemStack.stackSize--;
|
||||
}
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EnumRarity getRarity(ItemStack par1ItemStack) {
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [27 May 2013, 19:16:25 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.item;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.common.blocks.BlockWardedItem;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemPhantomStoneBlock extends BlockWardedItem {
|
||||
|
||||
public ItemPhantomStoneBlock(int par1) {
|
||||
super(par1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean hasEffect(ItemStack par1ItemStack) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [3 Jul 2013, 01:15:43 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.item;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import vazkii.tinkerer.util.handler.RainwaterBottleHandler;
|
||||
|
||||
public class ItemRainwaterBottle extends ItemMod {
|
||||
|
||||
public ItemRainwaterBottle(int par1) {
|
||||
super(par1);
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new RainwaterBottleHandler());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration(ItemStack par1ItemStack) {
|
||||
return 32;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
|
||||
return EnumAction.drink;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
par3EntityPlayer.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack));
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode) {
|
||||
--par1ItemStack.stackSize;
|
||||
|
||||
if (par1ItemStack.stackSize <= 0)
|
||||
return new ItemStack(Item.glassBottle);
|
||||
|
||||
par3EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Item.glassBottle));
|
||||
}
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [29 Jun 2013, 20:45:47 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import thaumcraft.api.EnumTag;
|
||||
import vazkii.tinkerer.client.util.helper.IconHelper;
|
||||
import vazkii.tinkerer.lib.LibItemNames;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemRune extends ItemMod {
|
||||
|
||||
Icon crackIcon;
|
||||
|
||||
public ItemRune(int par1) {
|
||||
super(par1);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
for(EnumTag tag : EnumTag.class.getEnumConstants())
|
||||
if(tag != EnumTag.UNKNOWN)
|
||||
par3List.add(new ItemStack(par1, 1, tag.getId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister par1IconRegister) {
|
||||
itemIcon = IconHelper.forItem(par1IconRegister, this, 0);
|
||||
crackIcon = IconHelper.forItem(par1IconRegister, this, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamageForRenderPass(int par1, int par2) {
|
||||
return par2 == 1 ? crackIcon : itemIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack par1ItemStack, int par2) {
|
||||
return par2 == 0 ? 0xFFFFFF : EnumTag.get(par1ItemStack.getItemDamage()).color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemDisplayName(ItemStack par1ItemStack) {
|
||||
return LibItemNames.RUNE_D + EnumTag.get(par1ItemStack.getItemDamage()).name;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
||||
par3List.add(EnumTag.get(par1ItemStack.getItemDamage()).meaning);
|
||||
par3List.add("Not Yet Implemented!");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EnumRarity getRarity(ItemStack par1ItemStack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [2 Jul 2013, 19:46:26 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.IVisRepairable;
|
||||
import thaumcraft.api.ThaumcraftApi;
|
||||
import thaumcraft.common.aura.AuraManager;
|
||||
import vazkii.tinkerer.client.util.helper.IconHelper;
|
||||
import vazkii.tinkerer.util.helper.ModCreativeTab;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemScythe extends ItemSword implements IVisRepairable {
|
||||
|
||||
public ItemScythe(int par1) {
|
||||
super(par1, ThaumcraftApi.toolMatThaumium);
|
||||
setCreativeTab(ModCreativeTab.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister par1IconRegister) {
|
||||
itemIcon = IconHelper.forItem(par1IconRegister, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRepair(ItemStack stack, Entity e) {
|
||||
if (AuraManager.decreaseClosestAura(e.worldObj, e.posX, e.posY, e.posZ, 1))
|
||||
stack.damageItem(-1, (EntityLiving) e);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EnumRarity getRarity(ItemStack par1ItemStack) {
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int id, int par4, int par5, int par6, EntityLiving par7EntityLiving) {
|
||||
boolean target = false;
|
||||
|
||||
if(id == Block.tallGrass.blockID) {
|
||||
for(int i = 0; i < 3; i++)
|
||||
for(int j = 0; j < 3; j++) {
|
||||
int x = par4 + i - 1;
|
||||
int y = par5;
|
||||
int z = par6 + j - 1;
|
||||
int id1 = par2World.getBlockId(x, y, z);
|
||||
int meta = par2World.getBlockMetadata(x, y, z);
|
||||
if(id1 == Block.tallGrass.blockID && !par2World.isRemote) {
|
||||
ArrayList<ItemStack> drops = Block.tallGrass.getBlockDropped(par2World, x, y, z, meta, 0);
|
||||
for(ItemStack item : drops) {
|
||||
EntityItem entityItem = new EntityItem(par2World, x + 0.5, y + 0.5, z + 0.5, item);
|
||||
par2World.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
par2World.setBlockToAir(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
target = true;
|
||||
}
|
||||
|
||||
if(Block.blocksList[id].isLeaves(par2World, par4, par5, par6)) {
|
||||
Block block = Block.blocksList[id];
|
||||
for(int i = 0; i < 3; i++)
|
||||
for(int j = 0; j < 3; j++)
|
||||
for(int k = 0; k < 3; k++) {
|
||||
int x = par4 + i - 1;
|
||||
int y = par5 + j - 1;
|
||||
int z = par6 + k - 1;
|
||||
int id1 = par2World.getBlockId(x, y, z);
|
||||
int meta = par2World.getBlockMetadata(x, y, z);
|
||||
if(id1 == id && block.isLeaves(par2World, x, y, z) && !par2World.isRemote) {
|
||||
ArrayList<ItemStack> drops = block.getBlockDropped(par2World, x, y, z, meta, 0);
|
||||
for(ItemStack item : drops) {
|
||||
EntityItem entityItem = new EntityItem(par2World, x + 0.5, y + 0.5, z + 0.5, item);
|
||||
par2World.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
par2World.setBlockToAir(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
target = true;
|
||||
}
|
||||
|
||||
if (Block.blocksList[id].getBlockHardness(par2World, par4, par5, par6) != 0 && !target)
|
||||
par1ItemStack.damageItem(1, par7EntityLiving);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block) {
|
||||
return par2Block.blockMaterial == Material.leaves ? 8F : super.getStrVsBlock(par1ItemStack, par2Block);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [29 May 2013, 20:52:44 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.common.Config;
|
||||
import thaumcraft.common.research.ResearchManager;
|
||||
import vazkii.tinkerer.util.helper.ItemNBTHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemShareTome extends ItemMod {
|
||||
|
||||
private static final String TAG_PLAYER = "player";
|
||||
private static final String NON_ASIGNED = "[Not Assigned]";
|
||||
|
||||
private static final String[] INFO = new String[] {
|
||||
"This is a creative only item.",
|
||||
"It can be right clicked by a player",
|
||||
"to keep their research. After this,",
|
||||
"another player can right click it",
|
||||
"and they'll learn all that the other",
|
||||
"player knew. This is good for co-op playing.",
|
||||
"Have fun - Vazkii"
|
||||
};
|
||||
|
||||
public ItemShareTome(int par1) {
|
||||
super(par1);
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
String name = getPlayerName(par1ItemStack);
|
||||
if(name.endsWith(NON_ASIGNED)) {
|
||||
setPlayerName(par1ItemStack, par3EntityPlayer.username);
|
||||
if(!par2World.isRemote)
|
||||
par3EntityPlayer.addChatMessage("Research Data Written!");
|
||||
} else {
|
||||
sync : {
|
||||
List<String> researchesDone = ResearchManager.getCompletedResearch(name);
|
||||
|
||||
if(researchesDone == null) {
|
||||
if(!par2World.isRemote)
|
||||
par3EntityPlayer.addChatMessage(name + "is not online. Research could not be acquired.");
|
||||
break sync;
|
||||
}
|
||||
|
||||
for(String key : researchesDone)
|
||||
ResearchManager.completeResearch(par3EntityPlayer, key);
|
||||
|
||||
if(!par2World.isRemote)
|
||||
par3EntityPlayer.addChatMessage("Research Data Synced!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EnumRarity getRarity(ItemStack par1ItemStack) {
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage(int par1) {
|
||||
return Config.itemThaumonomicon.getIconFromDamage(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean hasEffect(ItemStack par1ItemStack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
||||
String name = getPlayerName(par1ItemStack);
|
||||
par3List.add(name.equals(NON_ASIGNED) ? name : "Bound to " + name + "'s research.");
|
||||
if(GuiScreen.isShiftKeyDown())
|
||||
for(String s : INFO)
|
||||
par3List.add(s);
|
||||
|
||||
else par3List.add("Press SHIFT for more info.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getShareTag() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private String getPlayerName(ItemStack stack) {
|
||||
return ItemNBTHelper.getString(stack, TAG_PLAYER, NON_ASIGNED);
|
||||
}
|
||||
|
||||
private void setPlayerName(ItemStack stack, String playerName) {
|
||||
ItemNBTHelper.setString(stack, TAG_PLAYER, playerName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* This class was created by <TheWhiteWolves>. It's distributed as
|
||||
* part of the Thaumic Tinkerer Mod.
|
||||
*
|
||||
* Thaumic Tinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* Thaumic Tinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [7 Jul 2013, 13:58:53 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.tinkerer.util.handler.EntityInteractionHandler;
|
||||
import vazkii.tinkerer.util.helper.ItemNBTHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
||||
public class ItemSoulMould extends ItemMod {
|
||||
|
||||
private static final String TAG_PATTERN = "pattern";
|
||||
private static final String NON_ASSIGNED = "Blank";
|
||||
public ItemSoulMould(int par1) {
|
||||
super(par1);
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean itemInteractionForEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving) {
|
||||
EntityPlayer player = EntityInteractionHandler.getLastInteractingPlayer();
|
||||
if(player != null) {
|
||||
setPattern(player.getCurrentEquippedItem(), par2EntityLiving);
|
||||
}
|
||||
else {
|
||||
setPattern(par1ItemStack, par2EntityLiving);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if(par3EntityPlayer.isSneaking()) {
|
||||
clearPattern(par1ItemStack);
|
||||
}
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
||||
String name = getPatternName(par1ItemStack);
|
||||
par3List.add(EnumChatFormatting.GOLD + "Current Pattern: " + name);
|
||||
}
|
||||
|
||||
private void setPattern(ItemStack par1ItemStack, EntityLiving par2EntityLiving) {
|
||||
ItemNBTHelper.setString(par1ItemStack, TAG_PATTERN, par2EntityLiving.getEntityName());
|
||||
}
|
||||
|
||||
public String getPatternName(ItemStack par1ItemStack) {
|
||||
return ItemNBTHelper.getString(par1ItemStack, TAG_PATTERN, NON_ASSIGNED);
|
||||
}
|
||||
|
||||
private void clearPattern(ItemStack par1ItemStack) {
|
||||
ItemNBTHelper.getNBT(par1ItemStack).removeTag(TAG_PATTERN);
|
||||
}
|
||||
}
|
||||
@@ -46,12 +46,9 @@ public class ItemSpellCloth extends ItemMod {
|
||||
|
||||
@Override
|
||||
public ItemStack getContainerItemStack(ItemStack itemStack) {
|
||||
ItemStack copyStack = itemStack.copy();
|
||||
copyStack.setItemDamage(copyStack.getItemDamage() + 1);
|
||||
if(copyStack.getItemDamage() >= copyStack.getMaxDamage())
|
||||
return null;
|
||||
itemStack.setItemDamage(itemStack.getItemDamage() + 1);
|
||||
|
||||
return copyStack;
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,6 +21,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.FoodStats;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.FakePlayer;
|
||||
import thaumcraft.common.aura.AuraManager;
|
||||
@@ -161,8 +162,8 @@ public class ItemStopwatch extends ItemMod {
|
||||
player.motionY = motionY;
|
||||
player.motionZ = motionZ;
|
||||
player.setEntityHealth(health);
|
||||
player.getFoodStats().setFoodLevel(food);
|
||||
player.getFoodStats().setFoodSaturationLevel(saturation);
|
||||
FoodStats foodStats = player.getFoodStats();
|
||||
foodStats.addStats(food - foodStats.getFoodLevel(), saturation - foodStats.getSaturationLevel());
|
||||
}
|
||||
|
||||
private static void wipeData(ItemStack stack, Entity player) {
|
||||
|
||||
@@ -28,6 +28,7 @@ import thaumcraft.common.items.wands.ItemWandTrade;
|
||||
import vazkii.tinkerer.ThaumicTinkerer;
|
||||
import vazkii.tinkerer.client.util.helper.IconHelper;
|
||||
import vazkii.tinkerer.lib.LibFeatures;
|
||||
import vazkii.tinkerer.util.handler.ConfigurationHandler;
|
||||
import vazkii.tinkerer.util.helper.ItemNBTHelper;
|
||||
import vazkii.tinkerer.util.helper.ModCreativeTab;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -101,7 +102,7 @@ public class ItemWandDislocation extends ItemWandTrade {
|
||||
}
|
||||
arg2.playSoundAtEntity(arg1, "thaumcraft.wand", 0.5F, 1F);
|
||||
}
|
||||
} else if(!ThaumcraftApi.portableHoleBlackList.contains(id) && Block.blocksList[id] != null && Block.blocksList[id].getBlockHardness(arg2, arg3, arg4, arg5) != -1F) {
|
||||
} else if((tile == null || ConfigurationHandler.wandDislocationTiles) && !ThaumcraftApi.portableHoleBlackList.contains(id) && Block.blocksList[id] != null && Block.blocksList[id].getBlockHardness(arg2, arg3, arg4, arg5) != -1F) {
|
||||
arg2.removeBlockTileEntity(arg3, arg4, arg5);
|
||||
arg2.setBlock(arg3, arg4, arg5, 0, 0, 1 | 2);
|
||||
storePickedBlock(arg0, (short) id, (short) meta, tile);
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ItemWandTinkerer extends ItemWandCasting {
|
||||
|
||||
@Override
|
||||
public int getRechargeInterval() {
|
||||
return 9;
|
||||
return 12;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [3 Jul 2013, 13:25:14 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.tinkerer.client.util.helper.IconHelper;
|
||||
import vazkii.tinkerer.lib.LibItemNames;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemWeatherCrystal extends ItemMod {
|
||||
|
||||
Icon[] icons = new Icon[2];
|
||||
|
||||
public ItemWeatherCrystal(int par1) {
|
||||
super(par1);
|
||||
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister par1IconRegister) {
|
||||
for(int i = 0; i < icons.length; i++)
|
||||
icons[i] = IconHelper.forItem(par1IconRegister, this, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage(int par1) {
|
||||
return par1 >= icons.length ? itemIcon : icons[par1];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
for(int i = 0; i < icons.length; i++)
|
||||
par3List.add(new ItemStack(par1, 1, i));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EnumRarity getRarity(ItemStack par1ItemStack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemDisplayName(ItemStack par1ItemStack) {
|
||||
return par1ItemStack.getItemDamage() == 0 ? LibItemNames.WEATHER_CRYSTAL_D0 : LibItemNames.WEATHER_CRYSTAL_D1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
boolean raining = par2World.getWorldInfo().isRaining();
|
||||
boolean removeRain = par1ItemStack.getItemDamage() == 0;
|
||||
|
||||
if(raining == removeRain) {
|
||||
if(!par2World.isRemote)
|
||||
par2World.getWorldInfo().setRaining(!removeRain);
|
||||
|
||||
par3EntityPlayer.renderBrokenItemStack(par1ItemStack);
|
||||
par1ItemStack.stackSize--;
|
||||
}
|
||||
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,20 @@ public final class ModItems {
|
||||
public static Item enderMirror;
|
||||
public static Item goliathLegs;
|
||||
public static Item darkGas;
|
||||
public static Item gasRemover;
|
||||
public static Item cleansingTalisman;
|
||||
public static Item fluxDetector;
|
||||
public static Item dummyEnchantbook;
|
||||
public static Item researchShareBook;
|
||||
public static Item brightNitor;
|
||||
public static Item rune;
|
||||
public static Item scythe;
|
||||
public static Item rainwaterBottle;
|
||||
public static Item weatherCrystal;
|
||||
public static Item lovePotion;
|
||||
public static Item soulMould;
|
||||
public static Item connector;
|
||||
public static Item iceGlobe;
|
||||
|
||||
public static void initItems() {
|
||||
wandTinkerer = new ItemWandTinkerer(LibItemIDs.idWandTinkerer).setUnlocalizedName(LibItemNames.WAND_TINKERER);
|
||||
@@ -65,6 +79,20 @@ public final class ModItems {
|
||||
enderMirror = new ItemEnderMirror(LibItemIDs.idEnderMirror).setUnlocalizedName(LibItemNames.ENDER_MIRROR);
|
||||
goliathLegs = new ItemGoliathLegs(LibItemIDs.idGoliathLegs).setUnlocalizedName(LibItemNames.GOLIATH_LEGS);
|
||||
darkGas = new ItemGas(LibItemIDs.idDarkGas, ModBlocks.darkGas).setUnlocalizedName(LibItemNames.DARK_GAS);
|
||||
gasRemover = new ItemGasRemover(LibItemIDs.idGasRemover).setUnlocalizedName(LibItemNames.GAS_REMOVER);
|
||||
cleansingTalisman = new ItemCleansingTalisman(LibItemIDs.idCleansingTalisman).setUnlocalizedName(LibItemNames.CLEANSING_TALISMAN);
|
||||
fluxDetector = new ItemFluxDetector(LibItemIDs.idFluxDetector).setUnlocalizedName(LibItemNames.FLUX_DETECTOR);
|
||||
dummyEnchantbook = new ItemDummyEnchantbook(LibItemIDs.idDummyEnchantbook).setUnlocalizedName(LibItemNames.DUMMY_ENCHANTBOOK);
|
||||
researchShareBook = new ItemShareTome(LibItemIDs.idResearchShareBook).setUnlocalizedName(LibItemNames.RESEARCH_SHARE_BOOK);
|
||||
brightNitor = new ItemBrightNitor(LibItemIDs.idBrightNitor).setUnlocalizedName(LibItemNames.BRIGHT_NITOR);
|
||||
rune = new ItemRune(LibItemIDs.idRune).setUnlocalizedName(LibItemNames.RUNE);
|
||||
scythe = new ItemScythe(LibItemIDs.idScythe).setUnlocalizedName(LibItemNames.SCYTHE);
|
||||
rainwaterBottle = new ItemRainwaterBottle(LibItemIDs.idRainwaterBottle).setUnlocalizedName(LibItemNames.RAINWATER_BOTTLE);
|
||||
weatherCrystal = new ItemWeatherCrystal(LibItemIDs.idWeatherCrystal).setUnlocalizedName(LibItemNames.WEATHER_CRYSTAL);
|
||||
lovePotion = new ItemLovePotion(LibItemIDs.idLovePotion).setUnlocalizedName(LibItemNames.LOVE_POTION);
|
||||
soulMould = new ItemSoulMould(LibItemIDs.idSoulMould).setUnlocalizedName(LibItemNames.SOUL_MOULD);
|
||||
connector = new ItemConnector(LibItemIDs.idConnector).setUnlocalizedName(LibItemNames.CONNECTOR);
|
||||
iceGlobe = new ItemIceGlobe(LibItemIDs.idIceGlobe).setUnlocalizedName(LibItemNames.ICE_GLOBE);
|
||||
|
||||
nameItems();
|
||||
}
|
||||
@@ -88,6 +116,17 @@ public final class ModItems {
|
||||
LanguageRegistry.addName(enderMirror, LibItemNames.ENDER_MIRROR_D);
|
||||
LanguageRegistry.addName(goliathLegs, LibItemNames.GOLIATH_LEGS_D);
|
||||
LanguageRegistry.addName(darkGas, LibItemNames.DARK_GAS_D);
|
||||
LanguageRegistry.addName(gasRemover, LibItemNames.GAS_REMOVER_D);
|
||||
LanguageRegistry.addName(cleansingTalisman, LibItemNames.CLEANSING_TALISMAN_D);
|
||||
LanguageRegistry.addName(fluxDetector, LibItemNames.FLUX_DETECTOR_D);
|
||||
LanguageRegistry.addName(researchShareBook, LibItemNames.RESEARCH_SHARE_BOOK_D);
|
||||
LanguageRegistry.addName(brightNitor, LibItemNames.BRIGHT_NITOR_D);
|
||||
LanguageRegistry.addName(scythe, LibItemNames.SCYTHE_D);
|
||||
LanguageRegistry.addName(rainwaterBottle, LibItemNames.RAINWATER_BOTTLE_D);
|
||||
LanguageRegistry.addName(lovePotion, LibItemNames.LOVE_POTION_D);
|
||||
LanguageRegistry.addName(soulMould, LibItemNames.SOUL_MOULD_D);
|
||||
LanguageRegistry.addName(connector, LibItemNames.CONNECTOR_D);
|
||||
LanguageRegistry.addName(iceGlobe, LibItemNames.ICE_GLOBE_D);
|
||||
}
|
||||
|
||||
public static void applyObjectTags() {
|
||||
@@ -126,5 +165,19 @@ public final class ModItems {
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.DARK, 1);
|
||||
ThaumcraftApi.registerComplexObjectTag(darkQuartz.itemID, LibMisc.TAG_META_WILDCARD, tags);
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.HEAL, 16).add(EnumTag.KNOWLEDGE, 18).add(EnumTag.WATER, 6).add(EnumTag.MAGIC, 10).add(EnumTag.TOOL, 12);
|
||||
ThaumcraftApi.registerObjectTag(cleansingTalisman.itemID, LibMisc.TAG_META_WILDCARD, tags);
|
||||
|
||||
for(EnumTag tag : EnumTag.class.getEnumConstants()) {
|
||||
tags = new ObjectTags().add(tag, 1);
|
||||
ThaumcraftApi.registerObjectTag(rune.itemID, tag.id, tags);
|
||||
}
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.WEATHER, 2).add(EnumTag.WATER, 1).add(EnumTag.CRYSTAL, 1);
|
||||
ThaumcraftApi.registerObjectTag(rainwaterBottle.itemID, LibMisc.TAG_META_WILDCARD, tags);
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.LIFE, 4).add(EnumTag.KNOWLEDGE, 6).add(EnumTag.CRYSTAL, 2).add(EnumTag.SPIRIT, 4);
|
||||
ThaumcraftApi.registerObjectTag(soulMould.itemID, LibMisc.TAG_META_WILDCARD, tags);
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,11 @@ public final class LibBlockIDs {
|
||||
public static final int DEFAULT_DARK_QUARTZ_STAIRS = 2156;
|
||||
public static final int DEFAULT_DARK_QUARTZ_SLAB_FULL = 2157;
|
||||
public static final int DEFAULT_DARK_GAS = 2158;
|
||||
public static final int DEFAULT_PHANTOM_STONE = 2159;
|
||||
public static final int DEFAULT_NITOR_GAS = 2160;
|
||||
public static final int DEFAULT_MAGNET = 2161;
|
||||
public static final int DEFAULT_MOB_MAGNET = 2162;
|
||||
public static final int DEFAULT_INTERFACE = 2163;
|
||||
|
||||
public static int idGlowstoneGas;
|
||||
public static int idTransmutator;
|
||||
@@ -35,4 +40,9 @@ public final class LibBlockIDs {
|
||||
public static int idDarkQuartzSlabFull;
|
||||
public static int idAnimationTablet;
|
||||
public static int idDarkGas;
|
||||
}
|
||||
public static int idPhantomStone;
|
||||
public static int idNitorGas;
|
||||
public static int idMagnet;
|
||||
public static int idMobMagnet;
|
||||
public static int idInterface;
|
||||
}
|
||||
@@ -50,6 +50,24 @@ public final class LibBlockNames {
|
||||
|
||||
public static final String DARK_GAS = LibItemNames.DARK_GAS;
|
||||
|
||||
public static final String PHANTOM_STONE = "phantomStone";
|
||||
public static final String PHANTOM_STONE_R = "PHANTOM_STONE";
|
||||
public static final String PHANTOM_STONE_D = "Phantom Stone Block";
|
||||
|
||||
public static final String NITOR_GAS = "nitorGas";
|
||||
|
||||
public static final String MAGNET = "magnet";
|
||||
public static final String MAGNET_R = "MAGNET";
|
||||
public static final String MAGNET_D = "Thaumostatic Magnetizer";
|
||||
|
||||
public static final String MOB_MAGNET = "mobMagnet";
|
||||
public static final String MOB_MAGNET_R = "MOB_MAGNET";
|
||||
public static final String MOB_MAGNET_D = "Advanced Thaumostatic Magnetizer";
|
||||
|
||||
public static final String INTERFACE = "interface";
|
||||
public static final String INTERFACE_R = "INTERFACE";
|
||||
public static final String INTERFACE_D = "Transvector Interface";
|
||||
|
||||
public static final String[] DARK_QUARTZ_BLOCK_NAMES = {
|
||||
"Block of Smokey Quartz",
|
||||
"Chiseled Smokey Quartz Block",
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [25 May 2013, 11:06:36 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.lib;
|
||||
|
||||
public final class LibEnchantmentIDs {
|
||||
|
||||
public static final int DEFAULT_FREEZING = 215;
|
||||
public static final int DEFAULT_SOULBRINGER = 216;
|
||||
public static final int DEFAULT_VAMPIRISM = 217;
|
||||
public static final int DEFAULT_ASHES = 218;
|
||||
|
||||
public static int freezing;
|
||||
public static int soulbringer;
|
||||
public static int vampirism;
|
||||
public static int ashes;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [25 May 2013, 11:07:24 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.lib;
|
||||
|
||||
public final class LibEnchantmentNames {
|
||||
|
||||
public static final String FREEZING = "freezing";
|
||||
public static final String FREEZING_R = "ENCHANT_FREEZING";
|
||||
public static final String FREEZING_D = "Freezing";
|
||||
|
||||
public static final String SOULBRINGER = "soulbringer";
|
||||
public static final String SOULBRINGER_R = "ENCHANT_SOULBRINGER";
|
||||
public static final String SOULBRINGER_D = "Soulbringer";
|
||||
|
||||
public static final String VAMPIRISM = "vampirism";
|
||||
public static final String VAMPIRISM_R = "ENCHANT_VAMPIRISM";
|
||||
public static final String VAMPIRISM_D = "Vampirism";
|
||||
|
||||
public static final String ASHES = "ashes";
|
||||
public static final String ASHES_R = "ENCHANT_ASHES";
|
||||
public static final String ASHES_D = "Ashes";
|
||||
|
||||
public static final String LOST_ENCHANTS_RESEARCH_NAME = "LOST_ENCHANTS";
|
||||
}
|
||||
@@ -38,4 +38,6 @@ public final class LibFeatures {
|
||||
public static final int ENDER_MIRROR_COST = 1;
|
||||
|
||||
public static final int GOLIATH_LEGS_MAX_SAFETY = 5;
|
||||
|
||||
public static final int CLEANSING_TALISMAN_VIS = 10;
|
||||
}
|
||||
@@ -18,5 +18,5 @@ public final class LibGuiIDs {
|
||||
|
||||
public static final int ID_TRANSMUTATOR = 0;
|
||||
public static final int ID_ANIMATION_TABLET = 1;
|
||||
|
||||
public static final int ID_MOB_MAGNET = 2;
|
||||
}
|
||||
@@ -20,6 +20,20 @@ public final class LibItemIDs {
|
||||
public static final int DEFAULT_ENDER_MIRROR = 21165;
|
||||
public static final int DEFAULT_GOLIATH_LEGS = 21166;
|
||||
public static final int DEFAULT_DARK_GAS = 21167;
|
||||
public static final int DEFAULT_GAS_REMOVER = 21168;
|
||||
public static final int DEFAULT_FLUX_DETECTOR = 21169;
|
||||
public static final int DEFAULT_CLEANSING_TALISMAN = 21170;
|
||||
public static final int DEFAULT_DUMMY_ENCHANTBOOK = 21171;
|
||||
public static final int DEFAULT_RESEARCH_SHARE_BOOK = 21172;
|
||||
public static final int DEFAULT_BRIGHT_NITOR = 21173;
|
||||
public static final int DEFAULT_RUNE = 21174;
|
||||
public static final int DEFAULT_SCYTHE = 21175;
|
||||
public static final int DEFAULT_RAINWATER_BOTTLE = 21176;
|
||||
public static final int DEFAULT_WEATHER_CRYSTAL = 21177;
|
||||
public static final int DEFAULT_LOVE_POTION = 21178;
|
||||
public static final int DEFAULT_SOUL_MOULD = 21179;
|
||||
public static final int DEFAULT_CONNECTOR = 21180;
|
||||
public static final int DEFAULT_ICE_GLOBE = 21181;
|
||||
|
||||
public static int idWandTinkerer;
|
||||
public static int idGlowstoneGas;
|
||||
@@ -39,4 +53,19 @@ public final class LibItemIDs {
|
||||
public static int idEnderMirror;
|
||||
public static int idGoliathLegs;
|
||||
public static int idDarkGas;
|
||||
public static int idGasRemover;
|
||||
public static int idFluxDetector;
|
||||
public static int idCleansingTalisman;
|
||||
public static int idDummyEnchantbook;
|
||||
public static int idResearchShareBook;
|
||||
public static int idBrightNitor;
|
||||
public static int idRune;
|
||||
public static int idScythe;
|
||||
public static int idRainwaterBottle;
|
||||
public static int idWeatherCrystal;
|
||||
public static int idLovePotion;
|
||||
public static int idSoulMould;
|
||||
public static int idConnector;
|
||||
public static int idIceGlobe;
|
||||
|
||||
}
|
||||
@@ -81,4 +81,59 @@ public final class LibItemNames {
|
||||
public static final String DARK_GAS = "darkGas";
|
||||
public static final String DARK_GAS_R = "DARK_GAS";
|
||||
public static final String DARK_GAS_D = "Gaseous Tenebrae";
|
||||
|
||||
public static final String GAS_REMOVER = "gasRemover";
|
||||
public static final String GAS_REMOVER_R = "GAS_REMOVER";
|
||||
public static final String GAS_REMOVER_D = "Fume Dissipator";
|
||||
|
||||
public static final String FLUX_DETECTOR = "fluxDetector";
|
||||
public static final String FLUX_DETECTOR_R = "FLUX_DETECTOR";
|
||||
public static final String FLUX_DETECTOR_D = "Fluxometer";
|
||||
|
||||
public static final String CLEANSING_TALISMAN = "cleansingTalisman";
|
||||
public static final String CLEANSING_TALISMAN_R = "CLEANSING_TALISMAN";
|
||||
public static final String CLEANSING_TALISMAN_D = "Talisman of Remedium";
|
||||
|
||||
public static final String DUMMY_ENCHANTBOOK = "dummyEnchantbook";
|
||||
|
||||
public static final String RESEARCH_SHARE_BOOK = "researchShareBook";
|
||||
public static final String RESEARCH_SHARE_BOOK_D = "Tome of Knowledge Sharing";
|
||||
|
||||
public static final String BRIGHT_NITOR = "brightNitor";
|
||||
public static final String BRIGHT_NITOR_R = "BRIGHT_NITOR";
|
||||
public static final String BRIGHT_NITOR_D = "Hyperenergetic Nitor";
|
||||
|
||||
public static final String RUNE = "rune";
|
||||
public static final String RUNE_D = "Rune ";
|
||||
|
||||
public static final String SCYTHE = "scythe";
|
||||
public static final String SCYTHE_R = "SCYTHE";
|
||||
public static final String SCYTHE_D = "Reaper's Scythe";
|
||||
|
||||
public static final String RAINWATER_BOTTLE = "rainwaterBottle";
|
||||
public static final String RAINWATER_BOTTLE_R = "RAINWATER_BOTTLE";
|
||||
public static final String RAINWATER_BOTTLE_D = "Bottle of Rain Water";
|
||||
|
||||
public static final String WEATHER_CRYSTAL = "weatherCrystal";
|
||||
public static final String WEATHER_CRYSTAL_R = "WEATHER_CRYSTAL";
|
||||
public static final String WEATHER_CRYSTAL_R0 = "WEATHER_CRYSTAL_0";
|
||||
public static final String WEATHER_CRYSTAL_R1 = "WEATHER_CRYSTAL_1";
|
||||
public static final String WEATHER_CRYSTAL_D0 = "Crystal of Sunlight";
|
||||
public static final String WEATHER_CRYSTAL_D1 = "Crystal of Rainfall";
|
||||
|
||||
public static final String LOVE_POTION = "lovePotion";
|
||||
public static final String LOVE_POTION_R = "LOVE_POTION";
|
||||
public static final String LOVE_POTION_D = "Aphrodisiac Concoction";
|
||||
|
||||
public static final String SOUL_MOULD = "soulMould";
|
||||
public static final String SOUL_MOULD_R = "SOUL_MOULD";
|
||||
public static final String SOUL_MOULD_D = "Soul Mould";
|
||||
|
||||
public static final String CONNECTOR = "connector";
|
||||
public static final String CONNECTOR_R = "CONNECTOR";
|
||||
public static final String CONNECTOR_D = "Interface Binder";
|
||||
|
||||
public static final String ICE_GLOBE = "iceGlobe";
|
||||
public static final String ICE_GLOBE_R = "ICE_GLOBE";
|
||||
public static final String ICE_GLOBE_D = "Cryogenic Globe";
|
||||
}
|
||||
@@ -18,7 +18,7 @@ public final class LibMisc {
|
||||
|
||||
public static final String MOD_ID = "ThaumicTinkerer";
|
||||
public static final String MOD_NAME = "Thaumic Tinkerer";
|
||||
public static final String MOD_VERSION = "1.0.2";
|
||||
public static final String MOD_VERSION = "1.0.8";
|
||||
|
||||
public static final String DEPENDENCIES = "required-after:Thaumcraft";
|
||||
|
||||
@@ -29,6 +29,4 @@ public final class LibMisc {
|
||||
public static final short TAG_META_WILDCARD = -1;
|
||||
|
||||
public static final float MODEL_DEFAULT_RENDER_SCALE = 0.0625F;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -22,4 +22,7 @@ public final class LibNetwork {
|
||||
public static final String SUBCHANNEL_TRANSMUTATOR_SYNC = "transmutatorSync";
|
||||
public static final String SUBCHANNEL_ANIMATION_TABLET_SYNC = "tabletSync";
|
||||
public static final String SUBCHANNEL_ANIMATION_TABLET_BUTTON = "tabletButton";
|
||||
public static final String SUBCHANNEL_SOUL_HEART_SYNC = "soulHearts";
|
||||
public static final String SUBCHANNEL_MOB_MAGNET_SYNC = "mobMagnetSync";
|
||||
public static final String SUBCHANNEL_MOB_MAGNET_BUTTON = "mobMagnetButton";
|
||||
}
|
||||
@@ -17,11 +17,18 @@ package vazkii.tinkerer.lib;
|
||||
public final class LibPotions {
|
||||
|
||||
public static final int DEFAULT_ID_STOPWATCH = 21;
|
||||
public static final int DEFAULT_ID_FROZEN = 22;
|
||||
public static final int DEFAULT_ID_POSSESSED = 23;
|
||||
|
||||
public static int idStopwatch;
|
||||
public static int idFrozen;
|
||||
public static int idPossessed = 23;
|
||||
|
||||
public static final String NAME_STOPWATCH = "stopwatch";
|
||||
public static final String NAME_FROZEN = "frozen";
|
||||
public static final String NAME_POSSESSED = "possessed";
|
||||
|
||||
public static final String DISPLAY_NAME_STOPWATCH = "Time Twister";
|
||||
|
||||
public static final String DISPLAY_NAME_FROZEN = "Frozen";
|
||||
public static final String DISPLAY_NAME_POSSESSED = "Possessed";
|
||||
}
|
||||
@@ -17,5 +17,6 @@ package vazkii.tinkerer.lib;
|
||||
public final class LibRenderIDs {
|
||||
|
||||
public static int idWardChest;
|
||||
|
||||
public static int idMagnet;
|
||||
public static int idMobMagnet;
|
||||
}
|
||||
@@ -31,16 +31,23 @@ public final class LibResources {
|
||||
|
||||
public static final String GUI_TRANSMUTATOR = ROOT_GUI + "guiTransmutator.png";
|
||||
public static final String GUI_ANIMATION_TABLET = ROOT_GUI + "guiAnimationTablet.png";
|
||||
public static final String GUI_MOB_MAGNET = ROOT_GUI + "guiMobMagnet.png";
|
||||
public static final String GUI_SOUL_HEARTS = ROOT_GUI + "soulHearts.png";
|
||||
|
||||
public static final String MODEL_WARD_CHEST = ROOT_MODEL + "chestWard.png";
|
||||
public static final String MODEL_LEGS_GOLIATH = ROOT_MODEL + "armorGoliath.png";
|
||||
public static final String MODEL_MAGNET_N = ROOT_MODEL + "magnetN.png";
|
||||
public static final String MODEL_MAGNET_S = ROOT_MODEL + "magnetS.png";
|
||||
public static final String MODEL_MOB_MAGNET_N = ROOT_MODEL + "mobMagnetN.png";
|
||||
public static final String MODEL_MOB_MAGNET_S = ROOT_MODEL + "mobMagnetS.png";
|
||||
public static final String MODEL_CONNECTOR = ROOT_MODEL + "connector.cub";
|
||||
|
||||
public static final String MISC_GLYPHS = BLUR + ROOT_MISC + "transmutatorGlyphs.png";
|
||||
public static final String MISC_WARD_CHEST_OVERLAY = ROOT_MISC + "wardChestOverlay.png";
|
||||
public static final String MISC_AT_OVERLAY_LEFT = BLUR + ROOT_MISC + "atLeft.png";
|
||||
public static final String MISC_AT_OVERLAY_RIGHT = BLUR + ROOT_MISC + "atRight1.png";
|
||||
public static final String MISC_AT_OVERLAY_DIAL = BLUR + ROOT_TC + "misc/dial.png";
|
||||
public static final String MISC_ATOVERLAY_REDSTONE = BLUR + ROOT_TC + "misc/dial_ind.png";
|
||||
public static final String MISC_AT_OVERLAY_FACING = BLUR + ROOT_MISC + "tabletFacingInd.png";
|
||||
|
||||
public static final String EMTPY_TEXTURE = "emptyTexture";
|
||||
}
|
||||
@@ -16,6 +16,7 @@ package vazkii.tinkerer.network;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import vazkii.tinkerer.network.packet.PacketVerification;
|
||||
import vazkii.tinkerer.util.handler.SoulHeartHandler;
|
||||
import cpw.mods.fml.common.IPlayerTracker;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
@@ -24,6 +25,7 @@ public class PlayerTracker implements IPlayerTracker {
|
||||
@Override
|
||||
public void onPlayerLogin(EntityPlayer player) {
|
||||
PacketManager.sendPacketToClient((Player) player, new PacketVerification());
|
||||
SoulHeartHandler.updateClient(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* This class was created by <TheWhiteWolves>. It's distributed as
|
||||
* part of the Thaumic Tinkerer Mod.
|
||||
*
|
||||
* Thaumic Tinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* Thaumic Tinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [12 Jul 2013, 22:24:12 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.network.packet;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import vazkii.tinkerer.inventory.container.ContainerMobMagnet;
|
||||
import vazkii.tinkerer.lib.LibNetwork;
|
||||
import vazkii.tinkerer.network.ModPacket;
|
||||
import vazkii.tinkerer.network.PacketManager;
|
||||
import vazkii.tinkerer.tile.TileEntityMobMagnet;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
public class PacketMobMagnetButton extends ModPacket {
|
||||
|
||||
TileEntityMobMagnet mobMagnet;
|
||||
|
||||
public PacketMobMagnetButton() { }
|
||||
|
||||
public PacketMobMagnetButton(TileEntityMobMagnet mobMagnet) {
|
||||
this.mobMagnet = mobMagnet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteArrayOutputStream asOutputStream() throws IOException {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
DataOutputStream data = new DataOutputStream(stream);
|
||||
writeSubchannel(data);
|
||||
data.writeInt(mobMagnet.xCoord);
|
||||
data.writeInt(mobMagnet.yCoord);
|
||||
data.writeInt(mobMagnet.zCoord);
|
||||
data.writeBoolean(mobMagnet.adult);
|
||||
return stream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean readPayload(Packet250CustomPayload packet, INetworkManager manager, Player player, String subchannel) throws IOException {
|
||||
if(subchannel.equals(getSubchannel()) && player != null && player instanceof EntityPlayer) {
|
||||
EntityPlayer entityPlayer = (EntityPlayer)player;
|
||||
if(entityPlayer.openContainer != null && entityPlayer.openContainer instanceof ContainerMobMagnet) {
|
||||
ByteArrayInputStream stream = new ByteArrayInputStream(packet.data);
|
||||
DataInputStream inputStream = new DataInputStream(stream);
|
||||
skipSubchannel(inputStream);
|
||||
int x = inputStream.readInt();
|
||||
int y = inputStream.readInt();
|
||||
int z = inputStream.readInt();
|
||||
ContainerMobMagnet container = (ContainerMobMagnet)entityPlayer.openContainer;
|
||||
if(container.mobMagnet.xCoord == x && container.mobMagnet.yCoord == y && container.mobMagnet.zCoord == z) {
|
||||
TileEntityMobMagnet mobMagnet = (TileEntityMobMagnet) container.mobMagnet.worldObj.getBlockTileEntity(x, y, z);
|
||||
boolean adult = inputStream.readBoolean();
|
||||
mobMagnet.adult = adult;
|
||||
PacketMobMagnetSync packet1 = new PacketMobMagnetSync(mobMagnet);
|
||||
PacketManager.sendPacketToClient(player, packet1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSubchannel() {
|
||||
return LibNetwork.SUBCHANNEL_MOB_MAGNET_BUTTON;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* This class was created by <TheWhiteWolves>. It's distributed as
|
||||
* part of the Thaumic Tinkerer Mod.
|
||||
*
|
||||
* Thaumic Tinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* Thaumic Tinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [6 Jul 2013, 22:02:57 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.network.packet;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import vazkii.tinkerer.lib.LibNetwork;
|
||||
import vazkii.tinkerer.network.ModPacket;
|
||||
import vazkii.tinkerer.network.PacketManager;
|
||||
import vazkii.tinkerer.tile.TileEntityMobMagnet;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
public class PacketMobMagnetSync extends ModPacket {
|
||||
|
||||
TileEntityMobMagnet mobMagnet;
|
||||
|
||||
public PacketMobMagnetSync() { }
|
||||
|
||||
public PacketMobMagnetSync(TileEntityMobMagnet mobMagnet) {
|
||||
this.mobMagnet = mobMagnet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteArrayOutputStream asOutputStream() throws IOException {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
DataOutputStream data = new DataOutputStream(stream);
|
||||
writeSubchannel(data);
|
||||
data.writeInt(mobMagnet.xCoord);
|
||||
data.writeInt(mobMagnet.yCoord);
|
||||
data.writeInt(mobMagnet.zCoord);
|
||||
PacketManager.writeItemStackIntoStream(mobMagnet.getStackInSlot(0), data);
|
||||
data.writeBoolean(mobMagnet.adult);
|
||||
return stream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean readPayload(Packet250CustomPayload packet, INetworkManager manager, Player player, String subchannel) throws IOException {
|
||||
if(subchannel.equals(getSubchannel()) && player != null && player instanceof EntityPlayer) {
|
||||
ByteArrayInputStream stream = new ByteArrayInputStream(packet.data);
|
||||
DataInputStream inputStream = new DataInputStream(stream);
|
||||
skipSubchannel(inputStream);
|
||||
int x = inputStream.readInt();
|
||||
int y = inputStream.readInt();
|
||||
int z = inputStream.readInt();
|
||||
TileEntityMobMagnet mobMagnet = (TileEntityMobMagnet) ((EntityPlayer)player).worldObj.getBlockTileEntity(x, y, z);
|
||||
ItemStack stack = PacketManager.getItemStackFromStream(inputStream);
|
||||
if(mobMagnet != null) {
|
||||
mobMagnet.setInventorySlotContents(0, stack);
|
||||
boolean adult = inputStream.readBoolean();
|
||||
mobMagnet.adult = adult;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSubchannel() {
|
||||
return LibNetwork.SUBCHANNEL_MOB_MAGNET_SYNC;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [2 Jul 2013, 17:22:14 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.network.packet;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import vazkii.tinkerer.client.util.handler.SoulHeartClientHandler;
|
||||
import vazkii.tinkerer.lib.LibNetwork;
|
||||
import vazkii.tinkerer.network.ModPacket;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class PacketSoulHeartSync extends ModPacket {
|
||||
|
||||
int sync;
|
||||
|
||||
public PacketSoulHeartSync() { }
|
||||
|
||||
public PacketSoulHeartSync(int sync) {
|
||||
this.sync = sync;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteArrayOutputStream asOutputStream() throws IOException {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
DataOutputStream data = new DataOutputStream(stream);
|
||||
writeSubchannel(data);
|
||||
data.writeInt(sync);
|
||||
return stream;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean readPayload(Packet250CustomPayload packet, INetworkManager manager, Player player, String subchannel) throws IOException {
|
||||
if(subchannel.equals(getSubchannel())) {
|
||||
ByteArrayInputStream stream = new ByteArrayInputStream(packet.data);
|
||||
DataInputStream inputStream = new DataInputStream(stream);
|
||||
skipSubchannel(inputStream);
|
||||
int hp = inputStream.readInt();
|
||||
|
||||
SoulHeartClientHandler.clientPlayerHP = hp;
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSubchannel() {
|
||||
return LibNetwork.SUBCHANNEL_SOUL_HEART_SYNC;
|
||||
}
|
||||
}
|
||||
@@ -19,11 +19,13 @@ import vazkii.tinkerer.lib.LibPotions;
|
||||
|
||||
public final class ModPotions {
|
||||
|
||||
public static int idStopwatch;
|
||||
|
||||
public static Potion effectStopwatch;
|
||||
public static Potion effectFrozen;
|
||||
public static Potion effectPossessed;
|
||||
|
||||
public static void initPotions() {
|
||||
effectStopwatch = new TTPotion(idStopwatch, false, 0x999900, 0, 0).setPotionName(LibPotions.DISPLAY_NAME_STOPWATCH);
|
||||
effectStopwatch = new TTPotion(LibPotions.idStopwatch, false, 0x999900, 0, 0).setPotionName(LibPotions.DISPLAY_NAME_STOPWATCH);
|
||||
effectFrozen = new TTPotion(LibPotions.idFrozen, false, 0x8BCFFB, 1, 0).setPotionName(LibPotions.DISPLAY_NAME_FROZEN);
|
||||
effectPossessed = new TTPotion(LibPotions.idPossessed, false, 0x13001A, 2, 0).setPotionName(LibPotions.DISPLAY_NAME_POSSESSED);
|
||||
}
|
||||
}
|
||||
@@ -14,11 +14,21 @@
|
||||
*/
|
||||
package vazkii.tinkerer.research;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.api.ThaumcraftApi;
|
||||
import thaumcraft.api.crafting.ShapedArcaneCraftingRecipes;
|
||||
import thaumcraft.api.research.ResearchList;
|
||||
import thaumcraft.common.Config;
|
||||
import thaumcraft.common.lib.ThaumcraftCraftingManager;
|
||||
import vazkii.tinkerer.block.ModBlocks;
|
||||
import vazkii.tinkerer.item.ModItems;
|
||||
import vazkii.tinkerer.lib.LibBlockNames;
|
||||
import vazkii.tinkerer.lib.LibItemNames;
|
||||
import vazkii.tinkerer.lib.LibMisc;
|
||||
|
||||
public final class ModArcaneRecipes {
|
||||
|
||||
@@ -27,6 +37,41 @@ public final class ModArcaneRecipes {
|
||||
"SI",
|
||||
'S', new ItemStack(Item.sign),
|
||||
'I', new ItemStack(Item.dyePowder));
|
||||
|
||||
ThaumcraftApi.addArcaneCraftingRecipe(LibItemNames.GAS_REMOVER_R, LibItemNames.GAS_REMOVER_R, 15, new ItemStack(ModItems.gasRemover),
|
||||
"DDD", "T G", "QQQ",
|
||||
'D', new ItemStack(ModItems.darkQuartz),
|
||||
'T', new ItemStack(ModItems.darkGas),
|
||||
'G', new ItemStack(ModItems.glowstoneGas),
|
||||
'Q', new ItemStack(Item.netherQuartz));
|
||||
|
||||
ThaumcraftApi.addArcaneCraftingRecipe(LibItemNames.FLUX_DETECTOR_R, LibItemNames.FLUX_DETECTOR_R, 75, new ItemStack(ModItems.fluxDetector),
|
||||
" G ", "FMF", " G ",
|
||||
'G', new ItemStack(Item.ingotGold),
|
||||
'F', new ItemStack(Config.itemResource, 1, 8),
|
||||
'M', new ItemStack(Config.itemThaumometer));
|
||||
|
||||
|
||||
for(int i = 0; i < 16; i++)
|
||||
ThaumcraftApi.addArcaneCraftingRecipe(LibBlockNames.PHANTOM_STONE_R, 120, new ItemStack(ModBlocks.phantomStone, 4, i),
|
||||
"SSS", "TBT", "SDS",
|
||||
'S', new ItemStack(Block.whiteStone),
|
||||
'T', new ItemStack(Config.blockInfusionWorkbench, 1, 0),
|
||||
'B', new ItemStack(Config.itemResource, 1, 5),
|
||||
'D', new ItemStack(Item.dyePowder, 1, i));
|
||||
ResearchList.craftingRecipesForResearch.put(LibBlockNames.PHANTOM_STONE_R, Arrays.asList(new ShapedArcaneCraftingRecipes[] { ThaumcraftCraftingManager.createFakeArcaneRecipe(
|
||||
LibBlockNames.PHANTOM_STONE_R, 120, new ItemStack(ModBlocks.phantomStone, 4, LibMisc.CRAFTING_META_WILDCARD),
|
||||
"SSS", "TBT", "SDS",
|
||||
'S', new ItemStack(Block.whiteStone),
|
||||
'T', new ItemStack(Config.blockInfusionWorkbench, 1, 0),
|
||||
'B', new ItemStack(Config.itemResource, 1, 5),
|
||||
'D', new ItemStack(Item.dyePowder, 1, LibMisc.CRAFTING_META_WILDCARD)) }));
|
||||
|
||||
ThaumcraftApi.addArcaneCraftingRecipe(LibItemNames.SOUL_MOULD_R, LibItemNames.SOUL_MOULD_R, 50, new ItemStack(ModItems.soulMould),
|
||||
" G ", "TET", " G ",
|
||||
'G', new ItemStack(Item.ingotGold),
|
||||
'T', new ItemStack(Config.itemResource, 1, 2),
|
||||
'E', new ItemStack(Item.enderPearl));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,8 +8,10 @@ import thaumcraft.api.ObjectTags;
|
||||
import thaumcraft.api.ThaumcraftApi;
|
||||
import thaumcraft.common.Config;
|
||||
import vazkii.tinkerer.block.ModBlocks;
|
||||
import vazkii.tinkerer.enchantment.ModEnchantments;
|
||||
import vazkii.tinkerer.item.ModItems;
|
||||
import vazkii.tinkerer.lib.LibBlockNames;
|
||||
import vazkii.tinkerer.lib.LibEnchantmentNames;
|
||||
import vazkii.tinkerer.lib.LibItemNames;
|
||||
import vazkii.tinkerer.lib.LibMisc;
|
||||
|
||||
@@ -20,7 +22,7 @@ public final class ModInfusionRecipes {
|
||||
ThaumcraftApi.addInfusionCraftingRecipe(LibItemNames.WAND_TINKERER_R, LibItemNames.WAND_TINKERER_R, 85, tags, new ItemStack(ModItems.wandTinkerer),
|
||||
"SSS", "SWS", "SSS",
|
||||
'S', new ItemStack(Config.itemShard, 1, 4),
|
||||
'W', new ItemStack(Config.itemWandCastingApprentice, 1, LibMisc.CRAFTING_META_WILDCARD));
|
||||
'W', new ItemStack(Config.itemWandCastingAdept, 1, LibMisc.CRAFTING_META_WILDCARD));
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.WIND, 8);
|
||||
ThaumcraftApi.addInfusionCraftingRecipe(LibItemNames.GLOWSTONE_GAS_R, LibItemNames.GLOWSTONE_GAS_R, 5, tags, new ItemStack(ModItems.glowstoneGas),
|
||||
@@ -88,7 +90,7 @@ public final class ModInfusionRecipes {
|
||||
tags = new ObjectTags().add(EnumTag.FLIGHT, 12).add(EnumTag.WIND, 6);
|
||||
ThaumcraftApi.addInfusionCraftingRecipe(LibItemNames.WAND_UPRISING_R, LibItemNames.WAND_UPRISING_R, 25, tags, new ItemStack(ModItems.wandUprising),
|
||||
" Q ", "QWQ", " Q ",
|
||||
'Q', new ItemStack(Config.itemResource, 1, 10),
|
||||
'Q', new ItemStack(Config.itemResource, 1, 3),
|
||||
'W', new ItemStack(Config.itemWandLightning));
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.POWER, 14).add(EnumTag.FLIGHT, 6);
|
||||
@@ -152,5 +154,131 @@ public final class ModInfusionRecipes {
|
||||
'Q', new ItemStack(ModItems.darkQuartz),
|
||||
'P', new ItemStack(Config.itemEssence, 1, 0),
|
||||
'A', new ItemStack(Config.itemResource, 1, 0));
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.HEAL, 16).add(EnumTag.KNOWLEDGE, 18).add(EnumTag.TOOL, 12).add(EnumTag.MAGIC, 10);
|
||||
ThaumcraftApi.addInfusionCraftingRecipe(LibItemNames.CLEANSING_TALISMAN_R, LibItemNames.CLEANSING_TALISMAN_R, 100, tags, new ItemStack(ModItems.cleansingTalisman),
|
||||
"STS", "TWT", "STS",
|
||||
'S', new ItemStack(ModItems.darkQuartz),
|
||||
'T', new ItemStack(Config.itemResource, 1, 7),
|
||||
'W', new ItemStack(Item.enderPearl));
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.MAGIC, 12).add(EnumTag.KNOWLEDGE, 32).add(EnumTag.COLD, 40);
|
||||
ItemStack stack = new ItemStack(ModItems.dummyEnchantbook, 1, 0);
|
||||
stack.addEnchantment(ModEnchantments.freezing, 1);
|
||||
ThaumcraftApi.addInfusionCraftingRecipe(LibEnchantmentNames.LOST_ENCHANTS_RESEARCH_NAME, LibEnchantmentNames.FREEZING_R, 200, tags, stack,
|
||||
"INI", "IBI", "III",
|
||||
'I', new ItemStack(Block.blockSnow),
|
||||
'N', new ItemStack(Config.itemResearchNotes),
|
||||
'B', new ItemStack(Item.book));
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.MAGIC, 12).add(EnumTag.KNOWLEDGE, 32).add(EnumTag.INSECT, 40);
|
||||
stack = new ItemStack(ModItems.dummyEnchantbook, 1, 1);
|
||||
stack.addEnchantment(ModEnchantments.vampirism, 1);
|
||||
ThaumcraftApi.addInfusionCraftingRecipe(LibEnchantmentNames.LOST_ENCHANTS_RESEARCH_NAME, LibEnchantmentNames.VAMPIRISM_R, 200, tags, stack,
|
||||
"INI", "IBI", "III",
|
||||
'I', new ItemStack(Item.rottenFlesh),
|
||||
'N', new ItemStack(Config.itemResearchNotes),
|
||||
'B', new ItemStack(Item.book));
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.MAGIC, 12).add(EnumTag.KNOWLEDGE, 32).add(EnumTag.SPIRIT, 40);
|
||||
stack = new ItemStack(ModItems.dummyEnchantbook, 1, 2);
|
||||
stack.addEnchantment(ModEnchantments.soulbringer, 1);
|
||||
ThaumcraftApi.addInfusionCraftingRecipe(LibEnchantmentNames.LOST_ENCHANTS_RESEARCH_NAME, LibEnchantmentNames.SOULBRINGER_R, 200, tags, stack,
|
||||
"INI", "IBI", "III",
|
||||
'I', new ItemStack(Block.slowSand),
|
||||
'N', new ItemStack(Config.itemResearchNotes),
|
||||
'B', new ItemStack(Item.book));
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.MAGIC, 12).add(EnumTag.KNOWLEDGE, 32).add(EnumTag.FIRE, 40);
|
||||
stack = new ItemStack(ModItems.dummyEnchantbook, 1, 3);
|
||||
stack.addEnchantment(ModEnchantments.ashes, 1);
|
||||
ThaumcraftApi.addInfusionCraftingRecipe(LibEnchantmentNames.LOST_ENCHANTS_RESEARCH_NAME, LibEnchantmentNames.ASHES_R, 200, tags, stack,
|
||||
"INI", "IBI", "III",
|
||||
'I', new ItemStack(Item.blazeRod),
|
||||
'N', new ItemStack(Config.itemResearchNotes),
|
||||
'B', new ItemStack(Item.book));
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.FIRE, 16).add(EnumTag.LIGHT, 32).add(EnumTag.POWER, 20);
|
||||
ThaumcraftApi.addInfusionCraftingRecipe(LibItemNames.BRIGHT_NITOR_R, LibItemNames.BRIGHT_NITOR_R, 250, tags, new ItemStack(ModItems.brightNitor),
|
||||
"GNG", "NAN", "GNG",
|
||||
'A', new ItemStack(Config.itemResource, 1, 0),
|
||||
'G', new ItemStack(ModItems.glowstoneGas),
|
||||
'N', new ItemStack(Config.itemResource, 1, 1));
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.POWER, 12).add(EnumTag.METAL, 16).add(EnumTag.CONTROL, 6);
|
||||
ThaumcraftApi.addInfusionCraftingRecipe(LibBlockNames.MAGNET_R, LibBlockNames.MAGNET_R, 100, tags, new ItemStack(ModBlocks.magnet),
|
||||
" I ", "SIs", "LWR",
|
||||
'I', new ItemStack(Item.ingotIron),
|
||||
's', new ItemStack(Config.itemShard, 1, 3),
|
||||
'S', new ItemStack(Config.itemShard),
|
||||
'W', new ItemStack(Config.blockWooden),
|
||||
'L', new ItemStack(Item.dyePowder, 1, 4),
|
||||
'R', new ItemStack(Item.redstone));
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.LIFE, 12).add(EnumTag.DEATH, 24).add(EnumTag.EVIL, 6).add(EnumTag.SPIRIT, 30);
|
||||
ThaumcraftApi.addInfusionCraftingRecipe(LibItemNames.SCYTHE_R, LibItemNames.SCYTHE_R, 200, tags, new ItemStack(ModItems.scythe),
|
||||
"QQH", "Q I", " I",
|
||||
'Q', new ItemStack(ModItems.darkQuartz),
|
||||
'H', new ItemStack(Item.skull, 1, 1),
|
||||
'I', new ItemStack(Config.itemResource, 1, 2));
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.WEATHER, 6).add(EnumTag.FIRE, 12).add(EnumTag.CRYSTAL, 10);
|
||||
ThaumcraftApi.addInfusionCraftingRecipe(LibItemNames.WEATHER_CRYSTAL_R, LibItemNames.WEATHER_CRYSTAL_R0, 25, tags, new ItemStack(ModItems.weatherCrystal, 3, 0),
|
||||
"AQS",
|
||||
'A', new ItemStack(Config.itemResource, 1, 6),
|
||||
'Q', new ItemStack(Config.itemResource, 1, 3),
|
||||
'S', new ItemStack(Config.itemShard, 1, 1));
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.WEATHER, 6).add(EnumTag.WATER, 12).add(EnumTag.CRYSTAL, 10);
|
||||
ThaumcraftApi.addInfusionCraftingRecipe(LibItemNames.WEATHER_CRYSTAL_R, LibItemNames.WEATHER_CRYSTAL_R1, 25, tags, new ItemStack(ModItems.weatherCrystal, 3, 1),
|
||||
"AQS",
|
||||
'A', new ItemStack(Config.itemResource, 1, 6),
|
||||
'Q', new ItemStack(Config.itemResource, 1, 3),
|
||||
'S', new ItemStack(Config.itemShard, 1, 2));
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.LIFE, 12).add(EnumTag.EARTH, 6).add(EnumTag.CONTROL, 5);
|
||||
ThaumcraftApi.addInfusionCraftingRecipe(LibItemNames.LOVE_POTION_R, LibItemNames.LOVE_POTION_R, 50, tags, new ItemStack(ModItems.lovePotion),
|
||||
"PCW", "NBM", "RGZ",
|
||||
'P', new ItemStack(Item.potato),
|
||||
'C', new ItemStack(Item.carrot),
|
||||
'W', new ItemStack(Item.wheat),
|
||||
'N', new ItemStack(Item.netherStalkSeeds),
|
||||
'B', new ItemStack(Item.potion, 1, 0),
|
||||
'M', new ItemStack(Item.speckledMelon),
|
||||
'R', new ItemStack(Item.redstone),
|
||||
'G', new ItemStack(Item.lightStoneDust),
|
||||
'Z', new ItemStack(Item.blazePowder));
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.POWER, 12).add(EnumTag.MOTION, 16).add(EnumTag.MECHANISM, 6).add(EnumTag.FLESH, 4);
|
||||
ThaumcraftApi.addInfusionCraftingRecipe(LibBlockNames.MOB_MAGNET_R, LibBlockNames.MOB_MAGNET_R, 150, tags, new ItemStack(ModBlocks.mobMagnet),
|
||||
" I ", "SIs", "LWR",
|
||||
'I', new ItemStack(Item.ingotGold),
|
||||
's', new ItemStack(Config.itemShard, 1, 3),
|
||||
'S', new ItemStack(Config.itemShard),
|
||||
'W', new ItemStack(Config.blockJar, 1, 1),
|
||||
'L', new ItemStack(Item.dyePowder, 1, 4),
|
||||
'R', new ItemStack(Item.redstone));
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.MECHANISM, 6).add(EnumTag.EXCHANGE, 6);
|
||||
ThaumcraftApi.addInfusionCraftingRecipe(LibBlockNames.INTERFACE_R, LibBlockNames.INTERFACE_R, 25, tags, new ItemStack(ModBlocks.interfase),
|
||||
"BRB", "LEL", "BRB",
|
||||
'B', new ItemStack(Config.blockInfusionWorkbench),
|
||||
'E', new ItemStack(Item.enderPearl),
|
||||
'L', new ItemStack(Item.dyePowder, 1, 4),
|
||||
'R', new ItemStack(Item.redstone));
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.MECHANISM, 6).add(EnumTag.POWER, 6);
|
||||
ThaumcraftApi.addInfusionCraftingRecipe(LibBlockNames.INTERFACE_R, LibItemNames.CONNECTOR_R, 25, tags, new ItemStack(ModItems.connector),
|
||||
" I ", " WI", "S ",
|
||||
'I', new ItemStack(Item.ingotIron),
|
||||
'W', new ItemStack(Config.itemWandCastingApprentice),
|
||||
'S', new ItemStack(Config.itemShard, 1, 4));
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.COLD, 12).add(EnumTag.LIFE, 6).add(EnumTag.TIME, 6);
|
||||
ThaumcraftApi.addInfusionCraftingRecipe(LibItemNames.ICE_GLOBE_R, LibItemNames.ICE_GLOBE_R, 50, tags, new ItemStack(ModItems.iceGlobe),
|
||||
" G ", "G G", "ICI",
|
||||
'G', new ItemStack(Block.thinGlass),
|
||||
'I', new ItemStack(Item.ingotIron),
|
||||
'C', new ItemStack(Block.ice));
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@
|
||||
*/
|
||||
package vazkii.tinkerer.research;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.api.EnumTag;
|
||||
import thaumcraft.api.ObjectTags;
|
||||
@@ -22,7 +23,9 @@ import thaumcraft.common.Config;
|
||||
import vazkii.tinkerer.block.ModBlocks;
|
||||
import vazkii.tinkerer.item.ModItems;
|
||||
import vazkii.tinkerer.lib.LibBlockNames;
|
||||
import vazkii.tinkerer.lib.LibEnchantmentNames;
|
||||
import vazkii.tinkerer.lib.LibItemNames;
|
||||
import vazkii.tinkerer.util.handler.ConfigurationHandler;
|
||||
|
||||
public final class ModResearchItems {
|
||||
|
||||
@@ -47,6 +50,20 @@ public final class ModResearchItems {
|
||||
public static ResearchItem enderMirror;
|
||||
public static ResearchItem goliathLegs;
|
||||
public static ResearchItem darkGas;
|
||||
public static ResearchItem gasRemover;
|
||||
public static ResearchItem cleansingTalisman;
|
||||
public static ResearchItem fluxDetector;
|
||||
public static ResearchItem lostEnchants;
|
||||
public static ResearchItem phantomBlocks;
|
||||
public static ResearchItem brightNitor;
|
||||
public static ResearchItem magnet;
|
||||
public static ResearchItem scythe;
|
||||
public static ResearchItem rainwaterBottle;
|
||||
public static ResearchItem weatherCrystals;
|
||||
public static ResearchItem lovePotion;
|
||||
public static ResearchItem mobMagnet;
|
||||
public static ResearchItem interfase;
|
||||
public static ResearchItem iceGlobe;
|
||||
|
||||
public static void registerModResearchItems() {
|
||||
ObjectTags tags = new ObjectTags().add(EnumTag.MAGIC, 16).add(EnumTag.VOID, 8);
|
||||
@@ -67,8 +84,10 @@ public final class ModResearchItems {
|
||||
tags = new ObjectTags().add(EnumTag.WOOD, 1).add(EnumTag.DARK, 1);
|
||||
nametag = new ResearchItem(LibItemNames.NAMETAG_R, tags, 4, 18, ModItems.nametag).setParents(Config.researchGolemancy).registerResearchItem();
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.FLUX, 12).add(EnumTag.EXCHANGE, 20);
|
||||
transmutator = new ResearchItem(LibBlockNames.TRANSMUTATOR_R, tags, -5, 24, ModBlocks.transmutator).setParents(Config.researchCrystalCore).setParentsHidden(Config.researchWandTrade).registerResearchItem();
|
||||
if(ConfigurationHandler.enableTransmutator) {
|
||||
tags = new ObjectTags().add(EnumTag.FLUX, 12).add(EnumTag.EXCHANGE, 20);
|
||||
transmutator = new ResearchItem(LibBlockNames.TRANSMUTATOR_R, tags, -5, 24, ModBlocks.transmutator).setParents(Config.researchCrystalCore).setParentsHidden(Config.researchWandTrade).registerResearchItem();
|
||||
}
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.EVIL, 8).add(EnumTag.TRAP, 16).add(EnumTag.KNOWLEDGE, 12);
|
||||
xpTalisman = new ResearchItem(LibItemNames.XP_TALISMAN_R, tags, -4, 14, ModItems.xpTalisman).setParents(Config.researchJarBrain).setHidden().registerResearchItem();
|
||||
@@ -111,5 +130,47 @@ public final class ModResearchItems {
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.DARK, 4).add(EnumTag.WIND, 5).add(EnumTag.POWER, 4);
|
||||
darkGas = new ResearchItem(LibItemNames.DARK_GAS_R, tags, 5, -1, ModItems.darkGas).setParents(Config.researchAlumentum).setParentsHidden(glowstoneGas).registerResearchItem();
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.LIGHT, 1).add(EnumTag.DARK, 1).add(EnumTag.WIND, 1);
|
||||
gasRemover = new ResearchItem(LibItemNames.GAS_REMOVER_R, tags, 5, -2, ModItems.gasRemover).setParents(darkGas).registerResearchItem();
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.HEAL, 10).add(EnumTag.TOOL, 16).add(EnumTag.MAGIC, 8).add(EnumTag.WATER, 4).add(EnumTag.KNOWLEDGE, 16);
|
||||
cleansingTalisman = new ResearchItem(LibItemNames.CLEANSING_TALISMAN_R, tags, 1, 18, ModItems.cleansingTalisman).setParents(Config.researchUTFT).setHidden().registerResearchItem();
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.VISION, 16).add(EnumTag.MAGIC, 12).add(EnumTag.FLUX, 10);
|
||||
fluxDetector = new ResearchItem(LibItemNames.FLUX_DETECTOR_R, tags, -3, 19, ModItems.fluxDetector).setParents(Config.researchBasicFlux).setParentsHidden(Config.researchGoggles).registerResearchItem();
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.MAGIC, 12).add(EnumTag.KNOWLEDGE, 24).add(EnumTag.COLD, 12).add(EnumTag.SPIRIT, 12).add(EnumTag.FIRE, 12).add(EnumTag.INSECT, 12).add(EnumTag.ELDRITCH, 16).add(EnumTag.POWER, 12).add(EnumTag.WEAPON, 14).add(EnumTag.TOOL, 14);
|
||||
lostEnchants = new ResearchItem(LibEnchantmentNames.LOST_ENCHANTS_RESEARCH_NAME, tags, 8, 26, Item.enchantedBook).setParentsHidden(Config.researchTTOE).setHidden().setLost().setSpecial().registerResearchItem();
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.SPIRIT, 16).add(EnumTag.CRYSTAL, 12).add(EnumTag.TRAP, 6).add(EnumTag.ROCK, 12).add(EnumTag.ELDRITCH, 4);
|
||||
phantomBlocks = new ResearchItem(LibBlockNames.PHANTOM_STONE_R, tags, 2, 13, new ItemStack(ModBlocks.phantomStone, 1, 15)).setHidden().setParents(Config.researchArcaneDoor).registerResearchItem();
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.FIRE, 12).add(EnumTag.LIGHT, 24).add(EnumTag.POWER, 30).add(EnumTag.MOTION, 12).add(EnumTag.DESTRUCTION, 6).add(EnumTag.VISION, 16);
|
||||
brightNitor = new ResearchItem(LibItemNames.BRIGHT_NITOR_R, tags, 2, 27, new ItemStack(ModItems.brightNitor)).setHidden().setParents(Config.researchTTOE).setParentsHidden(glowstoneGas).registerResearchItem();
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.POWER, 6).add(EnumTag.CONTROL, 12).add(EnumTag.WIND, 6).add(EnumTag.METAL, 5).add(EnumTag.MECHANISM, 16);
|
||||
magnet = new ResearchItem(LibBlockNames.MAGNET_R, tags, -4, 27, new ItemStack(ModBlocks.magnet)).setHidden().setParents(Config.researchHoverHarness).registerResearchItem();
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.DARK, 12).add(EnumTag.DEATH, 24).add(EnumTag.ELDRITCH, 6).add(EnumTag.EVIL, 9).add(EnumTag.FLESH, 14).add(EnumTag.SPIRIT, 24).add(EnumTag.LIFE, 16);
|
||||
scythe = new ResearchItem(LibItemNames.SCYTHE_R, tags, -2, 28, new ItemStack(ModItems.scythe)).setHidden().setParents(Config.researchTTOE).registerResearchItem();
|
||||
|
||||
tags = new ObjectTags();
|
||||
rainwaterBottle = new ResearchItem(LibItemNames.RAINWATER_BOTTLE_R, tags, -7, -2, new ItemStack(ModItems.rainwaterBottle)).setAutoUnlock().registerResearchItem();
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.WEATHER, 12).add(EnumTag.FIRE, 12).add(EnumTag.WATER, 12).add(EnumTag.CRYSTAL, 10).add(EnumTag.VISION, 6);
|
||||
weatherCrystals = new ResearchItem(LibItemNames.WEATHER_CRYSTAL_R, tags, 2, 28, new ItemStack(ModItems.weatherCrystal)).setHidden().setParents(Config.researchTTOE).registerResearchItem();
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.LIFE, 24).add(EnumTag.CONTROL, 10).add(EnumTag.EARTH, 5).add(EnumTag.HEAL, 4);
|
||||
lovePotion = new ResearchItem(LibItemNames.LOVE_POTION_R, tags, 1, 20, new ItemStack(ModItems.lovePotion)).setHidden().setParents(Config.researchUTFT).registerResearchItem();
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.POWER, 8).add(EnumTag.KNOWLEDGE, 14).add(EnumTag.MOTION, 6).add(EnumTag.METAL, 8).add(EnumTag.MECHANISM, 14).add(EnumTag.VALUABLE, 8).add(EnumTag.PURE, 12).add(EnumTag.FLESH, 10);
|
||||
mobMagnet = new ResearchItem(LibBlockNames.MOB_MAGNET_R, tags, -5, 27, new ItemStack(ModBlocks.mobMagnet)).setHidden().setParents(magnet).registerResearchItem();
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.MECHANISM, 5).add(EnumTag.POWER, 6).add(EnumTag.ELDRITCH, 2).add(EnumTag.EXCHANGE, 5);
|
||||
interfase = new ResearchItem(LibBlockNames.INTERFACE_R, tags, -5, -2, new ItemStack(ModBlocks.interfase)).setHidden().setParents(Config.researchMagicBlock).registerResearchItem();
|
||||
|
||||
tags = new ObjectTags().add(EnumTag.COLD, 20).add(EnumTag.LIFE, 8).add(EnumTag.FLESH, 6).add(EnumTag.TIME, 6);
|
||||
iceGlobe = new ResearchItem(LibItemNames.ICE_GLOBE_R, tags, -1, 20, new ItemStack(ModItems.iceGlobe)).setHidden().setParents(Config.researchUTFT).registerResearchItem();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [29 May 2013, 20:28:06 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.tile;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class FakeInvPlayer extends InventoryPlayer {
|
||||
|
||||
TabletFakePlayer fakePlayer;
|
||||
|
||||
public FakeInvPlayer(TabletFakePlayer fakePlayer) {
|
||||
super(fakePlayer);
|
||||
this.fakePlayer = fakePlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int par1, ItemStack par2ItemStack) {
|
||||
super.setInventorySlotContents(par1, par2ItemStack);
|
||||
|
||||
if(par1 == currentItem)
|
||||
fakePlayer.tablet.setInventorySlotContents(0, getStackInSlot(currentItem));
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ public class TabletFakePlayer extends FakePlayer {
|
||||
public TabletFakePlayer(TileEntityAnimationTablet tablet) {
|
||||
super(tablet.worldObj, tablet.getInvName());
|
||||
this.tablet = tablet;
|
||||
inventory = new FakeInvPlayer(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -35,6 +36,8 @@ public class TabletFakePlayer extends FakePlayer {
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
capabilities.isCreativeMode = false;
|
||||
|
||||
posX = tablet.xCoord + 0.5;
|
||||
posY = tablet.yCoord + 1.6;
|
||||
posZ = tablet.zCoord + 0.5;
|
||||
|
||||
@@ -189,7 +189,9 @@ public class TileEntityAnimationTablet extends TileEntity implements IInventory
|
||||
}
|
||||
|
||||
if(done) {
|
||||
setInventorySlotContents(0, stack.stackSize == 0 ? null : stack);
|
||||
if(stack.stackSize == 0)
|
||||
setInventorySlotContents(0, null);
|
||||
|
||||
PacketDispatcher.sendPacketToAllPlayers(getDescriptionPacket());
|
||||
}
|
||||
}
|
||||
@@ -407,6 +409,10 @@ public class TileEntityAnimationTablet extends TileEntity implements IInventory
|
||||
if (inventorySlots[par1].stackSize <= par2) {
|
||||
stackAt = inventorySlots[par1];
|
||||
inventorySlots[par1] = null;
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
PacketDispatcher.sendPacketToAllPlayers(getDescriptionPacket());
|
||||
|
||||
return stackAt;
|
||||
} else {
|
||||
stackAt = inventorySlots[par1].splitStack(par2);
|
||||
@@ -414,6 +420,9 @@ public class TileEntityAnimationTablet extends TileEntity implements IInventory
|
||||
if (inventorySlots[par1].stackSize == 0)
|
||||
inventorySlots[par1] = null;
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
PacketDispatcher.sendPacketToAllPlayers(getDescriptionPacket());
|
||||
|
||||
return stackAt;
|
||||
}
|
||||
}
|
||||
@@ -429,6 +438,9 @@ public class TileEntityAnimationTablet extends TileEntity implements IInventory
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
inventorySlots[i] = itemstack;
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
PacketDispatcher.sendPacketToAllPlayers(getDescriptionPacket());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,255 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [26 Jul 2013, 01:56:42 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.tile;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.liquids.ILiquidTank;
|
||||
import net.minecraftforge.liquids.ITankContainer;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import buildcraft.api.power.IPowerProvider;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
|
||||
public class TileEntityInterface extends TileEntity implements ISidedInventory, ITankContainer, IPowerReceptor {
|
||||
|
||||
public int x, y, z;
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound par1nbtTagCompound) {
|
||||
super.writeToNBT(par1nbtTagCompound);
|
||||
|
||||
par1nbtTagCompound.setInteger("xt", x);
|
||||
par1nbtTagCompound.setInteger("yt", y);
|
||||
par1nbtTagCompound.setInteger("zt", z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1nbtTagCompound) {
|
||||
super.readFromNBT(par1nbtTagCompound);
|
||||
|
||||
x = par1nbtTagCompound.getInteger("xt");
|
||||
y = par1nbtTagCompound.getInteger("yt");
|
||||
z = par1nbtTagCompound.getInteger("zt");
|
||||
}
|
||||
|
||||
private TileEntity getTile() {
|
||||
if(!worldObj.blockExists(x, y, z))
|
||||
return null;
|
||||
|
||||
TileEntity tile = worldObj.getBlockTileEntity(x, y, z);
|
||||
if(tile == null)
|
||||
y = -1;
|
||||
|
||||
return tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof IInventory ? ((IInventory) tile).getSizeInventory() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof IInventory ? ((IInventory) tile).getStackInSlot(i) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof IInventory ? ((IInventory) tile).decrStackSize(i, j) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof IInventory ? ((IInventory) tile).getStackInSlotOnClosing(i) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
TileEntity tile = getTile();
|
||||
if (tile instanceof IInventory)
|
||||
((IInventory) tile).setInventorySlotContents(i, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInvName() {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof IInventory ? ((IInventory) tile).getInvName() : "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvNameLocalized() {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof IInventory ? ((IInventory) tile).isInvNameLocalized() : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof IInventory ? ((IInventory) tile).getInventoryStackLimit() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openChest() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeChest() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStackValidForSlot(int i, ItemStack itemstack) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof IInventory ? ((IInventory) tile).isStackValidForSlot(i, itemstack) : false;
|
||||
}
|
||||
|
||||
// 1.6 stuff:
|
||||
/*@Override
|
||||
public int fill(ForgeDirection from, LiquidStack resource, boolean doFill) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof ILiquidTank ? ((IFluidHandler) tile).fill(from, resource, doFill) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof IFluidHandler ? ((IFluidHandler) tile).drain(from, resource, doDrain) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof IFluidHandler ? ((IFluidHandler) tile).drain(from, maxDrain, doDrain) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof IFluidHandler ? ((IFluidHandler) tile).canFill(from, fluid) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof IFluidHandler ? ((IFluidHandler) tile).canDrain(from, fluid) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof IFluidHandler ? ((IFluidHandler) tile).getTankInfo(from) : null;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int var1) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof ISidedInventory ? ((ISidedInventory) tile).getAccessibleSlotsFromSide(var1) : tile instanceof IInventory ? buildSlotsForLinearInventory((IInventory) tile) : new int[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemstack, int j) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof ISidedInventory ? ((ISidedInventory) tile).canInsertItem(i, itemstack, j) : tile instanceof IInventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof ISidedInventory ? ((ISidedInventory) tile).canExtractItem(i, itemstack, j) : tile instanceof IInventory;
|
||||
}
|
||||
|
||||
private int[] buildSlotsForLinearInventory(IInventory inv) {
|
||||
int[] slots = new int[inv.getSizeInventory()];
|
||||
for (int i = 0; i < slots.length; i++)
|
||||
slots[i] = i;
|
||||
|
||||
return slots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doWork() {
|
||||
TileEntity tile = getTile();
|
||||
if (tile instanceof IPowerReceptor)
|
||||
((IPowerReceptor) tile).doWork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPowerProvider(IPowerProvider provider) {
|
||||
TileEntity tile = getTile();
|
||||
if (tile instanceof IPowerReceptor)
|
||||
((IPowerReceptor) tile).setPowerProvider(provider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPowerProvider getPowerProvider() {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof IPowerReceptor ? ((IPowerReceptor) tile).getPowerProvider() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int powerRequest(ForgeDirection from) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof IPowerReceptor ? ((IPowerReceptor) tile).powerRequest(from) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, LiquidStack resource, boolean doFill) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof ITankContainer ? ((ITankContainer) tile).fill(from, resource, doFill) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(int tankIndex, LiquidStack resource, boolean doFill) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof ITankContainer ? ((ITankContainer) tile).fill(tankIndex, resource, doFill) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiquidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof ITankContainer ? ((ITankContainer) tile).drain(from, maxDrain, doDrain) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiquidStack drain(int tankIndex, int maxDrain, boolean doDrain) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof ITankContainer ? ((ITankContainer) tile).drain(tankIndex, maxDrain, doDrain) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILiquidTank[] getTanks(ForgeDirection direction) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof ITankContainer ? ((ITankContainer) tile).getTanks(direction) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILiquidTank getTank(ForgeDirection direction, LiquidStack type) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof ITankContainer ? ((ITankContainer) tile).getTank(direction, type) : null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [28 Jun 2013, 18:22:16 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.tile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import thaumcraft.client.codechicken.core.vec.Vector3;
|
||||
import vazkii.tinkerer.ThaumicTinkerer;
|
||||
|
||||
public class TileEntityMagnet extends TileEntity {
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
int redstone = 0;
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
redstone = Math.max(redstone, worldObj.getIndirectPowerLevelTo(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir.ordinal()));
|
||||
|
||||
if(redstone > 0) {
|
||||
double x1 = xCoord + 0.5;
|
||||
double y1 = yCoord + 0.5;
|
||||
double z1 = zCoord + 0.5;
|
||||
|
||||
boolean blue = getBlockMetadata() == 0;
|
||||
int speedMod = blue ? 1 : -1;
|
||||
double range = redstone / 2;
|
||||
|
||||
AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(x1 - range, yCoord, z1 - range, x1 + range, y1 + range, z1 + range);
|
||||
List<EntityItem> items = worldObj.getEntitiesWithinAABB(EntityItem.class, boundingBox);
|
||||
|
||||
for(EntityItem item : items) {
|
||||
double x2 = item.posX;
|
||||
double y2 = item.posY;
|
||||
double z2 = item.posZ;
|
||||
|
||||
float distanceSqrd = blue ? (float) ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2)) : 1.1F;
|
||||
|
||||
if(distanceSqrd > 1) {
|
||||
setEntityMotionFromVector(item, x1, y1, z1, speedMod * 0.25F);
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) x2, (float) y2, (float) z2, blue ? 2 : 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void setEntityMotionFromVector(Entity entity, double x, double y, double z, float modifier) {
|
||||
Vector3 originalPosVector = new Vector3(x, y, z);
|
||||
Vector3 entityVector = Vector3.fromEntityCenter(entity);
|
||||
Vector3 finalVector = originalPosVector.subtract(entityVector).normalize();
|
||||
entity.motionX = finalVector.x * modifier;
|
||||
entity.motionY = finalVector.y * modifier;
|
||||
entity.motionZ = finalVector.z * modifier;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,229 @@
|
||||
/**
|
||||
* This class was created by <TheWhiteWolves>. It's distributed as
|
||||
* part of the Thaumic Tinkerer Mod.
|
||||
*
|
||||
* Thaumic Tinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* Thaumic Tinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [6 Jul 2013, 15:13:00 (GMT)]
|
||||
*/
|
||||
|
||||
package vazkii.tinkerer.tile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityAgeable;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import thaumcraft.client.codechicken.core.vec.Vector3;
|
||||
import vazkii.tinkerer.ThaumicTinkerer;
|
||||
import vazkii.tinkerer.lib.LibBlockNames;
|
||||
import vazkii.tinkerer.network.PacketManager;
|
||||
import vazkii.tinkerer.network.packet.PacketMobMagnetSync;
|
||||
import vazkii.tinkerer.util.helper.ItemNBTHelper;
|
||||
|
||||
public class TileEntityMobMagnet extends TileEntity implements IInventory {
|
||||
|
||||
ItemStack[] inventorySlots = new ItemStack[1];
|
||||
private static final String TAG_PATTERN = "pattern";
|
||||
private static final String NON_ASSIGNED = "Blank";
|
||||
|
||||
public boolean adult = true;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
int redstone = 0;
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
redstone = Math.max(redstone, worldObj.getIndirectPowerLevelTo(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir.ordinal()));
|
||||
|
||||
if(redstone > 0) {
|
||||
double x1 = xCoord + 0.5;
|
||||
double y1 = yCoord + 0.5;
|
||||
double z1 = zCoord + 0.5;
|
||||
|
||||
boolean blue = getBlockMetadata() == 0;
|
||||
int speedMod = blue ? 1 : -1;
|
||||
double range = redstone / 2;
|
||||
|
||||
AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(x1 - range, yCoord, z1 - range, x1 + range, y1 + range, z1 + range);
|
||||
List<EntityLiving> entities = worldObj.getEntitiesWithinAABB(EntityLiving.class, boundingBox);
|
||||
|
||||
for(EntityLiving entity : entities) {
|
||||
if(!(entity instanceof EntityPlayer)) {
|
||||
|
||||
if(inventorySlots[0] != null) { // Filter Exists
|
||||
// Fill in Filter effects here
|
||||
String pattern = ItemNBTHelper.getString(inventorySlots[0], TAG_PATTERN, NON_ASSIGNED);
|
||||
if(entity.getEntityName().equals(pattern)) {
|
||||
if(entity instanceof EntityAgeable) {
|
||||
if(adult && !entity.isChild()) {
|
||||
moveEntity(blue, entity, x1, y1, z1, speedMod);
|
||||
}
|
||||
else if(!adult && entity.isChild()) {
|
||||
moveEntity(blue, entity, x1, y1, z1, speedMod);
|
||||
}
|
||||
}
|
||||
else {
|
||||
moveEntity(blue, entity, x1, y1, z1, speedMod);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
moveEntity(blue, entity, x1, y1, z1, speedMod);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void moveEntity(boolean blue, EntityLiving entity, double x1, double y1, double z1, int speedMod) {
|
||||
double x2 = entity.posX;
|
||||
double y2 = entity.posY;
|
||||
double z2 = entity.posZ;
|
||||
|
||||
float distanceSqrd = blue ? (float) ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2)) : 1.1F;
|
||||
|
||||
if(distanceSqrd > 1) {
|
||||
setEntityMotionFromVector(entity, x1, y1, z1, speedMod * 0.25F);
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) x2, (float) y2, (float) z2, blue ? 2 : 4);
|
||||
}
|
||||
}
|
||||
|
||||
private static void setEntityMotionFromVector(Entity entity, double x, double y, double z, float modifier) {
|
||||
Vector3 originalPosVector = new Vector3(x, y, z);
|
||||
Vector3 entityVector = Vector3.fromEntityCenter(entity);
|
||||
Vector3 finalVector = originalPosVector.subtract(entityVector).normalize();
|
||||
entity.motionX = finalVector.x * modifier;
|
||||
entity.motionY = finalVector.y * modifier;
|
||||
entity.motionZ = finalVector.z * modifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
|
||||
NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
|
||||
inventorySlots = new ItemStack[getSizeInventory()];
|
||||
for (int var3 = 0; var3 < var2.tagCount(); ++var3) {
|
||||
NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
|
||||
byte var5 = var4.getByte("Slot");
|
||||
if (var5 >= 0 && var5 < inventorySlots.length)
|
||||
inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
for (int var3 = 0; var3 < inventorySlots.length; ++var3) {
|
||||
if (inventorySlots[var3] != null) {
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte)var3);
|
||||
inventorySlots[var3].writeToNBT(var4);
|
||||
var2.appendTag(var4);
|
||||
}
|
||||
}
|
||||
par1NBTTagCompound.setTag("Items", var2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventorySlots.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return inventorySlots[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if (inventorySlots[i] != null) {
|
||||
ItemStack stackAt;
|
||||
|
||||
if (inventorySlots[i].stackSize <= j) {
|
||||
stackAt = inventorySlots[i];
|
||||
inventorySlots[i] = null;
|
||||
return stackAt;
|
||||
} else {
|
||||
stackAt = inventorySlots[i].splitStack(j);
|
||||
|
||||
if (inventorySlots[i].stackSize == 0)
|
||||
inventorySlots[i] = null;
|
||||
|
||||
return stackAt;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
return getStackInSlot(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
inventorySlots[i] = itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInvName() {
|
||||
return LibBlockNames.MOB_MAGNET_D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvNameLocalized() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) != this ? false : entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openChest() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeChest() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStackValidForSlot(int i, ItemStack itemstack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
return PacketManager.generatePacket(new PacketMobMagnetSync(this));
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,6 @@ import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import thaumcraft.common.tiles.TileOwned;
|
||||
import vazkii.tinkerer.lib.LibBlockNames;
|
||||
@@ -129,7 +128,7 @@ public class TileEntityWardChest extends TileOwned implements ISidedInventory, n
|
||||
|
||||
@Override
|
||||
public boolean isInvNameLocalized() {
|
||||
return !MathHelper.stringNullOrLengthZero(customName);
|
||||
return customName != null && customName.length() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,6 +7,8 @@ import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.Property;
|
||||
import vazkii.tinkerer.lib.LibBlockIDs;
|
||||
import vazkii.tinkerer.lib.LibBlockNames;
|
||||
import vazkii.tinkerer.lib.LibEnchantmentIDs;
|
||||
import vazkii.tinkerer.lib.LibEnchantmentNames;
|
||||
import vazkii.tinkerer.lib.LibItemIDs;
|
||||
import vazkii.tinkerer.lib.LibItemNames;
|
||||
import vazkii.tinkerer.lib.LibPotions;
|
||||
@@ -16,6 +18,7 @@ public final class ConfigurationHandler {
|
||||
private static Configuration config;
|
||||
|
||||
private static final String CATEGORY_POTIONS = "potions";
|
||||
private static final String CATEGORY_ENCHANTMENTS = "enchantments";
|
||||
private static final String CATEGORY_BALANCE = "balance";
|
||||
|
||||
private static ConfigCategory categoryPotions;
|
||||
@@ -25,11 +28,13 @@ public final class ConfigurationHandler {
|
||||
private static String NODE_TRANSMUTATOR_ESSENTIA_MULTI = "transmutator.aspectMultiplier";
|
||||
private static String NODE_TRANSMUTATOR_MAX_VALUE = "transmutator.maxValue";
|
||||
private static String NODE_TRANSMUTATOR_ENABLE = "transmutator.enable";
|
||||
private static String NODE_WAND_DISLOCATION_TILES = "wandDislocation.pickupTiles";
|
||||
|
||||
public static int transmutatorVisMultiplier = 2;
|
||||
public static int transmutatorEssentiaMultiplier = 4;
|
||||
public static int transmutatorMaxValue = 75;
|
||||
public static boolean enableTransmutator = true;
|
||||
public static boolean wandDislocationTiles = true;
|
||||
|
||||
public static void loadConfig(File configFile) {
|
||||
config = new Configuration(configFile);
|
||||
@@ -57,6 +62,20 @@ public final class ConfigurationHandler {
|
||||
LibItemIDs.idEnderMirror = loadItem(LibItemNames.ENDER_MIRROR, LibItemIDs.DEFAULT_ENDER_MIRROR);
|
||||
LibItemIDs.idGoliathLegs = loadItem(LibItemNames.GOLIATH_LEGS, LibItemIDs.DEFAULT_GOLIATH_LEGS);
|
||||
LibItemIDs.idDarkGas = loadItem(LibItemNames.DARK_GAS, LibItemIDs.DEFAULT_DARK_GAS);
|
||||
LibItemIDs.idGasRemover = loadItem(LibItemNames.GAS_REMOVER, LibItemIDs.DEFAULT_GAS_REMOVER);
|
||||
LibItemIDs.idFluxDetector = loadItem(LibItemNames.FLUX_DETECTOR, LibItemIDs.DEFAULT_FLUX_DETECTOR);
|
||||
LibItemIDs.idCleansingTalisman = loadItem(LibItemNames.CLEANSING_TALISMAN, LibItemIDs.DEFAULT_CLEANSING_TALISMAN);
|
||||
LibItemIDs.idDummyEnchantbook = loadItem(LibItemNames.DUMMY_ENCHANTBOOK, LibItemIDs.DEFAULT_DUMMY_ENCHANTBOOK);
|
||||
LibItemIDs.idResearchShareBook = loadItem(LibItemNames.RESEARCH_SHARE_BOOK, LibItemIDs.DEFAULT_RESEARCH_SHARE_BOOK);
|
||||
LibItemIDs.idBrightNitor = loadItem(LibItemNames.BRIGHT_NITOR, LibItemIDs.DEFAULT_BRIGHT_NITOR);
|
||||
LibItemIDs.idRune = loadItem(LibItemNames.RUNE, LibItemIDs.DEFAULT_RUNE);
|
||||
LibItemIDs.idScythe = loadItem(LibItemNames.SCYTHE, LibItemIDs.DEFAULT_SCYTHE);
|
||||
LibItemIDs.idRainwaterBottle = loadItem(LibItemNames.RAINWATER_BOTTLE, LibItemIDs.DEFAULT_RAINWATER_BOTTLE);
|
||||
LibItemIDs.idWeatherCrystal = loadItem(LibItemNames.WEATHER_CRYSTAL, LibItemIDs.DEFAULT_WEATHER_CRYSTAL);
|
||||
LibItemIDs.idLovePotion = loadItem(LibItemNames.LOVE_POTION, LibItemIDs.DEFAULT_LOVE_POTION);
|
||||
LibItemIDs.idSoulMould = loadItem(LibItemNames.SOUL_MOULD, LibItemIDs.DEFAULT_SOUL_MOULD);
|
||||
LibItemIDs.idConnector = loadItem(LibItemNames.CONNECTOR, LibItemIDs.DEFAULT_CONNECTOR);
|
||||
LibItemIDs.idIceGlobe = loadItem(LibItemNames.ICE_GLOBE, LibItemIDs.DEFAULT_ICE_GLOBE);
|
||||
|
||||
LibBlockIDs.idGlowstoneGas = loadBlock(LibBlockNames.GLOWSTONE_GAS, LibBlockIDs.DEFAULT_GLOWSTONE_GAS);
|
||||
LibBlockIDs.idTransmutator = loadBlock(LibBlockNames.TRANSMUTATOR, LibBlockIDs.DEFAULT_TRANSMUTATOR);
|
||||
@@ -67,13 +86,26 @@ public final class ConfigurationHandler {
|
||||
LibBlockIDs.idDarkQuartzSlabFull = loadBlock(LibBlockNames.DARK_QUARTZ_SLAB_FULL, LibBlockIDs.DEFAULT_DARK_QUARTZ_SLAB_FULL);
|
||||
LibBlockIDs.idAnimationTablet = loadBlock(LibBlockNames.ANIMATION_TABLET, LibBlockIDs.DEFAULT_ANIMATION_TABLET);
|
||||
LibBlockIDs.idDarkGas = loadBlock(LibBlockNames.DARK_GAS, LibBlockIDs.DEFAULT_DARK_GAS);
|
||||
LibBlockIDs.idPhantomStone = loadBlock(LibBlockNames.PHANTOM_STONE, LibBlockIDs.DEFAULT_PHANTOM_STONE);
|
||||
LibBlockIDs.idNitorGas = loadBlock(LibBlockNames.NITOR_GAS, LibBlockIDs.DEFAULT_NITOR_GAS);
|
||||
LibBlockIDs.idMagnet = loadBlock(LibBlockNames.MAGNET, LibBlockIDs.DEFAULT_MAGNET);
|
||||
LibBlockIDs.idMobMagnet = loadBlock(LibBlockNames.MOB_MAGNET, LibBlockIDs.DEFAULT_MOB_MAGNET);
|
||||
LibBlockIDs.idInterface = loadBlock(LibBlockNames.INTERFACE, LibBlockIDs.DEFAULT_INTERFACE);
|
||||
|
||||
LibPotions.idStopwatch = loadPotion(LibPotions.NAME_STOPWATCH, LibPotions.DEFAULT_ID_STOPWATCH);
|
||||
LibPotions.idFrozen = loadPotion(LibPotions.NAME_FROZEN, LibPotions.DEFAULT_ID_FROZEN);
|
||||
LibPotions.idPossessed = loadPotion(LibPotions.NAME_POSSESSED, LibPotions.DEFAULT_ID_POSSESSED);
|
||||
|
||||
LibEnchantmentIDs.freezing = loadEnchantment(LibEnchantmentNames.FREEZING, LibEnchantmentIDs.DEFAULT_FREEZING);
|
||||
LibEnchantmentIDs.soulbringer = loadEnchantment(LibEnchantmentNames.SOULBRINGER, LibEnchantmentIDs.DEFAULT_SOULBRINGER);
|
||||
LibEnchantmentIDs.vampirism = loadEnchantment(LibEnchantmentNames.VAMPIRISM, LibEnchantmentIDs.DEFAULT_VAMPIRISM);
|
||||
LibEnchantmentIDs.ashes = loadEnchantment(LibEnchantmentNames.ASHES, LibEnchantmentIDs.DEFAULT_ASHES);
|
||||
|
||||
transmutatorVisMultiplier = loadBalanceInt(NODE_TRANSMUTATOR_VIS_MULTI, transmutatorVisMultiplier, "The multiplier of the vis cost for an item on the transmutator. X times the total amount of aspect value.");
|
||||
transmutatorEssentiaMultiplier = loadBalanceInt(NODE_TRANSMUTATOR_ESSENTIA_MULTI, transmutatorEssentiaMultiplier, "The multiplier of the aspect cost for an item on the transmutator, X times the amount of the original value.");
|
||||
transmutatorMaxValue = loadBalanceInt(NODE_TRANSMUTATOR_MAX_VALUE, transmutatorMaxValue, "The maximum cost of an item that can be put in a transmutator. Cost refers to the total amount of aspect value.");
|
||||
enableTransmutator = loadBalanceBool(NODE_TRANSMUTATOR_ENABLE, enableTransmutator, "Set to false to completely disable the transmutator.");
|
||||
wandDislocationTiles = loadBalanceBool(NODE_WAND_DISLOCATION_TILES, wandDislocationTiles, "Set to false to prevent the wand of dislocation from picking up tile entities (chests, furnaces, etc.)");
|
||||
|
||||
config.save();
|
||||
}
|
||||
@@ -90,6 +122,10 @@ public final class ConfigurationHandler {
|
||||
return config.get(CATEGORY_POTIONS, label, deafultID).getInt(deafultID);
|
||||
}
|
||||
|
||||
private static int loadEnchantment(String label, int deafultID) {
|
||||
return config.get(CATEGORY_ENCHANTMENTS, label, deafultID).getInt(deafultID);
|
||||
}
|
||||
|
||||
private static boolean loadBalanceBool(String label, boolean defaultValue, String comment) {
|
||||
Property prop = config.get(CATEGORY_BALANCE, label, defaultValue);
|
||||
prop.comment = comment;
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [27 May 2013, 21:02:51 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.util.handler;
|
||||
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentData;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.tinkerer.enchantment.ModEnchantments;
|
||||
import vazkii.tinkerer.item.ModItems;
|
||||
import cpw.mods.fml.common.ICraftingHandler;
|
||||
|
||||
public class EnchantedBookCraftingHandler implements ICraftingHandler {
|
||||
|
||||
private static Enchantment[] enchantsInBooks;
|
||||
|
||||
public EnchantedBookCraftingHandler() {
|
||||
enchantsInBooks = new Enchantment[] {
|
||||
ModEnchantments.freezing,
|
||||
ModEnchantments.vampirism,
|
||||
ModEnchantments.soulbringer,
|
||||
ModEnchantments.ashes
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix) {
|
||||
if(item.itemID == ModItems.dummyEnchantbook.itemID) {
|
||||
Item.enchantedBook.func_92115_a(item, new EnchantmentData(enchantsInBooks[item.getItemDamage()], 1));
|
||||
item.itemID = Item.enchantedBook.itemID;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSmelting(EntityPlayer player, ItemStack item) { }
|
||||
}
|
||||
@@ -18,11 +18,14 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.tinkerer.client.gui.GuiAnimationTablet;
|
||||
import vazkii.tinkerer.client.gui.GuiMobMagnet;
|
||||
import vazkii.tinkerer.client.gui.GuiTransmutator;
|
||||
import vazkii.tinkerer.inventory.container.ContainerAnimationTablet;
|
||||
import vazkii.tinkerer.inventory.container.ContainerMobMagnet;
|
||||
import vazkii.tinkerer.inventory.container.ContainerTransmutator;
|
||||
import vazkii.tinkerer.lib.LibGuiIDs;
|
||||
import vazkii.tinkerer.tile.TileEntityAnimationTablet;
|
||||
import vazkii.tinkerer.tile.TileEntityMobMagnet;
|
||||
import vazkii.tinkerer.tile.TileEntityTransmutator;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
@@ -37,6 +40,9 @@ public final class GuiHandler implements IGuiHandler {
|
||||
|
||||
case LibGuiIDs.ID_ANIMATION_TABLET :
|
||||
return new ContainerAnimationTablet((TileEntityAnimationTablet) tile, player.inventory);
|
||||
|
||||
case LibGuiIDs.ID_MOB_MAGNET :
|
||||
return new ContainerMobMagnet((TileEntityMobMagnet) tile, player.inventory);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -50,6 +56,9 @@ public final class GuiHandler implements IGuiHandler {
|
||||
|
||||
case LibGuiIDs.ID_ANIMATION_TABLET :
|
||||
return new GuiAnimationTablet((TileEntityAnimationTablet) tile, player.inventory);
|
||||
|
||||
case LibGuiIDs.ID_MOB_MAGNET :
|
||||
return new GuiMobMagnet((TileEntityMobMagnet) tile, player.inventory);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public final class PlayerDamageHandler {
|
||||
event.ammount -= 1;
|
||||
|
||||
int health = player.getHealth();
|
||||
if(health > LibFeatures.GOLIATH_LEGS_MAX_SAFETY && event.ammount >= health && event.source.isUnblockable()) {
|
||||
if(health > LibFeatures.GOLIATH_LEGS_MAX_SAFETY && event.ammount >= health) {
|
||||
event.ammount = health - 1;
|
||||
|
||||
if(!player.worldObj.isRemote)
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [3 Jul 2013, 13:49:03 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.util.handler;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
||||
import vazkii.tinkerer.item.ModItems;
|
||||
|
||||
public class RainwaterBottleHandler {
|
||||
|
||||
@ForgeSubscribe
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
boolean rightEvent = event.action == Action.RIGHT_CLICK_AIR;
|
||||
ItemStack stack = event.entityPlayer.getCurrentEquippedItem();
|
||||
boolean correctStack = stack != null && stack.itemID == Item.glassBottle.itemID;
|
||||
boolean raining = event.entityPlayer.worldObj.getWorldInfo().isRaining();
|
||||
boolean canCatch = event.entityPlayer.worldObj.canBlockSeeTheSky((int) event.entityPlayer.posX, (int) event.entityPlayer.posY, (int) event.entityPlayer.posZ);
|
||||
|
||||
if(rightEvent && correctStack && raining && canCatch) {
|
||||
if(stack.stackSize == 1 && !event.entityPlayer.inventory.hasItem(ModItems.rainwaterBottle.itemID)) {
|
||||
stack.itemID = ModItems.rainwaterBottle.itemID;
|
||||
} else {
|
||||
ItemStack stack1 = new ItemStack(ModItems.rainwaterBottle);
|
||||
|
||||
if(!event.entityPlayer.inventory.addItemStackToInventory(stack1))
|
||||
event.entityPlayer.dropPlayerItem(stack1);
|
||||
|
||||
stack.stackSize--;
|
||||
if(stack.stackSize == 0)
|
||||
event.entityPlayer.inventory.setInventorySlotContents(event.entityPlayer.inventory.currentItem, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
||||
* Thaumcraft 3 © Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [2 Jul 2013, 16:45:54 (GMT)]
|
||||
*/
|
||||
package vazkii.tinkerer.util.handler;
|
||||
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraftforge.event.EventPriority;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import vazkii.tinkerer.item.ModItems;
|
||||
import vazkii.tinkerer.lib.LibMisc;
|
||||
import vazkii.tinkerer.network.PacketManager;
|
||||
import vazkii.tinkerer.network.packet.PacketSoulHeartSync;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
public class SoulHeartHandler {
|
||||
|
||||
private static final String COMPOUND = LibMisc.MOD_ID;
|
||||
private static final String TAG_HP = "soulHearts";
|
||||
private static final int MAX_HP = 20;
|
||||
|
||||
@ForgeSubscribe
|
||||
public void onPlayerDamage(LivingHurtEvent event) {
|
||||
if(event.entityLiving instanceof EntityPlayer && event.ammount > 0) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
event.ammount = removeHP(player, event.ammount);
|
||||
updateClient(player);
|
||||
}
|
||||
}
|
||||
|
||||
@ForgeSubscribe(priority = EventPriority.LOWEST)
|
||||
public void onMobDamage(LivingHurtEvent event) {
|
||||
Entity attacker = event.source.getEntity();
|
||||
if(event.entityLiving instanceof IMob && attacker != null && attacker instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) attacker;
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
|
||||
if(stack != null && stack.itemID == ModItems.scythe.itemID) {
|
||||
int actualDamage = event.ammount;
|
||||
actualDamage = applyArmorCalculations(event.entityLiving, event.source, actualDamage);
|
||||
actualDamage = applyPotionDamageCalculations(event.entityLiving, event.source, actualDamage);
|
||||
|
||||
if(actualDamage >= event.entityLiving.getHealth()) {
|
||||
// The mob will die from this attack, calculate soul hearts now...
|
||||
addHP(player, 2);
|
||||
updateClient(player);
|
||||
player.worldObj.playSoundAtEntity(player, "mob.blaze.death", 0.9F, 1F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean addHP(EntityPlayer player, int hp) {
|
||||
int current = getHP(player);
|
||||
if(current >= MAX_HP)
|
||||
return false;
|
||||
|
||||
setHP(player, Math.min(MAX_HP, current + hp));
|
||||
return true;
|
||||
}
|
||||
|
||||
// Returns overflow damage
|
||||
public static int removeHP(EntityPlayer player, int hp) {
|
||||
int current = getHP(player);
|
||||
int newHp = current - hp;
|
||||
setHP(player, Math.max(0, newHp));
|
||||
|
||||
return Math.max(0, -newHp);
|
||||
}
|
||||
|
||||
public static void setHP(EntityPlayer player, int hp) {
|
||||
NBTTagCompound cmp = getCompoundToSet(player);
|
||||
cmp.setInteger(TAG_HP, hp);
|
||||
}
|
||||
|
||||
public static int getHP(EntityPlayer player) {
|
||||
NBTTagCompound cmp = getCompoundToSet(player);
|
||||
return cmp.hasKey(TAG_HP) ? cmp.getInteger(TAG_HP) : 0;
|
||||
}
|
||||
|
||||
private static NBTTagCompound getCompoundToSet(EntityPlayer player) {
|
||||
NBTTagCompound cmp = player.getEntityData();
|
||||
if(!cmp.hasKey(COMPOUND))
|
||||
cmp.setCompoundTag(COMPOUND, new NBTTagCompound());
|
||||
|
||||
return cmp.getCompoundTag(COMPOUND);
|
||||
}
|
||||
|
||||
public static void updateClient(EntityPlayer player) {
|
||||
PacketManager.sendPacketToClient((Player) player, new PacketSoulHeartSync(getHP(player)));
|
||||
}
|
||||
|
||||
// =============== METHODS COPIED FROM ENTITYLIVING ==================== //
|
||||
|
||||
private int applyArmorCalculations(EntityLiving entity, DamageSource par1DamageSource, int par2) {
|
||||
if (!par1DamageSource.isUnblockable()) {
|
||||
int j = 25 - entity.getTotalArmorValue();
|
||||
int k = par2 * j + entity.carryoverDamage;
|
||||
//entity.damageArmor(par2);
|
||||
par2 = k / 25;
|
||||
entity.carryoverDamage = k % 25;
|
||||
}
|
||||
|
||||
return par2;
|
||||
}
|
||||
|
||||
private int applyPotionDamageCalculations(EntityLiving entity, DamageSource par1DamageSource, int par2) {
|
||||
int j;
|
||||
int k;
|
||||
int l;
|
||||
|
||||
if (entity.isPotionActive(Potion.resistance)) {
|
||||
j = (entity.getActivePotionEffect(Potion.resistance).getAmplifier() + 1) * 5;
|
||||
k = 25 - j;
|
||||
l = par2 * k + entity.carryoverDamage;
|
||||
par2 = l / 25;
|
||||
entity.carryoverDamage = l % 25;
|
||||
}
|
||||
|
||||
if (par2 <= 0)
|
||||
return 0;
|
||||
else {
|
||||
j = EnchantmentHelper.getEnchantmentModifierDamage(entity.getLastActiveItems(), par1DamageSource);
|
||||
|
||||
if (j > 20)
|
||||
j = 20;
|
||||
|
||||
if (j > 0 && j <= 20) {
|
||||
k = 25 - j;
|
||||
l = par2 * k + entity.carryoverDamage;
|
||||
par2 = l / 25;
|
||||
entity.carryoverDamage = l % 25;
|
||||
}
|
||||
|
||||
return par2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,14 @@
|
||||
*/
|
||||
package vazkii.tinkerer.util.helper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.aura.AuraNode;
|
||||
import thaumcraft.common.aura.AuraManager;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -35,4 +40,29 @@ public final class MiscHelper {
|
||||
public static String stackAsString(ItemStack stack) {
|
||||
return stack == null ? "null" : stack.itemID + ":" + stack.getItemDamage();
|
||||
}
|
||||
|
||||
public static AuraNode getClosestNode(World world, double x, double y, double z) {
|
||||
List<Integer> nodes = AuraManager.getAurasWithin(world, x, y, z);
|
||||
|
||||
double closestDist = Double.MAX_VALUE;
|
||||
AuraNode closestNode = null;
|
||||
|
||||
for(int i : nodes) {
|
||||
AuraNode node = AuraManager.getNode(i);
|
||||
|
||||
float value = node.baseLevel / 4F;
|
||||
|
||||
double distX = node.xPos - x;
|
||||
double distY = node.yPos - y;
|
||||
double distZ = node.zPos - z;
|
||||
|
||||
double dist = distX * distX + distY * distY + distZ * distZ;
|
||||
if(value * value >= dist && dist < closestDist) {
|
||||
closestDist = dist;
|
||||
closestNode = node;
|
||||
}
|
||||
}
|
||||
|
||||
return closestNode;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@ Welcome to the Thaumic Tinkerer Github Repo.
|
||||
|
||||
Thaumic Tinkerer is a Thaumcraft addon, it's intention is to add new content to Thaumcraft, and bring back some oldies, but goodies.
|
||||
|
||||
[Thaumic Tinkerer MCF Thread](http://www.minecraftforum.net/topic/1813058-)
|
||||
|
||||
Thaumcraft © Azanor 2012
|
||||
[Thaumcraft MCF Thread](http://www.minecraftforum.net/topic/1585216-)
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 3.9 KiB |
Loaded 100 of 172 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user