Compare commits

..
6 Commits
28 changed files with 471 additions and 416 deletions

No files matched your search

+15 -21
View File
@@ -1,29 +1,23 @@
// Add your dependencies here
dependencies {
api('com.github.GTNewHorizons:Baubles-Expanded:2.1.9-GTNH:dev')
api('com.github.GTNewHorizons:Baubles:1.0.4:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-554-GTNH:api')
api('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-660-GTNH:api')
api('com.github.GTNewHorizons:ThaumicBoots:1.4.9:dev') {
exclude group: 'com.github.GTNewHorizons', module: 'Electro-Magic-Tools'
exclude module: 'Baubles'
}
compileOnly('com.github.GTNewHorizons:Botania:1.12.18-GTNH:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:EnderCore:0.4.8:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:EnderIO:2.9.21:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:EnderStorage:1.7.4:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:waila:1.8.12:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:TinkersConstruct:1.13.42-GTNH:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.6.7:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:CodeChickenCore:1.4.3:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.11.16-GTNH:api') {transitive=false}
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:api') {transitive=false}
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.51.395:dev") {transitive=false}
compileOnly('com.github.GTNewHorizons:Botania:1.12.6-GTNH:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:EnderCore:0.4.6:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:EnderIO:2.9.4:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:EnderStorage:1.7.2:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:waila:1.8.2:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:TinkersConstruct:1.13.10-GTNH:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.6.2:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:CodeChickenLib:1.3.0:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.11.10-GTNH:api') {transitive=false}
compileOnly('curse.maven:computercraft-67504:2269339')
compileOnly('curse.maven:cofh-lib-220333:2388748')
compileOnly('curse.maven:cofh-core-69162:2388751')
runtimeOnly('com.github.GTNewHorizons:TCNEIAdditions:1.5.1:dev') {
exclude module: 'Baubles'
}
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:api') {transitive=false}
}
+2 -2
View File
@@ -14,7 +14,7 @@ modId = ThaumicTinkerer
modGroup = thaumic.tinkerer
# Whether to use modGroup as the maven publishing group.
# When false, com.github.GTNewHorizons is used.
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
useModGroupForPublishing = false
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
@@ -151,7 +151,7 @@ modrinthProjectId =
# type can be one of [project, version],
# and the name is the Modrinth project or version slug/id of the other mod.
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
modrinthRelations =
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.41'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.37'
}
@@ -27,7 +27,6 @@ public class RenderInfusedCrops implements ISimpleBlockRenderingHandler {
Aspect aspect = BlockInfusedGrain.getAspect(world, x, y, z);
GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT);
final Tessellator tess = Tessellator.instance;
if (aspect != null && !aspect.isPrimal()) {
// Hex to RGB code from vanilla tesselator
float r = (aspect.getColor() >> 16 & 0xFF) / 255.0F;
@@ -35,14 +34,15 @@ public class RenderInfusedCrops implements ISimpleBlockRenderingHandler {
float b = (aspect.getColor() & 0xFF) / 255.0F;
GL11.glColor4f(r, g, b, 1F);
tess.setColorRGBA_I(aspect.getColor(), 255);
Tessellator.instance.setColorRGBA_I(aspect.getColor(), 255);
}
renderer.setOverrideBlockTexture(block.getIcon(world, x, y, z, world.getBlockMetadata(x, y, z)));
tess.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
renderer.renderBlockCropsImpl(block, world.getBlockMetadata(x, y, z), x, y - 0.0625F, z);
renderer.clearOverrideBlockTexture();
// tess.setColorOpaque_I(0xFFFFFF);
// Tessellator.instance.setColorOpaque_I(0xFFFFFF);
GL11.glPopAttrib();
GL11.glPopMatrix();
@@ -56,9 +56,6 @@ public class ThaumicTinkerer {
@SidedProxy(clientSide = LibMisc.CLIENT_PROXY, serverSide = LibMisc.COMMON_PROXY)
public static TTCommonProxy proxy;
public static boolean isBootsActive = false;
public static final String BOOTS = "thaumicboots";
public static CommonProxy tcProxy;
public static SimpleNetworkWrapper netHandler = NetworkRegistry.INSTANCE.newSimpleChannel(LibMisc.MOD_ID + "|B");
@@ -77,9 +74,6 @@ public class ThaumicTinkerer {
"register",
"thaumic.tinkerer.common.compat.TTinkererProvider.callbackRegister");
}
if (Loader.isModLoaded(BOOTS)) {
isBootsActive = true;
}
}
@EventHandler
@@ -37,8 +37,7 @@ import thaumcraft.common.lib.crafting.ThaumcraftCraftingManager;
import thaumic.tinkerer.common.lib.LibBlockNames;
@Optional.InterfaceList({ @Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers"),
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft"),
@Optional.Interface(iface = "appeng.api.movable.IMovableTile", modid = "appliedenergistics2") })
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft") })
public class TileAspectAnalyzer extends TileEntity implements IInventory, SimpleComponent, IPeripheral, IMovableTile {
ItemStack[] inventorySlots = new ItemStack[1];
@@ -231,13 +230,11 @@ public class TileAspectAnalyzer extends TileEntity implements IInventory, Simple
}
@Override
@Optional.Method(modid = "appliedenergistics2")
public boolean prepareToMove() {
return true;
}
@Override
@Optional.Method(modid = "appliedenergistics2")
public void doneMoving() {}
@Override
@@ -18,9 +18,7 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import appeng.api.movable.IMovableTile;
import cpw.mods.fml.common.Optional;
@Optional.Interface(iface = "appeng.api.movable.IMovableTile", modid = "appliedenergistics2")
public class TileCamo extends TileEntity implements IMovableTile {
private static final String TAG_CAMO = "camo";
@@ -75,12 +73,10 @@ public class TileCamo extends TileEntity implements IMovableTile {
}
@Override
@Optional.Method(modid = "appliedenergistics2")
public boolean prepareToMove() {
return true;
}
@Override
@Optional.Method(modid = "appliedenergistics2")
public void doneMoving() {}
}
@@ -30,7 +30,6 @@ import org.apache.commons.lang3.ArrayUtils;
import appeng.api.movable.IMovableTile;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
@@ -42,7 +41,6 @@ import thaumic.tinkerer.common.enchantment.core.EnchantmentManager;
import thaumic.tinkerer.common.lib.LibBlockNames;
import thaumic.tinkerer.common.lib.LibFeatures;
@Optional.Interface(iface = "appeng.api.movable.IMovableTile", modid = "appliedenergistics2")
public class TileEnchanter extends TileEntity implements ISidedInventory, IMovableTile {
private static final String TAG_ENCHANTS = "enchantsIntArray";
@@ -496,12 +494,10 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
}
@Override
@Optional.Method(modid = "appliedenergistics2")
public boolean prepareToMove() {
return true;
}
@Override
@Optional.Method(modid = "appliedenergistics2")
public void doneMoving() {}
}
@@ -8,7 +8,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.AEApi;
import appeng.api.IAppEngApi;
import cpw.mods.fml.common.Loader;
import appeng.api.movable.IMovableTile;
import thaumic.tinkerer.common.ThaumicTinkerer;
import thaumic.tinkerer.common.block.mobilizer.BlockMobilizer;
@@ -117,13 +117,16 @@ public class TileEntityMobilizer extends TileEntity {
if (!worldObj.isRemote) {
TileEntity passenger = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord);
IAppEngApi api = AEApi.instance();
// Prevent the passenger from popping off. Not sent to clients.
worldObj.setBlock(targetX, yCoord, targetZ, Block.getBlockFromName("stone"), 0, 0);
// Move non-TE blocks
Block passengerId = worldObj.getBlock(xCoord, yCoord + 1, zCoord);
if (worldObj.isAirBlock(xCoord, yCoord + 1, zCoord)
|| passengerId.canPlaceBlockAt(worldObj, targetX, yCoord + 1, targetZ)) {
if (passenger == null) {
if (passengerId != Block.getBlockFromName("bedrock")
&& passengerId != Block.getBlockFromName("")) {
@@ -140,8 +143,7 @@ public class TileEntityMobilizer extends TileEntity {
}
}
// If AE is installed, use its handler
} else if (Loader.isModLoaded("appliedenergistics2")) {
IAppEngApi api = AEApi.instance();
} else if (api != null) {
if (api.registries().movable().askToMove(passenger)) {
worldObj.setBlock(
targetX,
@@ -157,29 +159,34 @@ public class TileEntityMobilizer extends TileEntity {
api.registries().movable().doneMoving(passenger);
passenger.validate();
}
// Handler IMovableTiles and vanilla TEs without AE
} else if (passenger.getClass().getName().startsWith("net.minecraft.tileentity")) {
worldObj.setBlock(
targetX,
yCoord + 1,
targetZ,
worldObj.getBlock(xCoord, yCoord + 1, zCoord),
worldObj.getBlockMetadata(xCoord, yCoord + 1, zCoord),
3);
passenger.invalidate();
worldObj.setBlockToAir(xCoord, yCoord + 1, zCoord);
} else if (passenger instanceof IMovableTile
|| passenger.getClass().getName().startsWith("net.minecraft.tileentity")) {
boolean imovable = passenger instanceof IMovableTile;
if (imovable) ((IMovableTile) passenger).prepareToMove();
worldObj.setBlock(
targetX,
yCoord + 1,
targetZ,
worldObj.getBlock(xCoord, yCoord + 1, zCoord),
worldObj.getBlockMetadata(xCoord, yCoord + 1, zCoord),
3);
passenger.invalidate();
worldObj.setBlockToAir(xCoord, yCoord + 1, zCoord);
// IMovableHandler default code
Chunk c = worldObj.getChunkFromBlockCoords(targetX, targetZ);
// IMovableHandler default code
Chunk c = worldObj.getChunkFromBlockCoords(targetX, targetZ);
c.func_150812_a(targetX & 0xF, yCoord + 1, targetZ & 0xF, passenger);
c.func_150812_a(targetX & 0xF, yCoord + 1, targetZ & 0xF, passenger);
if (c.isChunkLoaded) {
worldObj.addTileEntity(passenger);
worldObj.markBlockForUpdate(targetX, yCoord + 1, targetZ);
}
passenger.validate();
}
if (c.isChunkLoaded) {
worldObj.addTileEntity(passenger);
worldObj.markBlockForUpdate(targetX, yCoord + 1, targetZ);
}
if (imovable) ((IMovableTile) passenger).doneMoving();
passenger.validate();
}
}
// Move self
this.invalidate();
@@ -5,10 +5,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.movable.IMovableTile;
import cpw.mods.fml.common.Optional;
import thaumic.tinkerer.common.ThaumicTinkerer;
@Optional.Interface(iface = "appeng.api.movable.IMovableTile", modid = "appliedenergistics2")
public class TileEntityRelay extends TileEntity implements IMovableTile {
public boolean hasPartner;
@@ -139,12 +137,10 @@ public class TileEntityRelay extends TileEntity implements IMovableTile {
}
@Override
@Optional.Method(modid = "appliedenergistics2")
public boolean prepareToMove() {
return true;
}
@Override
@Optional.Method(modid = "appliedenergistics2")
public void doneMoving() {}
}
@@ -26,7 +26,6 @@ import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.movable.IMovableTile;
import cpw.mods.fml.common.Optional;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.aspects.IAspectContainer;
@@ -37,7 +36,6 @@ import thaumcraft.common.tiles.TileJarFillable;
import thaumcraft.common.tiles.TileJarFillableVoid;
import thaumic.tinkerer.common.lib.LibBlockNames;
@Optional.Interface(iface = "appeng.api.movable.IMovableTile", modid = "appliedenergistics2")
public class TileFunnel extends TileEntity implements ISidedInventory, IAspectContainer, IMovableTile {
ItemStack[] inventorySlots = new ItemStack[1];
@@ -292,12 +290,10 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo
}
@Override
@Optional.Method(modid = "appliedenergistics2")
public boolean prepareToMove() {
return true;
}
@Override
@Optional.Method(modid = "appliedenergistics2")
public void doneMoving() {}
}
@@ -34,8 +34,7 @@ import thaumic.tinkerer.common.ThaumicTinkerer;
import thaumic.tinkerer.common.core.helper.MiscHelper;
@Optional.InterfaceList({ @Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers"),
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft"),
@Optional.Interface(iface = "appeng.api.movable.IMovableTile", modid = "appliedenergistics2") })
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft") })
public class TileMagnet extends TileEntity implements IPeripheral, IMovableTile, SimpleComponent {
@Override
@@ -147,13 +146,11 @@ public class TileMagnet extends TileEntity implements IPeripheral, IMovableTile,
}
@Override
@Optional.Method(modid = "appliedenergistics2")
public boolean prepareToMove() {
return true;
}
@Override
@Optional.Method(modid = "appliedenergistics2")
public void doneMoving() {}
@Callback(doc = "function():boolean -- Returns Whether magnet is pushing or pulling")
@@ -34,7 +34,6 @@ import li.cil.oc.api.machine.Context;
import thaumic.tinkerer.common.item.ItemSoulMould;
import thaumic.tinkerer.common.lib.LibBlockNames;
@Optional.Interface(iface = "appeng.api.movable.IMovableTile", modid = "appliedenergistics2")
public class TileMobMagnet extends TileMagnet implements IInventory, IMovableTile {
private static final String TAG_ADULT = "adultCheck";
@@ -231,12 +230,10 @@ public class TileMobMagnet extends TileMagnet implements IInventory, IMovableTil
}
@Override
@Optional.Method(modid = "appliedenergistics2")
public boolean prepareToMove() {
return true;
}
@Override
@Optional.Method(modid = "appliedenergistics2")
public void doneMoving() {}
}
@@ -27,7 +27,6 @@ import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.movable.IMovableTile;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Optional;
import thaumcraft.api.ThaumcraftApiHelper;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
@@ -39,7 +38,7 @@ import thaumic.tinkerer.common.core.handler.ConfigHandler;
import thaumic.tinkerer.common.lib.LibBlockNames;
/* import thaumic.tinkerer.common.compat.TinkersConstructCompat; */
@Optional.Interface(iface = "appeng.api.movable.IMovableTile", modid = "appliedenergistics2")
public class TileRepairer extends TileEntity
implements ISidedInventory, IAspectContainer, IEssentiaTransport, IMovableTile {
@@ -377,12 +376,10 @@ public class TileRepairer extends TileEntity
}
@Override
@Optional.Method(modid = "appliedenergistics2")
public boolean prepareToMove() {
return true;
}
@Override
@Optional.Method(modid = "appliedenergistics2")
public void doneMoving() {}
}
@@ -29,11 +29,13 @@ public class ContainerIchorPouch extends ContainerPlayerInv {
ItemStack pouch;
int blockSlot;
public ContainerIchorPouch(EntityPlayer player, ItemStack bag) {
public ContainerIchorPouch(EntityPlayer player) {
super(player.inventory);
pouch = bag;
this.player = player;
pouch = player.getCurrentEquippedItem();
blockSlot = player.inventory.currentItem + 27 + 13 * 9;
for (int y = 0; y < 9; y++) for (int x = 0; x < 13; x++)
addSlotToContainer(new SlotNoPouches(inv, y * 13 + x, 12 + x * 18, 8 + y * 18));
initPlayerInv();
@@ -43,6 +45,17 @@ public class ContainerIchorPouch extends ContainerPlayerInv {
} catch (Exception ignored) {}
}
@Override
public void detectAndSendChanges() {
if (!player.worldObj.isRemote) {
if (player.getCurrentEquippedItem() != pouch) {
player.closeScreen();
return;
}
}
super.detectAndSendChanges();
}
@Override
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int slot) {
if (slot == blockSlot) return null;
@@ -55,8 +55,7 @@ import thaumic.tinkerer.common.block.BlockAnimationTablet;
import thaumic.tinkerer.common.lib.LibBlockNames;
@Optional.InterfaceList({ @Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers"),
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft"),
@Optional.Interface(iface = "appeng.api.movable.IMovableTile", modid = "appliedenergistics2") })
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft") })
public class TileAnimationTablet extends TileEntity implements IInventory, IMovableTile, IPeripheral, SimpleComponent {
private static final String TAG_LEFT_CLICK = "leftClick";
@@ -634,14 +633,12 @@ public class TileAnimationTablet extends TileEntity implements IInventory, IMova
}
@Override
@Optional.Method(modid = "appliedenergistics2")
public boolean prepareToMove() {
stopBreaking();
return true;
}
@Override
@Optional.Method(modid = "appliedenergistics2")
public void doneMoving() {}
@Override
@@ -257,35 +257,35 @@ public class TileTransvectorInterface extends TileTransvector
}
@Override
@Optional.Method(modid = "CoFHCore")
@Optional.Method(modid = "CoFHLib")
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
TileEntity tile = getTile();
return tile instanceof IEnergyHandler ? ((IEnergyHandler) tile).receiveEnergy(from, maxReceive, simulate) : 0;
}
@Override
@Optional.Method(modid = "CoFHCore")
@Optional.Method(modid = "CoFHLib")
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {
TileEntity tile = getTile();
return tile instanceof IEnergyHandler ? ((IEnergyHandler) tile).extractEnergy(from, maxExtract, simulate) : 0;
}
@Override
@Optional.Method(modid = "CoFHCore")
@Optional.Method(modid = "CoFHLib")
public int getEnergyStored(ForgeDirection from) {
TileEntity tile = getTile();
return tile instanceof IEnergyHandler ? ((IEnergyHandler) tile).getEnergyStored(from) : 0;
}
@Override
@Optional.Method(modid = "CoFHCore")
@Optional.Method(modid = "CoFHLib")
public int getMaxEnergyStored(ForgeDirection from) {
TileEntity tile = getTile();
return tile instanceof IEnergyHandler ? ((IEnergyHandler) tile).getMaxEnergyStored(from) : 0;
}
@Override
@Optional.Method(modid = "CoFHCore")
@Optional.Method(modid = "CoFHLib")
public boolean canConnectEnergy(ForgeDirection from) {
TileEntity tile = getTile();
return tile instanceof IEnergyHandler ? ((IEnergyHandler) tile).canConnectEnergy(from) : false;
@@ -66,7 +66,7 @@ public class ItemBloodSword extends ItemSword implements IRepairable, ITTinkerer
public ItemBloodSword() {
super(EnumHelper.addToolMaterial("TT_BLOOD", 0, 950, 0, 0, ThaumcraftApi.toolMatThaumium.getEnchantability()));
MinecraftForge.EVENT_BUS.register(new EventHandler());
MinecraftForge.EVENT_BUS.register(this);
setCreativeTab(ModCreativeTab.INSTANCE);
}
@@ -112,6 +112,60 @@ public class ItemBloodSword extends ItemSword implements IRepairable, ITTinkerer
event.drops.add(entityitem);
}
@SubscribeEvent
public void onDrops(LivingDropsEvent event) {
if (event.source.damageType.equals("player")) {
EntityPlayer player = (EntityPlayer) event.source.getEntity();
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null && stack.getItem() == this
&& stack.stackTagCompound != null
&& stack.stackTagCompound.getInteger("Activated") == 1) {
Aspect[] aspects = EnumMobAspect.getAspectsForEntity(event.entity);
// ScanResult sr=new ScanResult((byte)2,0,0,event.entity,"");
// AspectList as=ScanManager.getScanAspects(sr,event.entity.worldObj);
// if(as!=null && as.size()!=0){
if (aspects != null) {
event.drops.removeAll(event.drops);
// for(Aspect a:as.getAspects()){
for (Aspect a : aspects) {
addDrops(event, ItemMobAspect.getStackFromAspect(a));
}
}
}
}
}
@SubscribeEvent
public void onDamageTaken(LivingAttackEvent event) {
if (event.entity == null) return;
if (event.entity.worldObj.isRemote) return;
boolean handle = handleNext == 0;
if (!handle) handleNext--;
if (event.entityLiving instanceof EntityPlayer && handle) {
EntityPlayer player = (EntityPlayer) event.entityLiving;
ItemStack itemInUse = player.itemInUse;
if (itemInUse != null && itemInUse.getItem() == this) {
event.setCanceled(true);
handleNext = 3;
player.attackEntityFrom(DamageSource.magic, 3);
}
}
if (handle) {
Entity source = event.source.getSourceOfDamage();
if (source != null && source instanceof EntityLivingBase) {
EntityLivingBase attacker = (EntityLivingBase) source;
ItemStack itemInUse = attacker.getHeldItem();
if (itemInUse != null && itemInUse.getItem() == this) attacker.attackEntityFrom(DamageSource.magic, 2);
}
}
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World par2World, EntityPlayer par3EntityPlayer) {
@@ -185,62 +239,4 @@ public class ItemBloodSword extends ItemSword implements IRepairable, ITTinkerer
new ItemStack(Items.diamond),
new ItemStack(Items.ghast_tear));
}
public class EventHandler {
@SubscribeEvent
public void onDrops(LivingDropsEvent event) {
if (event.source.damageType.equals("player")) {
EntityPlayer player = (EntityPlayer) event.source.getEntity();
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null && stack.getItem() == ItemBloodSword.this
&& stack.stackTagCompound != null
&& stack.stackTagCompound.getInteger("Activated") == 1) {
Aspect[] aspects = EnumMobAspect.getAspectsForEntity(event.entity);
// ScanResult sr=new ScanResult((byte)2,0,0,event.entity,"");
// AspectList as=ScanManager.getScanAspects(sr,event.entity.worldObj);
// if(as!=null && as.size()!=0){
if (aspects != null) {
event.drops.removeAll(event.drops);
// for(Aspect a:as.getAspects()){
for (Aspect a : aspects) {
addDrops(event, ItemMobAspect.getStackFromAspect(a));
}
}
}
}
}
@SubscribeEvent
public void onDamageTaken(LivingAttackEvent event) {
if (event.entity == null) return;
if (event.entity.worldObj.isRemote) return;
boolean handle = handleNext == 0;
if (!handle) handleNext--;
if (event.entityLiving instanceof EntityPlayer && handle) {
EntityPlayer player = (EntityPlayer) event.entityLiving;
ItemStack itemInUse = player.itemInUse;
if (itemInUse != null && itemInUse.getItem() == ItemBloodSword.this) {
event.setCanceled(true);
handleNext = 3;
player.attackEntityFrom(DamageSource.magic, 3);
}
}
if (handle) {
Entity source = event.source.getSourceOfDamage();
if (source != null && source instanceof EntityLivingBase) {
EntityLivingBase attacker = (EntityLivingBase) source;
ItemStack itemInUse = attacker.getHeldItem();
if (itemInUse != null && itemInUse.getItem() == ItemBloodSword.this)
attacker.attackEntityFrom(DamageSource.magic, 2);
}
}
}
}
}
@@ -0,0 +1,222 @@
/**
* 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 4.
* Thaumcraft 4 (c) Azanor 2012
* (http://www.minecraftforum.net/topic/1585216-)
*
* File Created @ [Nov 24, 2013, 7:31:51 PM (GMT)]
*/
package thaumic.tinkerer.common.item;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.DamageSource;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import thaumcraft.api.IRepairable;
import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchPage;
import thaumcraft.common.config.ConfigItems;
import thaumic.tinkerer.client.core.helper.IconHelper;
import thaumic.tinkerer.common.core.handler.ModCreativeTab;
import thaumic.tinkerer.common.core.helper.EnumMobAspect;
import thaumic.tinkerer.common.lib.LibItemNames;
import thaumic.tinkerer.common.lib.LibResearch;
import thaumic.tinkerer.common.registry.ITTinkererItem;
import thaumic.tinkerer.common.registry.ThaumicTinkererInfusionRecipe;
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
import thaumic.tinkerer.common.research.IRegisterableResearch;
import thaumic.tinkerer.common.research.ResearchHelper;
import thaumic.tinkerer.common.research.TTResearchItem;
import java.util.ArrayList;
public class ItemBloodSword extends ItemSword implements IRepairable, ITTinkererItem {
@Override
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
return super.getItemUseAction(par1ItemStack);
}
private static final int DAMAGE = 10;
public ItemBloodSword() {
super(EnumHelper.addToolMaterial("TT_BLOOD", 0, 950, 0, 0, ThaumcraftApi.toolMatThaumium.getEnchantability()));
MinecraftForge.EVENT_BUS.register(this);
setCreativeTab(ModCreativeTab.INSTANCE);
}
private IIcon activeIcon;
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
<<<<<<< HEAD
if(stack==null)
return itemIcon;
if(stack.stackTagCompound==null)
return itemIcon;
return stack.stackTagCompound.getInteger("Activated") == 1 ? activeIcon : itemIcon;
=======
return (stack.stackTagCompound != null && stack.stackTagCompound.getInteger("Activated") == 1) ? activeIcon : itemIcon;
>>>>>>> develop
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister) {
itemIcon = IconHelper.forItem(par1IconRegister, this, 0);
activeIcon = IconHelper.forItem(par1IconRegister, this, 1);
}
@Override
public Multimap getItemAttributeModifiers() {
Multimap multimap = HashMultimap.create();
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", DAMAGE, 0));
multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", 0.25, 1));
return multimap;
}
static int handleNext = 0;
public void addDrops(LivingDropsEvent event, ItemStack dropStack) {
EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack);
entityitem.delayBeforeCanPickup = 10;
event.drops.add(entityitem);
}
@SubscribeEvent
public void onDrops(LivingDropsEvent event) {
if (event.source.damageType.equals("player")) {
EntityPlayer player = (EntityPlayer) event.source.getEntity();
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null && stack.getItem() == this && stack.stackTagCompound != null && stack.stackTagCompound.getInteger("Activated") == 1) {
Aspect[] aspects = EnumMobAspect.getAspectsForEntity(event.entity);
//ScanResult sr=new ScanResult((byte)2,0,0,event.entity,"");
//AspectList as=ScanManager.getScanAspects(sr,event.entity.worldObj);
//if(as!=null && as.size()!=0){
if (aspects != null) {
event.drops.removeAll(event.drops);
//for(Aspect a:as.getAspects()){
for (Aspect a : aspects) {
addDrops(event, ItemMobAspect.getStackFromAspect(a));
}
}
}
}
}
@SubscribeEvent
public void onDamageTaken(LivingAttackEvent event) {
if (event.entity.worldObj.isRemote)
return;
boolean handle = handleNext == 0;
if (!handle)
handleNext--;
if (event.entityLiving instanceof EntityPlayer && handle) {
EntityPlayer player = (EntityPlayer) event.entityLiving;
ItemStack itemInUse = player.itemInUse;
if (itemInUse != null && itemInUse.getItem() == this) {
event.setCanceled(true);
handleNext = 3;
player.attackEntityFrom(DamageSource.magic, 3);
}
}
if (handle) {
Entity source = event.source.getSourceOfDamage();
if (source != null && source instanceof EntityLivingBase) {
EntityLivingBase attacker = (EntityLivingBase) source;
ItemStack itemInUse = attacker.getHeldItem();
if (itemInUse != null && itemInUse.getItem() == this)
attacker.attackEntityFrom(DamageSource.magic, 2);
}
}
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World par2World,
EntityPlayer par3EntityPlayer) {
ItemStack cache = super.onItemRightClick(stack, par2World, par3EntityPlayer);
if (par3EntityPlayer.isSneaking() && !par2World.isRemote) {
if (stack.stackTagCompound == null) {
stack.stackTagCompound = new NBTTagCompound();
}
if (stack.stackTagCompound.getInteger("Activated") == 0) {
par3EntityPlayer.addChatMessage(new ChatComponentTranslation("ttmisc.bloodSword.activateEssentiaHarvest"));
stack.stackTagCompound.setInteger("Activated", 1);
} else {
par3EntityPlayer.addChatMessage(new ChatComponentTranslation("ttmisc.bloodSword.deactivateEssentiaHarvest"));
stack.stackTagCompound.setInteger("Activated", 0);
}
}
return cache;
}
@Override
public ArrayList<Object> getSpecialParameters() {
return null;
}
@Override
public String getItemName() {
return LibItemNames.BLOOD_SWORD;
}
@Override
public boolean shouldRegister() {
return true;
}
@Override
public boolean shouldDisplayInTab() {
return true;
}
@Override
public IRegisterableResearch getResearchItem() {
return (TTResearchItem) new TTResearchItem(LibResearch.KEY_BLOOD_SWORD, new AspectList().add(Aspect.HUNGER, 2).add(Aspect.WEAPON, 1).add(Aspect.FLESH, 1).add(Aspect.SOUL, 1), -4, 6, 3, new ItemStack(this)).setParents(LibResearch.KEY_CLEANSING_TALISMAN)
.setPages(new ResearchPage("0"), ResearchHelper.infusionPage(LibResearch.KEY_BLOOD_SWORD), new ResearchPage("1")).setSecondary();
}
@Override
public ThaumicTinkererRecipe getRecipeItem() {
return new ThaumicTinkererInfusionRecipe(LibResearch.KEY_BLOOD_SWORD, new ItemStack(this), 6, new AspectList().add(Aspect.HUNGER, 20).add(Aspect.DARKNESS, 5).add(Aspect.SOUL, 10).add(Aspect.MAN, 6), new ItemStack(ConfigItems.itemSwordThaumium),
new ItemStack(Items.rotten_flesh), new ItemStack(Items.porkchop), new ItemStack(Items.beef), new ItemStack(Items.bone), new ItemStack(Items.diamond), new ItemStack(Items.ghast_tear));
}
}
@@ -96,7 +96,7 @@ public class ItemFocusDeflect extends ItemModFocus {
private static void checkBotaniaMagicMissile(Entity e) {
if (!Loader.isModLoaded("Botania")) return;
if (e instanceof EntityMagicMissile) {
e.setDead();
((EntityMagicMissile) e).setTarget(null);
}
}
@@ -117,7 +117,7 @@ public class ItemFocusDislocation extends ItemModFocus {
stack.getItemDamage(),
1 | 2);
((ItemBlock) stack.getItem()).field_150939_a
.onBlockPlacedBy(world, mop.blockX, mop.blockY, mop.blockZ, player, stack);
.onBlockPlacedBy(world, mop.blockX, mop.blockY, mop.blockZ, player, itemstack);
NBTTagCompound tileCmp = getStackTileEntity(itemstack);
if (tileCmp != null && !tileCmp.hasNoTags()) {
TileEntity tile1 = TileEntity.createAndLoadEntity(tileCmp);
@@ -75,8 +75,7 @@ public class ItemIchorPouch extends ItemFocusPouch implements IBauble, ITTinkere
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!par2World.isRemote)
par3EntityPlayer.openGui(ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_ICHOR_POUCH, par2World, 0, 0, 0);
par3EntityPlayer.openGui(ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_ICHOR_POUCH, par2World, 0, 0, 0);
return par1ItemStack;
}
@@ -49,6 +49,50 @@ public class ItemProtoclay extends ItemKamiBase {
setMaxStackSize(1);
}
@SubscribeEvent
public void Interact(PlayerInteractEvent event) {
if (event.entityPlayer.inventory.hasItem(ThaumicTinkerer.registry.getFirstItemFromClass(ItemProtoclay.class))) {
World par2World = event.world;
Entity par3Entity = event.entityPlayer;
EntityPlayer player = (EntityPlayer) par3Entity;
ItemStack currentStack = player.getCurrentEquippedItem();
if (currentStack == null || !(currentStack.getItem() instanceof IAdvancedTool)) return;
IAdvancedTool tool = (IAdvancedTool) currentStack.getItem();
if (tool.getType().equals("sword")) return;
MovingObjectPosition pos = ToolHandler.raytraceFromEntity(par2World, par3Entity, true, 4.5F);
String typeToFind = "";
if (player.isSwingInProgress && pos != null) {
Block block = par2World.getBlock(pos.blockX, pos.blockY, pos.blockZ);
if (block != null) {
Material mat = block.getMaterial();
if (ToolHandler.isRightMaterial(mat, ToolHandler.materialsPick)) typeToFind = "pick";
else if (ToolHandler.isRightMaterial(mat, ToolHandler.materialsShovel)) typeToFind = "shovel";
else if (ToolHandler.isRightMaterial(mat, ToolHandler.materialsAxe)) typeToFind = "axe";
}
}
if (tool.getType().equals(typeToFind) || typeToFind.isEmpty()) return;
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
ItemStack stackInSlot = player.inventory.getStackInSlot(i);
if (stackInSlot != null && stackInSlot.getItem() instanceof IAdvancedTool
&& stackInSlot != currentStack) {
IAdvancedTool toolInSlot = (IAdvancedTool) stackInSlot.getItem();
if (toolInSlot.getType().equals(typeToFind)) {
player.inventory.setInventorySlotContents(player.inventory.currentItem, stackInSlot);
player.inventory.setInventorySlotContents(i, currentStack);
break;
}
}
}
event.setCanceled(true);
}
}
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) {}
@@ -92,56 +136,7 @@ public class ItemProtoclay extends ItemKamiBase {
@Override
public boolean shouldRegister() {
MinecraftForge.EVENT_BUS.register(new EventHandler());
MinecraftForge.EVENT_BUS.register(this);
return super.shouldRegister();
}
public class EventHandler {
@SubscribeEvent
public void Interact(PlayerInteractEvent event) {
if (event.entityPlayer.inventory
.hasItem(ThaumicTinkerer.registry.getFirstItemFromClass(ItemProtoclay.class))) {
World par2World = event.world;
Entity par3Entity = event.entityPlayer;
EntityPlayer player = (EntityPlayer) par3Entity;
ItemStack currentStack = player.getCurrentEquippedItem();
if (currentStack == null || !(currentStack.getItem() instanceof IAdvancedTool)) return;
IAdvancedTool tool = (IAdvancedTool) currentStack.getItem();
if (tool.getType().equals("sword")) return;
MovingObjectPosition pos = ToolHandler.raytraceFromEntity(par2World, par3Entity, true, 4.5F);
String typeToFind = "";
if (player.isSwingInProgress && pos != null) {
Block block = par2World.getBlock(pos.blockX, pos.blockY, pos.blockZ);
if (block != null) {
Material mat = block.getMaterial();
if (ToolHandler.isRightMaterial(mat, ToolHandler.materialsPick)) typeToFind = "pick";
else if (ToolHandler.isRightMaterial(mat, ToolHandler.materialsShovel)) typeToFind = "shovel";
else if (ToolHandler.isRightMaterial(mat, ToolHandler.materialsAxe)) typeToFind = "axe";
}
}
if (tool.getType().equals(typeToFind) || typeToFind.isEmpty()) return;
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
ItemStack stackInSlot = player.inventory.getStackInSlot(i);
if (stackInSlot != null && stackInSlot.getItem() instanceof IAdvancedTool
&& stackInSlot != currentStack) {
IAdvancedTool toolInSlot = (IAdvancedTool) stackInSlot.getItem();
if (toolInSlot.getType().equals(typeToFind)) {
player.inventory.setInventorySlotContents(player.inventory.currentItem, stackInSlot);
player.inventory.setInventorySlotContents(i, currentStack);
break;
}
}
}
event.setCanceled(true);
}
}
}
}
@@ -20,21 +20,15 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.event.entity.living.LivingFallEvent;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchPage;
import thaumcraft.common.Thaumcraft;
import thaumcraft.common.config.ConfigBlocks;
import thaumcraft.common.config.ConfigItems;
import thaumic.tinkerer.common.ThaumicTinkerer;
@@ -47,12 +41,8 @@ import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
import thaumic.tinkerer.common.research.IRegisterableResearch;
import thaumic.tinkerer.common.research.KamiResearchItem;
import thaumic.tinkerer.common.research.ResearchHelper;
import thaumicboots.api.IBoots;
@Interface(iface = "thaumicboots.api.IBoots", modid = "thaumicboots")
public class ItemGemBoots extends ItemIchorclothArmorAdv implements IBoots {
public float speedBonus = 0.075F;
public class ItemGemBoots extends ItemIchorclothArmorAdv {
public static List<String> playersWith1Step = new ArrayList<>();
@@ -73,14 +63,14 @@ public class ItemGemBoots extends ItemIchorclothArmorAdv implements IBoots {
if (player.worldObj.isRemote) player.stepHeight = player.isSneaking() ? 0.5F : 1F;
if ((player.onGround || player.capabilities.isFlying) && player.moveForward > 0F)
player.moveFlying(0F, speedBonus, player.capabilities.isFlying ? 0.075F : 0.15F);
player.moveFlying(0F, 1F, player.capabilities.isFlying ? 0.075F : 0.15F);
player.jumpMovementFactor = player.isSprinting() ? 0.05F : 0.04F;
player.fallDistance = 0F;
if (ConfigHandler.shouldKamiBootsDoGrass) {
int x = MathHelper.floor_double(player.posX);
int y = MathHelper.floor_double(player.posY) - 1;
int z = MathHelper.floor_double(player.posZ);
int x = (int) player.posX;
int y = (int) player.posY - 1;
int z = (int) player.posZ;
if (player.worldObj.getBlock(x, y, z) == Blocks.dirt && player.worldObj.getBlockMetadata(x, y, z) == 0)
player.worldObj.setBlock(x, y, z, Blocks.grass, 0, 2);
}
@@ -130,143 +120,47 @@ public class ItemGemBoots extends ItemIchorclothArmorAdv implements IBoots {
new ItemStack(Items.lead));
}
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
if (getIntertialState(itemStack) && player.moveForward == 0
&& player.moveStrafing == 0
&& player.capabilities.isFlying) {
player.motionX *= 0.5;
player.motionZ *= 0.5;
}
boolean omniMode = false;
if (ThaumicTinkerer.isBootsActive) {
omniMode = isOmniEnabled(itemStack);
if ((player.moveForward == 0F && player.moveStrafing == 0F && omniMode)
|| (player.moveForward <= 0F && !omniMode)) {
return;
}
}
if (player.moveForward != 0.0F || player.moveStrafing != 0.0F) {
if (player.worldObj.isRemote && !player.isSneaking()) {
if (!Thaumcraft.instance.entityEventHandler.prevStep.containsKey(player.getEntityId())) {
Thaumcraft.instance.entityEventHandler.prevStep.put(player.getEntityId(), player.stepHeight);
}
player.stepHeight = 1.0F;
}
float speedMod = (float) getSpeedModifier(itemStack);
if (player.onGround || player.isOnLadder() || player.capabilities.isFlying) {
float bonus = speedBonus;
if (player.isInWater()) {
bonus /= 4.0F;
}
@SubscribeEvent
public void onPlayerJump(LivingJumpEvent event) {
if (event.entityLiving instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.entityLiving;
boolean hasArmor = player.getCurrentArmor(0) != null && player.getCurrentArmor(0).getItem() == this;
if (player.isSneaking()) {
bonus /= 2.0F;
}
bonus *= speedMod;
if (ThaumicTinkerer.isBootsActive) {
applyOmniState(player, bonus, itemStack);
} else if (player.moveForward > 0.0) {
player.moveFlying(0.0F, player.moveForward, bonus);
}
if (hasArmor && ThaumicTinkerer.proxy.armorStatus(player) && player.getCurrentArmor(0).getItemDamage() == 0)
player.motionY += 0.3;
}
}
// Attempt at fixing a bug with falling on SMP
// In theory, this should be redundant
@SubscribeEvent
public void onFall(LivingFallEvent event) {
if (event.entityLiving instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.entityLiving;
boolean hasArmor = player.getCurrentArmor(0) != null && player.getCurrentArmor(0).getItem() == this;
if (hasArmor) {
event.distance = 0;
}
}
}
@Optional.Method(modid = "thaumicboots")
public void applyOmniState(EntityPlayer player, float bonus, ItemStack itemStack) {
if (player.moveForward != 0.0) {
player.moveFlying(0.0F, player.moveForward, bonus);
}
if (player.moveStrafing != 0.0 && getOmniState(itemStack)) {
player.moveFlying(player.moveStrafing, 0.0F, bonus);
}
}
@SubscribeEvent(priority = EventPriority.HIGH)
public void onLivingUpdate(LivingUpdateEvent event) {
if (event.entityLiving instanceof EntityPlayer && event.entityLiving.worldObj.isRemote) {
EntityPlayer player = (EntityPlayer) event.entityLiving;
// Avoid NSM Exception when ThaumicBoots is not present.
public double getSpeedModifier(ItemStack stack) {
if (stack.stackTagCompound != null) {
return stack.stackTagCompound.getDouble("speed");
}
return 1.0;
}
boolean highStepListed = playersWith1Step.contains(player.getGameProfile().getName());
boolean hasHighStep = player.getCurrentArmor(0) != null && player.getCurrentArmor(0).getItem() == this;
public double getJumpModifier(ItemStack stack) {
if (stack.stackTagCompound != null) {
return stack.stackTagCompound.getDouble("jump");
}
return 1.0;
}
if (!highStepListed && (hasHighStep && ThaumicTinkerer.proxy.armorStatus(player)
&& player.getCurrentArmor(0).getItemDamage() == 0))
playersWith1Step.add(player.getGameProfile().getName());
public boolean getOmniState(ItemStack stack) {
if (stack.stackTagCompound != null) {
return stack.stackTagCompound.getBoolean("omni");
}
return false;
}
public boolean getIntertialState(ItemStack stack) {
if (stack.stackTagCompound != null) {
return stack.stackTagCompound.getBoolean("inertiacanceling");
}
return false;
}
@Override
public void registerEvents() {
super.registerEvents();
MinecraftForge.EVENT_BUS.register(new EventHandler());
}
public class EventHandler {
@SubscribeEvent
public void onPlayerJump(LivingJumpEvent event) {
if (event.entityLiving instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.entityLiving;
ItemStack boots = player.getCurrentArmor(0);
boolean hasArmor = player.getCurrentArmor(0) != null
&& player.getCurrentArmor(0).getItem() == ItemGemBoots.this;
if (hasArmor && ThaumicTinkerer.proxy.armorStatus(player)
&& player.getCurrentArmor(0).getItemDamage() == 0)
player.motionY += 0.3 * (float) getJumpModifier(boots);;
}
}
// Attempt at fixing a bug with falling on SMP
// In theory, this should be redundant
@SubscribeEvent
public void onFall(LivingFallEvent event) {
if (event.entityLiving instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.entityLiving;
boolean hasArmor = player.getCurrentArmor(0) != null
&& player.getCurrentArmor(0).getItem() == ItemGemBoots.this;
if (hasArmor) {
event.distance = 0;
}
}
}
@SubscribeEvent(priority = EventPriority.HIGH)
public void onLivingUpdate(LivingUpdateEvent event) {
if (event.entityLiving instanceof EntityPlayer && event.entityLiving.worldObj.isRemote) {
EntityPlayer player = (EntityPlayer) event.entityLiving;
boolean highStepListed = playersWith1Step.contains(player.getGameProfile().getName());
boolean hasHighStep = player.getCurrentArmor(0) != null
&& player.getCurrentArmor(0).getItem() == ItemGemBoots.this;
if (!highStepListed && (hasHighStep && ThaumicTinkerer.proxy.armorStatus(player)
&& player.getCurrentArmor(0).getItemDamage() == 0))
playersWith1Step.add(player.getGameProfile().getName());
if ((!hasHighStep || !ThaumicTinkerer.proxy.armorStatus(player)
|| player.getCurrentArmor(0).getItemDamage() == 1) && highStepListed) {
playersWith1Step.remove(player.getGameProfile().getName());
player.stepHeight = 0.5F;
}
if ((!hasHighStep || !ThaumicTinkerer.proxy.armorStatus(player)
|| player.getCurrentArmor(0).getItemDamage() == 1) && highStepListed) {
playersWith1Step.remove(player.getGameProfile().getName());
player.stepHeight = 0.5F;
}
}
}
@@ -20,7 +20,6 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@@ -129,36 +128,27 @@ public class ItemGemChest extends ItemIchorclothArmorAdv {
new ItemStack(Items.arrow));
}
@Override
public void registerEvents() {
super.registerEvents();
MinecraftForge.EVENT_BUS.register(new EventHandler());
}
@SubscribeEvent
public void updatePlayerFlyStatus(LivingUpdateEvent event) {
if (event.entityLiving instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.entityLiving;
public class EventHandler {
ItemStack armor = player.getCurrentArmor(3 - armorType);
if (armor != null && armor.getItem() == this) tickPlayer(player);
@SubscribeEvent
public void updatePlayerFlyStatus(LivingUpdateEvent event) {
if (event.entityLiving instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.entityLiving;
ItemStack armor = player.getCurrentArmor(3 - armorType);
if (armor != null && armor.getItem() == ItemGemChest.this) tickPlayer(player);
if (playersWithFlight.contains(playerStr(player))) {
if (shouldPlayerHaveFlight(player)) player.capabilities.allowFlying = true;
else {
if (!player.capabilities.isCreativeMode) {
player.capabilities.allowFlying = false;
player.capabilities.isFlying = false;
player.capabilities.disableDamage = false;
}
playersWithFlight.remove(playerStr(player));
if (playersWithFlight.contains(playerStr(player))) {
if (shouldPlayerHaveFlight(player)) player.capabilities.allowFlying = true;
else {
if (!player.capabilities.isCreativeMode) {
player.capabilities.allowFlying = false;
player.capabilities.isFlying = false;
player.capabilities.disableDamage = false;
}
} else if (shouldPlayerHaveFlight(player)) {
playersWithFlight.add(playerStr(player));
player.capabilities.allowFlying = true;
playersWithFlight.remove(playerStr(player));
}
} else if (shouldPlayerHaveFlight(player)) {
playersWithFlight.add(playerStr(player));
player.capabilities.allowFlying = true;
}
}
}
@@ -22,23 +22,19 @@ import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import gregtech.api.hazards.Hazard;
import gregtech.api.hazards.IHazardProtector;
import thaumcraft.api.aspects.Aspect;
import thaumic.tinkerer.client.core.handler.kami.ToolModeHUDHandler;
import thaumic.tinkerer.client.lib.LibResources;
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
import thaumic.tinkerer.common.research.IRegisterableResearch;
@Optional.InterfaceList({ @Optional.Interface(iface = "gregtech.api.hazards.IHazardProtector", modid = "gregtech_nh") })
public abstract class ItemIchorclothArmorAdv extends ItemIchorclothArmor implements IHazardProtector {
public abstract class ItemIchorclothArmorAdv extends ItemIchorclothArmor {
public ItemIchorclothArmorAdv(int par2) {
super(par2);
setHasSubtypes(true);
registerEvents();
if (ticks()) MinecraftForge.EVENT_BUS.register(this);
}
public ItemIchorclothArmorAdv() {
@@ -86,6 +82,16 @@ public abstract class ItemIchorclothArmorAdv extends ItemIchorclothArmor impleme
return false;
}
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event) {
if (event.entityLiving instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.entityLiving;
ItemStack armor = player.getCurrentArmor(3 - armorType);
if (armor != null && armor.getItem() == this) tickPlayer(player);
}
}
void tickPlayer(EntityPlayer player) {
// NO-OP
}
@@ -102,28 +108,4 @@ public abstract class ItemIchorclothArmorAdv extends ItemIchorclothArmor impleme
public ThaumicTinkererRecipe getRecipeItem() {
return null;
}
/// GT5 Hazmat protection
@Optional.Method(modid = "gregtech_nh")
@Override
public boolean protectsAgainst(ItemStack itemStack, Hazard hazard) {
return true;
}
protected void registerEvents() {
if (ticks()) MinecraftForge.EVENT_BUS.register(new EventHandler());
}
public class EventHandler {
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event) {
if (event.entityLiving instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.entityLiving;
ItemStack armor = player.getCurrentArmor(3 - armorType);
if (armor != null && armor.getItem() == ItemIchorclothArmorAdv.this) tickPlayer(player);
}
}
}
}
@@ -60,7 +60,7 @@ public class GuiHandler implements IGuiHandler {
case LibGuiIDs.GUI_ID_ICHOR_POUCH:
if (!isDimensionAllowed(player)) return null;
return new ContainerIchorPouch(player, player.getCurrentEquippedItem());
return new ContainerIchorPouch(player);
case LibGuiIDs.GUI_ID_WARP_GATE:
return new ContainerWarpGate((TileWarpGate) tile, player.inventory);
@@ -87,8 +87,8 @@ public class GuiHandler implements IGuiHandler {
return new GuiAspectAnalyzer((TileAspectAnalyzer) tile, player.inventory);
case LibGuiIDs.GUI_ID_ICHOR_POUCH:
if ((!isDimensionAllowed(player))) return null;
return new GuiIchorPouch(new ContainerIchorPouch(player, player.getCurrentEquippedItem()));
if (!isDimensionAllowed(player)) return null;
return new GuiIchorPouch(new ContainerIchorPouch(player));
case LibGuiIDs.GUI_ID_WARP_GATE:
return new GuiWarpGate((TileWarpGate) tile, player.inventory);
@@ -411,7 +411,7 @@ ttresearch.lore.FOCUS_HEAL=Pansements etc.
ttresearch.page.FOCUS_HEAL.0=You know Pech carry powerful foci that can induce diseases, with that, you devised a way to use them to your benefits.<BR><BR>This focus will slowly mend the caster's wounds as they're using it, using vis from the wand in the process.
# -- WAND FOCUS: ENDER RIFT
ttresearch.name.FOCUS_ENDER_CHEST=Foci de baguette: Crevasse du Néant
ttresearch.name.FOCUS_ENDER_Foci de baguette: Crevasse du Néant
ttresearch.lore.FOCUS_ENDER_CHEST=Une poche de la quatrième dimension
ttresearch.page.FOCUS_ENDER_CHEST.0=By combining a Hand Mirror with a portable hole, you managed to construct a focus that tears a rift in the ender, allowing you to access the contents of your Ender Chest remotely.
ttresearch.page.FOCUS_ENDER_CHEST.ES=By combining a Hand Mirror with a portable hole, you managed to construct a focus that tears a rift in the ender, allowing you to access the contents of your Ender Chests remotely. <BR> Shift right click on an ender chest to set the focus to that colour, or shift right click on a block of obsidian to set the focus to the vanilla ender storage.