diff --git a/build.gradle b/build.gradle index 8adf0aa..3c958f4 100644 --- a/build.gradle +++ b/build.gradle @@ -32,7 +32,12 @@ minecraft { runDir = "run" } +repositories { + maven { url = "https://maven.tilera.xyz" } +} + dependencies { + implementation "thaumcraft:Thaumcraft:1.7.10-4.2.3.5:deobf" } processResources { @@ -54,6 +59,12 @@ task sourcesJar(type: Jar) { classifier = 'sources' } +jar { + manifest { + attributes "FMLAT": "dartcraft_at.cfg" + } +} + publishing { tasks.publish.dependsOn 'build' publications { diff --git a/src/main/java/ley/modding/dartcraft/Dartcraft.java b/src/main/java/ley/modding/dartcraft/Dartcraft.java index 5874668..22e9cd4 100644 --- a/src/main/java/ley/modding/dartcraft/Dartcraft.java +++ b/src/main/java/ley/modding/dartcraft/Dartcraft.java @@ -19,6 +19,7 @@ import ley.modding.dartcraft.entity.EntityFlyingFlask; import ley.modding.dartcraft.entity.EntityFrozenItem; import ley.modding.dartcraft.entity.EntityTime; import ley.modding.dartcraft.event.EventHandler; +import ley.modding.dartcraft.handlers.TimeHandler; import ley.modding.dartcraft.internal.Registry; import ley.modding.dartcraft.item.DartItems; import ley.modding.dartcraft.network.PacketClipButton; @@ -55,6 +56,7 @@ public class Dartcraft { @Mod.EventHandler public void preInit(FMLPreInitializationEvent e) { MinecraftForge.EVENT_BUS.register(new EventHandler()); + MinecraftForge.EVENT_BUS.register(new TimeHandler()); channel = NetworkRegistry.INSTANCE.newSimpleChannel("dartcraft"); int desc = 0; channel.registerMessage( diff --git a/src/main/java/ley/modding/dartcraft/client/fx/FXCure.java b/src/main/java/ley/modding/dartcraft/client/fx/FXCure.java new file mode 100644 index 0000000..aaa8ddc --- /dev/null +++ b/src/main/java/ley/modding/dartcraft/client/fx/FXCure.java @@ -0,0 +1,163 @@ +package ley.modding.dartcraft.client.fx; + +import java.awt.Color; + +import org.lwjgl.opengl.GL11; + +import ley.modding.dartcraft.Dartcraft; +import ley.modding.dartcraft.proxy.CommonProxy; +import net.minecraft.client.Minecraft; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; + +public class FXCure extends EntityFX { + public static final int TYPE_FALL = 0; + public static final int TYPE_CHANGE = 1; + public static final int TYPE_BREAK = 2; + private int iconIndex = 16; + private int changeTime; + private int type; + private Color color; + + public FXCure( + World world, double x, double y, double z, double vx, double vy, double vz + ) { + super(world, x, y, z, vx, vy, vz); + } + + public FXCure(World world, double x, double y, double z, int color, int type) { + super(world, x, y, z); + this.color = new Color(color); + this.particleRed = (float) this.color.getRed(); + this.particleGreen = (float) this.color.getGreen(); + this.particleBlue = (float) this.color.getBlue(); + this.setSize(0.01F, 0.01F); + this.changeTime = 0; + this.noClip = true; + this.type = type; + float velModifier; + switch (type) { + case 0: + this.motionX = this.motionZ = 0.0D; + this.motionY = -0.025D; + this.particleMaxAge = (int) (85.0D + * ((double) world.rand.nextFloat() * 0.2D + + 0.8999999761581421D)); + break; + case 1: + velModifier = 0.25F; + this.motionX = (double) ((CommonProxy.rand.nextFloat() * 2.0F - 1.0F) + * velModifier); + this.motionY = (double) ((CommonProxy.rand.nextFloat() * 2.0F - 1.0F) + * velModifier); + this.motionZ = (double) ((CommonProxy.rand.nextFloat() * 2.0F - 1.0F) + * velModifier); + this.particleMaxAge = (int) (10.0D + * ((double) world.rand.nextFloat() * 0.2D + + 0.8999999761581421D)); + break; + case 2: + velModifier = 0.1F; + this.motionX = (double) ((CommonProxy.rand.nextFloat() * 2.0F - 1.0F) + * velModifier); + this.motionY = (double) velModifier; + this.motionZ = (double) ((CommonProxy.rand.nextFloat() * 2.0F - 1.0F) + * velModifier); + this.particleMaxAge = (int) (10.0D + * ((double) world.rand.nextFloat() * 0.2D + + 0.8999999761581421D)); + this.particleGravity = 0.5F; + } + } + + public void onUpdate() { + super.onUpdate(); + ++this.changeTime; + if (this.changeTime > 5) { + ++this.iconIndex; + this.changeTime = 0; + } + + if (this.iconIndex > 19) { + this.iconIndex = 16; + } + + this.rotationPitch += 0.01F; + switch (this.type) { + case 2: + default: + } + } + + public void renderParticle( + Tessellator tessy, + float par2, + float par3, + float par4, + float par5, + float par6, + float par7 + ) { + tessy.draw(); + GL11.glPushMatrix(); + GL11.glDepthMask(false); + GL11.glEnable(3042); + GL11.glBlendFunc(770, 1); + Dartcraft.proxy.bindTexture("darticles.png"); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F); + float var8 = (float) (this.iconIndex % 8) / 8.0F; + float var9 = var8 + 0.124875F; + float var10 = (float) (this.iconIndex / 8) / 8.0F; + float var11 = var10 + 0.124875F; + float var12 = 0.1F * this.particleScale; + float var13 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) par2 + - interpPosX); + float var14 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) par2 + - interpPosY); + float var15 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) par2 + - interpPosZ); + tessy.startDrawingQuads(); + tessy.setBrightness(240); + tessy.setColorRGBA_F( + this.particleRed, this.particleGreen, this.particleBlue, 1.0F + ); + tessy.addVertexWithUV( + (double) (var13 - par3 * var12 - par6 * var12), + (double) (var14 - par4 * var12), + (double) (var15 - par5 * var12 - par7 * var12), + (double) var9, + (double) var11 + ); + tessy.addVertexWithUV( + (double) (var13 - par3 * var12 + par6 * var12), + (double) (var14 + par4 * var12), + (double) (var15 - par5 * var12 + par7 * var12), + (double) var9, + (double) var10 + ); + tessy.addVertexWithUV( + (double) (var13 + par3 * var12 + par6 * var12), + (double) (var14 + par4 * var12), + (double) (var15 + par5 * var12 + par7 * var12), + (double) var8, + (double) var10 + ); + tessy.addVertexWithUV( + (double) (var13 + par3 * var12 - par6 * var12), + (double) (var14 - par4 * var12), + (double) (var15 + par5 * var12 - par7 * var12), + (double) var8, + (double) var11 + ); + tessy.draw(); + GL11.glDisable(3042); + GL11.glDepthMask(true); + GL11.glPopMatrix(); + Minecraft.getMinecraft().getTextureManager().bindTexture( + new ResourceLocation("textures/particle/particles.png") + ); + tessy.startDrawingQuads(); + } +} diff --git a/src/main/java/ley/modding/dartcraft/client/fx/FXWindWaker.java b/src/main/java/ley/modding/dartcraft/client/fx/FXWindWaker.java new file mode 100644 index 0000000..2120e0e --- /dev/null +++ b/src/main/java/ley/modding/dartcraft/client/fx/FXWindWaker.java @@ -0,0 +1,158 @@ +package ley.modding.dartcraft.client.fx; + +import java.awt.Color; + +import org.lwjgl.opengl.GL11; + +import ley.modding.dartcraft.Dartcraft; +import ley.modding.dartcraft.proxy.CommonProxy; +import net.minecraft.client.Minecraft; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; + +public class FXWindWaker extends EntityFX { + public static final int TYPE_FALL = 0; + public static final int TYPE_CHANGE = 1; + public static final int TYPE_BREAK = 2; + public static final int TYPE_SKATE = 3; + private int iconIndex; + + public FXWindWaker( + World world, double x, double y, double z, double vx, double vy, double vz + ) { + super(world, x, y, z, vx, vy, vz); + } + + public FXWindWaker(World world, double x, double y, double z, int color, int type) { + super(world, x, y, z); + Color col = new Color(color); + this.particleRed = (float) col.getRed(); + this.particleGreen = (float) col.getGreen(); + this.particleBlue = (float) col.getBlue(); + this.setSize(0.005F, 0.005F); + this.noClip = true; + this.iconIndex = 9 + this.rand.nextInt(3); + float velModifier; + switch (type) { + case 0: + this.motionX = this.motionZ = 0.0D; + this.motionY = -0.25D + this.rand.nextDouble() * 0.125D; + this.particleMaxAge = (int) (20.0D + * ((double) world.rand.nextFloat() * 0.2D + + 0.8999999761581421D)); + break; + case 1: + velModifier = 0.25F; + this.motionX = (double) ((CommonProxy.rand.nextFloat() * 2.0F - 1.0F) + * velModifier); + this.motionY = (double) ((CommonProxy.rand.nextFloat() * 2.0F - 1.0F) + * velModifier); + this.motionZ = (double) ((CommonProxy.rand.nextFloat() * 2.0F - 1.0F) + * velModifier); + this.particleMaxAge = (int) (10.0D + * ((double) world.rand.nextFloat() * 0.2D + + 0.8999999761581421D)); + break; + case 2: + velModifier = 0.1F; + this.motionX = (double) ((CommonProxy.rand.nextFloat() * 2.0F - 1.0F) + * velModifier); + this.motionY = (double) velModifier; + this.motionZ = (double) ((CommonProxy.rand.nextFloat() * 2.0F - 1.0F) + * velModifier); + this.particleMaxAge = (int) (10.0D + * ((double) world.rand.nextFloat() * 0.2D + + 0.8999999761581421D)); + this.particleGravity = 0.5F; + break; + case 3: + this.particleScale *= 0.33F; + velModifier = 0.1F; + this.motionX = (double) ((CommonProxy.rand.nextFloat() * 2.0F - 1.0F) + * velModifier); + this.motionY = (double) velModifier; + this.motionZ = (double) ((CommonProxy.rand.nextFloat() * 2.0F - 1.0F) + * velModifier); + this.particleMaxAge = (int) (10.0D + * ((double) world.rand.nextFloat() * 0.2D + + 0.8999999761581421D)); + this.particleGravity = 0.0F; + } + } + + public void onUpdate() { + super.onUpdate(); + } + + public void renderParticle( + Tessellator tessy, + float par2, + float par3, + float par4, + float par5, + float par6, + float par7 + ) { + tessy.draw(); + GL11.glPushMatrix(); + GL11.glDepthMask(false); + GL11.glEnable(3042); + GL11.glBlendFunc(770, 1); + Dartcraft.proxy.bindTexture("darticles.png"); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + float var8 = (float) (this.iconIndex % 8) / 8.0F; + float var9 = var8 + 0.124875F; + float var10 = (float) (this.iconIndex / 8) / 8.0F; + float var11 = var10 + 0.124875F; + float var12 = 0.1F * this.particleScale; + float var13 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) par2 + - interpPosX); + float var14 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) par2 + - interpPosY); + float var15 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) par2 + - interpPosZ); + tessy.startDrawingQuads(); + tessy.setBrightness(240); + tessy.setColorRGBA_F( + this.particleRed, this.particleGreen, this.particleBlue, 1.0F + ); + tessy.addVertexWithUV( + (double) (var13 - par3 * var12 - par6 * var12), + (double) (var14 - par4 * var12), + (double) (var15 - par5 * var12 - par7 * var12), + (double) var9, + (double) var11 + ); + tessy.addVertexWithUV( + (double) (var13 - par3 * var12 + par6 * var12), + (double) (var14 + par4 * var12), + (double) (var15 - par5 * var12 + par7 * var12), + (double) var9, + (double) var10 + ); + tessy.addVertexWithUV( + (double) (var13 + par3 * var12 + par6 * var12), + (double) (var14 + par4 * var12), + (double) (var15 + par5 * var12 + par7 * var12), + (double) var8, + (double) var10 + ); + tessy.addVertexWithUV( + (double) (var13 + par3 * var12 - par6 * var12), + (double) (var14 - par4 * var12), + (double) (var15 + par5 * var12 - par7 * var12), + (double) var8, + (double) var11 + ); + tessy.draw(); + GL11.glDisable(3042); + GL11.glDepthMask(true); + GL11.glPopMatrix(); + Minecraft.getMinecraft().getTextureManager().bindTexture( + new ResourceLocation("textures/particle/particles.png") + ); + tessy.startDrawingQuads(); + } +} diff --git a/src/main/java/ley/modding/dartcraft/entity/EntityTime.java b/src/main/java/ley/modding/dartcraft/entity/EntityTime.java index 874f0c8..64d3b2b 100644 --- a/src/main/java/ley/modding/dartcraft/entity/EntityTime.java +++ b/src/main/java/ley/modding/dartcraft/entity/EntityTime.java @@ -109,9 +109,7 @@ public class EntityTime extends Entity { ); this.worldObj.removeEntity(j); this.worldObj.spawnEntityInWorld(chance); - } - - if (j instanceof EntityItem) { + } else if (j instanceof EntityItem) { EntityItem var19 = (EntityItem) j; if (k.hasKey("timeImmune")) { k.setInteger( @@ -247,7 +245,7 @@ public class EntityTime extends Entity { this.posX, this.posY, this.posZ, - 80d + 80f ) ); } diff --git a/src/main/java/ley/modding/dartcraft/event/EventHandler.java b/src/main/java/ley/modding/dartcraft/event/EventHandler.java index ca8198b..b84ca2e 100644 --- a/src/main/java/ley/modding/dartcraft/event/EventHandler.java +++ b/src/main/java/ley/modding/dartcraft/event/EventHandler.java @@ -12,6 +12,7 @@ import net.minecraft.entity.passive.EntityChicken; import net.minecraft.entity.passive.EntityCow; import net.minecraft.entity.passive.EntityPig; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.event.entity.player.EntityInteractEvent; @@ -116,16 +117,14 @@ public class EventHandler { } ItemStack getDrop() { - // gotta use full names here, because tilera had the brilliant idea to call - // the mod item class "Items" switch (this) { case COW: - return new ItemStack(net.minecraft.init.Items.leather); + return new ItemStack(Items.leather); case PIG: // TODO: add bacon item - return new ItemStack(net.minecraft.init.Items.porkchop); + return new ItemStack(Items.porkchop); case CHICKEN: - return new ItemStack(net.minecraft.init.Items.feather); + return new ItemStack(Items.feather); // why is the compiler so stupid to think that this is required? default: diff --git a/src/main/java/ley/modding/dartcraft/handlers/TimeHandler.java b/src/main/java/ley/modding/dartcraft/handlers/TimeHandler.java new file mode 100644 index 0000000..c47ef2a --- /dev/null +++ b/src/main/java/ley/modding/dartcraft/handlers/TimeHandler.java @@ -0,0 +1,143 @@ +package ley.modding.dartcraft.handlers; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import ley.modding.dartcraft.api.IBaneable; +import ley.modding.dartcraft.util.UpgradeHelper; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.event.entity.EntityEvent.CanUpdate; +import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; + +public class TimeHandler { + @SubscribeEvent + public void canUpdate(CanUpdate e) { + if (e.entity == null || e.entity.worldObj.isRemote) + return; + + try { + NBTTagCompound ex = UpgradeHelper.getDartData(e.entity); + if (ex.getInteger("timeImmune") > 0) { + return; + } + + if (ex.hasKey("time")) { + int type = ex.getInteger("time"); + int time = ex.getInteger("timeTime"); + switch (type) { + case 0: + default: + break; + case 1: + e.canUpdate = false; + break; + case 2: + if (time % 8 != 0) { + e.canUpdate = false; + } + break; + case 3: + e.canUpdate = true; + break; + case 4: + e.canUpdate = true; + } + } + + if (ex.hasKey("frozen")) { + e.canUpdate = false; + } + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + @SubscribeEvent + public void updateEntity(LivingUpdateEvent e) { + if (e.entity == null || e.entity.worldObj.isRemote) + return; + try { + + NBTTagCompound ex = UpgradeHelper.getDartData(e.entity); + if (ex.getInteger("timeImmune") > 0) { + return; + } + + if (ex.hasKey("time") && !ex.getBoolean("updateCalling")) { + int type = ex.getInteger("time"); + int time = ex.getInteger("timeTime"); + --time; + int i; + switch (type) { + case 0: + case 2: + default: + if (time % 8 != 0) { + e.entity.motionX = 0.0D; + e.entity.motionY = 0.0D; + e.entity.motionZ = 0.0D; + e.entity.posX = e.entity.prevPosX; + e.entity.posY = e.entity.prevPosY; + e.entity.posZ = e.entity.prevPosZ; + e.entity.rotationPitch = e.entity.prevRotationPitch; + e.entity.rotationYaw = e.entity.prevRotationYaw; + e.setCanceled(true); + --e.entity.hurtResistantTime; + } + break; + case 1: + e.entity.motionX = 0.0D; + e.entity.motionY = 0.0D; + e.entity.motionZ = 0.0D; + e.entity.posX = e.entity.prevPosX; + e.entity.posY = e.entity.prevPosY; + e.entity.posZ = e.entity.prevPosZ; + e.entity.rotationPitch = e.entity.prevRotationPitch; + e.entity.rotationYaw = e.entity.prevRotationYaw; + e.setCanceled(true); + --e.entity.hurtResistantTime; + if (e.entity instanceof EntityCreeper) { + EntityCreeper creep = (EntityCreeper) e.entity; + creep.fuseTime = 10; + creep.explosionRadius = 0; + } + + if (e.entity instanceof IBaneable) { + ((IBaneable) e.entity).setBaned(); + } + break; + case 3: + ex.setBoolean("updateCalling", true); + + for (i = 0; i < 3; ++i) { + e.entity.onUpdate(); + } + + ex.removeTag("updateCalling"); + break; + case 4: + ex.setBoolean("updateCalling", true); + + for (i = 0; i < 11; ++i) { + e.entity.onUpdate(); + } + + ex.removeTag("updateCalling"); + } + + // TODO: WTF + //if (e.entity instanceof EntityBeeSwarm && (type == 3 || type == 4)) { + // ((EntityBeeSwarm) e.entity).lifeTime += type == 3 ? 3 : 11; + //} + + if (time > 0) { + ex.setInteger("timeTime", time); + } else { + ex.removeTag("timeTime"); + ex.removeTag("time"); + } + } + } catch (Exception ex) { + ex.printStackTrace(); + } + } +} diff --git a/src/main/java/ley/modding/dartcraft/integration/ThaumCraftIntegration.java b/src/main/java/ley/modding/dartcraft/integration/ThaumCraftIntegration.java new file mode 100644 index 0000000..103ed85 --- /dev/null +++ b/src/main/java/ley/modding/dartcraft/integration/ThaumCraftIntegration.java @@ -0,0 +1,31 @@ +package ley.modding.dartcraft.integration; + +import ley.modding.dartcraft.proxy.CommonProxy; +import net.minecraft.tileentity.TileEntity; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.common.tiles.TileDeconstructionTable; + +public class ThaumCraftIntegration { + public static final Aspect[] PRIMAL_ASPECTS + = { Aspect.AIR, Aspect.EARTH, Aspect.FIRE, + Aspect.WATER, Aspect.ORDER, Aspect.ENTROPY }; + + public static boolean isDeconstructorWithoutAspect(TileEntity tile) { + if (!(tile instanceof TileDeconstructionTable)) + return false; + + return ((TileDeconstructionTable) tile).aspect == null; + } + + /** + * Caller asserts that decon is a TileDeconstructionTable + */ + public static void setDeconAspect(TileEntity tile) { + TileDeconstructionTable table = (TileDeconstructionTable) tile; + + Aspect aspect = PRIMAL_ASPECTS[CommonProxy.rand.nextInt(PRIMAL_ASPECTS.length)]; + table.aspect = aspect; + table.markDirty(); + table.getWorldObj().markBlockForUpdate(table.xCoord, table.yCoord, table.zCoord); + } +} diff --git a/src/main/java/ley/modding/dartcraft/network/PacketFX.java b/src/main/java/ley/modding/dartcraft/network/PacketFX.java index 9dd8b63..99d3760 100644 --- a/src/main/java/ley/modding/dartcraft/network/PacketFX.java +++ b/src/main/java/ley/modding/dartcraft/network/PacketFX.java @@ -8,6 +8,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import io.netty.buffer.ByteBuf; import ley.modding.dartcraft.util.FXUtils; +import net.minecraft.world.World; public class PacketFX implements IMessage { public double x; @@ -58,7 +59,10 @@ public class PacketFX implements IMessage { } public static enum Type { - TIME; + TIME, + CHANGE, + CURE, + HEAT; public static Type fromInt(int i) { if (i >= 0 && i < Type.values().length) @@ -71,18 +75,38 @@ public class PacketFX implements IMessage { @Override @SideOnly(Side.CLIENT) public IMessage onMessage(PacketFX pkt, MessageContext ctx) { + World world = FMLClientHandler.instance().getClientPlayerEntity().worldObj; switch (pkt.type) { case TIME: FXUtils.makeTimeEffects( - FMLClientHandler.instance().getClientPlayerEntity().worldObj, + world, pkt.x, pkt.y, pkt.z, pkt.subType, pkt.amount, pkt.area + ); + break; + + case CHANGE: + FXUtils.makeWWEffects( + world, pkt.x, pkt.y, pkt.z, - 1, + 0xffffff, + pkt.subType, pkt.amount, pkt.area ); break; + + case CURE: + FXUtils.makeCureEffects( + world, pkt.x, pkt.y, pkt.z, pkt.subType, 0x4bb218, pkt.amount + ); + break; + + case HEAT: + FXUtils.makeHeatEffects( + world, pkt.x, pkt.y, pkt.z, pkt.amount, pkt.area + ); + break; } return null; diff --git a/src/main/java/ley/modding/dartcraft/tile/TileEntityForceTorch.java b/src/main/java/ley/modding/dartcraft/tile/TileEntityForceTorch.java index 9ee1fe1..5fd1856 100644 --- a/src/main/java/ley/modding/dartcraft/tile/TileEntityForceTorch.java +++ b/src/main/java/ley/modding/dartcraft/tile/TileEntityForceTorch.java @@ -3,9 +3,12 @@ package ley.modding.dartcraft.tile; import java.util.List; import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import ley.modding.dartcraft.Config; import ley.modding.dartcraft.Dartcraft; import ley.modding.dartcraft.entity.EntityTime; +import ley.modding.dartcraft.integration.ThaumCraftIntegration; +import ley.modding.dartcraft.network.PacketFX; import ley.modding.dartcraft.util.DartUtils; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.boss.EntityWither; @@ -78,14 +81,28 @@ public class TileEntityForceTorch extends TileEntity { if (entity.getHealth() < entityUpgrades) { entity.heal((float) (tile * 2)); k = true; - // TODO - //PacketHelper.sendCureFXToClients( - // entity, 8 * tile - //); + + Dartcraft.channel.sendToAllAround( + new PacketFX( + entity.posX, + entity.posY + (entity.height / 2d), + entity.posZ, + PacketFX.Type.CURE, + 2, + 0, + 8 * tile + ), + new TargetPoint( + this.worldObj.provider.dimensionId, + entity.posX, + entity.posY, + entity.posZ, + 80f + ) + ); } } else { - // TODO - //entity.attackEntityFrom(PunishDamage.instance, 2.0F); + entity.attackEntityFrom(DamageSource.magic, 2f); } if (k) { @@ -120,17 +137,33 @@ public class TileEntityForceTorch extends TileEntity { ); boolean k = false; - for (EntityLivingBase var18 : j) { - if (var18 != null - && (var18 instanceof EntityMob - || var18 instanceof EntitySlime - || var18 instanceof EntityGhast) - && !(var18 instanceof EntityWitch) - && !(var18 instanceof EntityWither)) { - this.worldObj.removeEntity(var18); + for (EntityLivingBase remEnt : j) { + if ((remEnt instanceof EntityMob + || remEnt instanceof EntitySlime + || remEnt instanceof EntityGhast) + && !(remEnt instanceof EntityWitch) + && !(remEnt instanceof EntityWither)) { + this.worldObj.removeEntity(remEnt); k = true; - // TODO - //PacketHelper.sendChangeFXToClients(var18, 16); + + Dartcraft.channel.sendToAllAround( + new PacketFX( + remEnt.posX, + remEnt.posY + (remEnt.height / 2d), + remEnt.posZ, + PacketFX.Type.CHANGE, + 1, + 0, + 16 + ), + new TargetPoint( + this.worldObj.provider.dimensionId, + remEnt.posX, + remEnt.posY + (remEnt.height / 2d), + remEnt.posZ, + 80f + ) + ); } } @@ -181,9 +214,25 @@ public class TileEntityForceTorch extends TileEntity { DamageSource.inFire, 0.5F * (float) tile ); k = true; - // TODO - //PacketHelper.sendHeatFXToClients(entity, 8 * tile, - //0); + + Dartcraft.channel.sendToAllAround( + new PacketFX( + entity.posX, + entity.posY + (entity.height / 2d), + entity.posZ, + PacketFX.Type.HEAT, + 0, + 0, + 8 * tile + ), + new TargetPoint( + this.worldObj.provider.dimensionId, + entity.posX, + entity.posY, + entity.posZ, + 80f + ) + ); } } } @@ -205,23 +254,24 @@ public class TileEntityForceTorch extends TileEntity { if (this.upgrades.hasKey("Repair") && Loader.isModLoaded("Thaumcraft")) { try { + outer: for (time = -Config.torchDist; time < Config.torchDist; ++time) { for (int var15 = -Config.torchDist; var15 < Config.torchDist; ++var15) { for (int var19 = -Config.torchDist; var19 < Config.torchDist; ++var19) { - TileEntity var17 = this.worldObj.getTileEntity( + TileEntity tile = this.worldObj.getTileEntity( this.xCoord + time, this.yCoord + var15, this.zCoord + var19 ); - // TODO: TC - //if (var17 != null - // && ThaumCraftIntegration.isDeconstructor(var17)) - // { ThaumCraftIntegration.setDeconAspect(var17); - // break label110; - //} + + if (ThaumCraftIntegration + .isDeconstructorWithoutAspect(tile)) { + ThaumCraftIntegration.setDeconAspect(tile); + break outer; + } } } } diff --git a/src/main/java/ley/modding/dartcraft/util/FXUtils.java b/src/main/java/ley/modding/dartcraft/util/FXUtils.java index ab80372..4f2e581 100644 --- a/src/main/java/ley/modding/dartcraft/util/FXUtils.java +++ b/src/main/java/ley/modding/dartcraft/util/FXUtils.java @@ -8,8 +8,10 @@ import org.lwjgl.opengl.GL11; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ley.modding.dartcraft.Dartcraft; +import ley.modding.dartcraft.client.fx.FXCure; import ley.modding.dartcraft.client.fx.FXDisney; import ley.modding.dartcraft.client.fx.FXTime; +import ley.modding.dartcraft.client.fx.FXWindWaker; import ley.modding.dartcraft.proxy.CommonProxy; import net.minecraft.client.particle.EffectRenderer; import net.minecraft.client.particle.EntityFireworkStarterFX; @@ -155,23 +157,17 @@ public class FXUtils { if (!Dartcraft.proxy.isSimulating(world)) { for (int i = 0; i < number; ++i) { double var19 = (double) i / ((double) number - 1.0D); - CommonProxy var10000 = Dartcraft.proxy; float var21 = (CommonProxy.rand.nextFloat() - 0.5F) * 0.2F; - var10000 = Dartcraft.proxy; float var22 = (CommonProxy.rand.nextFloat() - 0.5F) * 0.2F; - var10000 = Dartcraft.proxy; float var23 = (CommonProxy.rand.nextFloat() - 0.5F) * 0.2F; double var221 = prevX + (entity.posX - prevX) * var19; - CommonProxy var10001 = Dartcraft.proxy; double var24 = var221 + (CommonProxy.rand.nextDouble() - 0.5D) * (double) entity.width * 2.0D; var221 = prevY + (entity.posY - prevY) * var19; - var10001 = Dartcraft.proxy; double var26 = var221 + CommonProxy.rand.nextDouble() * (double) entity.height; var221 = prevZ + (entity.posZ - prevZ) * var19; - var10001 = Dartcraft.proxy; double var28 = var221 + (CommonProxy.rand.nextDouble() - 0.5D) * (double) entity.width * 2.0D; @@ -246,24 +242,18 @@ public class FXUtils { World world, double x2, double y2, double z2, int type, int particles ) { float modifier = 0.5F; - float velModifier = 1.0F; EffectRenderer renderer = Dartcraft.proxy.getClientInstance().effectRenderer; for (int i = 0; i < particles; ++i) { - CommonProxy var10001 = Dartcraft.proxy; float x = (float) (x2 + (double) (CommonProxy.rand.nextFloat() * modifier) - (double) (modifier / 2.0F)); - var10001 = Dartcraft.proxy; float y = (float) (y2 + (double) (CommonProxy.rand.nextFloat() * modifier) - (double) (modifier / 2.0F)); - var10001 = Dartcraft.proxy; float z = (float) (z2 + (double) (CommonProxy.rand.nextFloat() * modifier) - (double) (modifier / 2.0F)); - // TODO - //renderer.addEffect( - // new FXWindWaker(world, (double) x, (double) y, (double) z, 16777215, - // type) - //); + renderer.addEffect( + new FXWindWaker(world, (double) x, (double) y, (double) z, 0xffffff, type) + ); } } @@ -274,17 +264,12 @@ public class FXUtils { float modifier = 1.0F; for (int i = 0; i < particles; ++i) { - CommonProxy var10001 = Dartcraft.proxy; float x2 = (float) (x + (double) (CommonProxy.rand.nextFloat() * modifier)); - var10001 = Dartcraft.proxy; float y2 = (float) (y + (double) (CommonProxy.rand.nextFloat() * modifier)); - var10001 = Dartcraft.proxy; float z2 = (float) (z + (double) (CommonProxy.rand.nextFloat() * modifier)); - // TODO - //renderer.addEffect( - // new FXWindWaker(world, (double) x2, (double) y2, (double) z2, '\ue4ff', - // 0) - //); + renderer.addEffect( + new FXWindWaker(world, (double) x2, (double) y2, (double) z2, '\ue4ff', 0) + ); } } @@ -295,17 +280,12 @@ public class FXUtils { float modifier = 1.0F; for (int i = 0; i < particles; ++i) { - CommonProxy var10001 = Dartcraft.proxy; float x2 = (float) (x + (double) (CommonProxy.rand.nextFloat() * modifier)); - var10001 = Dartcraft.proxy; float y2 = (float) (y + (double) (CommonProxy.rand.nextFloat() * modifier)); - var10001 = Dartcraft.proxy; float z2 = (float) (z + (double) (CommonProxy.rand.nextFloat() * modifier)); - // TODO - //renderer.addEffect( - // new FXWindWaker(world, (double) x2, (double) y2, (double) z2, '\ue4ff', - // 3) - //); + renderer.addEffect( + new FXWindWaker(world, (double) x2, (double) y2, (double) z2, '\ue4ff', 3) + ); } } @@ -407,16 +387,15 @@ public class FXUtils { EffectRenderer renderer = Dartcraft.proxy.getClientInstance().effectRenderer; for (int i = 0; i < num; ++i) { - // TODO - //FXCure fx = new FXCure( - // world, - // x + world.rand.nextDouble() - world.rand.nextDouble(), - // y + world.rand.nextDouble() - world.rand.nextDouble(), - // z + world.rand.nextDouble() - world.rand.nextDouble(), - // color, - // type - //); - //renderer.addEffect(fx); + FXCure fx = new FXCure( + world, + x + world.rand.nextDouble() - world.rand.nextDouble(), + y + world.rand.nextDouble() - world.rand.nextDouble(), + z + world.rand.nextDouble() - world.rand.nextDouble(), + color, + type + ); + renderer.addEffect(fx); } } @@ -544,35 +523,33 @@ public class FXUtils { for (int fx = -area; fx < area + 1; ++fx) { for (int k = -area; k < area + 1; ++k) { for (int l = 0; l < num; ++l) { - // TODO - //FXWindWaker fx1 = new FXWindWaker( - // world, - // x + (double) i + world.rand.nextDouble() - // - world.rand.nextDouble(), - // y + (double) fx + world.rand.nextDouble() - // - world.rand.nextDouble(), - // z + (double) k + world.rand.nextDouble() - // - world.rand.nextDouble(), - // color, - // type - //); - //renderer.addEffect(fx1); + FXWindWaker fx1 = new FXWindWaker( + world, + x + (double) i + world.rand.nextDouble() + - world.rand.nextDouble(), + y + (double) fx + world.rand.nextDouble() + - world.rand.nextDouble(), + z + (double) k + world.rand.nextDouble() + - world.rand.nextDouble(), + color, + type + ); + renderer.addEffect(fx1); } } } } } else { for (i = 0; i < num; ++i) { - // TODO - //FXWindWaker var17 = new FXWindWaker( - // world, - // x + world.rand.nextDouble() - world.rand.nextDouble(), - // y + world.rand.nextDouble() - world.rand.nextDouble(), - // z + world.rand.nextDouble() - world.rand.nextDouble(), - // color, - // type - //); - //renderer.addEffect(var17); + FXWindWaker var17 = new FXWindWaker( + world, + x + world.rand.nextDouble() - world.rand.nextDouble(), + y + world.rand.nextDouble() - world.rand.nextDouble(), + z + world.rand.nextDouble() - world.rand.nextDouble(), + color, + type + ); + renderer.addEffect(var17); } } } diff --git a/src/main/resources/META-INF/dartcraft_at.cfg b/src/main/resources/META-INF/dartcraft_at.cfg new file mode 100644 index 0000000..d018fc9 --- /dev/null +++ b/src/main/resources/META-INF/dartcraft_at.cfg @@ -0,0 +1,2 @@ +public net.minecraft.entity.monster.EntityCreeper field_82225_f # fuseTime +public net.minecraft.entity.monster.EntityCreeper field_82226_g # explosionRadius diff --git a/src/main/resources/assets/dartcraft/sounds.json b/src/main/resources/assets/dartcraft/sounds.json index aea587e..6c45a19 100644 --- a/src/main/resources/assets/dartcraft/sounds.json +++ b/src/main/resources/assets/dartcraft/sounds.json @@ -1,6 +1,64 @@ { - "bottle": {"category": "master","sounds": [{"name": "bottle","stream": false}]}, - "swipe": {"category": "master","sounds": [{"name": "swipe","stream": false}]}, - "fly": {"category": "master","sounds": [{"name": "fly1","stream": false}, {"name": "fly2","stream": false}, {"name": "fly3","stream": false}]}, - "nope": {"category": "master","sounds": [{"name": "nope","stream": false}]} + "bottle": { + "category": "master", + "sounds": [ + { + "name": "bottle", + "stream": false + } + ] + }, + "cure": { + "category": "master", + "sounds": [ + { + "name": "cure", + "stream": false + } + ] + }, + "fly": { + "category": "master", + "sounds": [ + { + "name": "fly1", + "stream": false + }, + { + "name": "fly2", + "stream": false + }, + { + "name": "fly3", + "stream": false + } + ] + }, + "ignite": { + "category": "master", + "sounds": [ + { + "name": "ignite", + "stream": false + } + ] + }, + "nope": { + "category": "master", + "sounds": [ + { + "name": "nope", + "stream": false + } + ] + }, + "swipe": { + "category": "master", + "sounds": [ + { + "name": "swipe", + "stream": false + } + ] + } } diff --git a/src/main/resources/assets/dartcraft/sounds/cure.ogg b/src/main/resources/assets/dartcraft/sounds/cure.ogg new file mode 100644 index 0000000..b2a2610 Binary files /dev/null and b/src/main/resources/assets/dartcraft/sounds/cure.ogg differ diff --git a/src/main/resources/assets/dartcraft/sounds/ignite.ogg b/src/main/resources/assets/dartcraft/sounds/ignite.ogg new file mode 100644 index 0000000..9063eeb Binary files /dev/null and b/src/main/resources/assets/dartcraft/sounds/ignite.ogg differ