Skip to content

Commit

Permalink
initial work for 1.10.2 port
Browse files Browse the repository at this point in the history
  • Loading branch information
2piradians committed May 3, 2017
1 parent 76357cd commit e726201
Show file tree
Hide file tree
Showing 14 changed files with 127 additions and 170 deletions.
42 changes: 0 additions & 42 deletions LICENSE

This file was deleted.

155 changes: 78 additions & 77 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,77 +1,78 @@
buildscript {
repositories {
jcenter()
maven { url = "http://files.minecraftforge.net/maven" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.


version = "1.11.2-1.0"
group = "twopiradians.minewatch" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "Minewatch"

sourceCompatibility = targetCompatibility = "1.8" // Need this here so eclipse task generates correctly.
compileJava {
sourceCompatibility = targetCompatibility = "1.8"
}

minecraft {
version = "1.11.2-13.20.0.2282"
runDir = "run"

// the mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD snapshot are built nightly.
// stable_# stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// simply re-run your setup task after changing the mappings to update your workspace.
mappings = "snapshot_20161220"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
}

dependencies {
// you may put jars on which you depend on in ./libs
// or you may define them like so..
//compile "some.group:artifact:version:classifier"
//compile "some.group:artifact:version"

// real examples
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env

// the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
//provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'

// the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,
// except that these dependencies get remapped to your current MCP mappings
//deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
//deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev'

// for more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html

}

processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version

// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'

// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}

// copy everything else except the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
buildscript {
repositories {
jcenter()
maven { url = "http://files.minecraftforge.net/maven" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the nessasary things for Forge to be setup.


version = "1.10.2-1.0"
group = "twopiradians.minewatch" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "Minewatch"

sourceCompatibility = targetCompatibility = "1.8" // Need this here so eclipse task generates correctly.
compileJava {
sourceCompatibility = targetCompatibility = "1.8"
}

minecraft {
version = "1.10.2-12.18.3.2185"
runDir = "run"

// the mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD snapshot are built nightly.
// stable_# stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// simply re-run your setup task after changing the mappings to update your workspace.
mappings = "snapshot_20161111"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
}

dependencies {
// you may put jars on which you depend on in ./libs
// or you may define them like so..
//compile "some.group:artifact:version:classifier"
//compile "some.group:artifact:version"

// real examples
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env

// the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
//provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'

// the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,
// except that these dependencies get remapped to your current MCP mappings
//deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
//deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev'

// for more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html

}

processResources
{
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version

// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'

// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}

// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public boolean isKeyDown(EntityPlayer player) {
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void playerTick(ClientTickEvent event) {
if (event.phase == Phase.END && Minecraft.getMinecraft().player != null) {
UUID player = Minecraft.getMinecraft().player.getPersistentID();
if (event.phase == Phase.END && Minecraft.getMinecraft().thePlayer != null) {
UUID player = Minecraft.getMinecraft().thePlayer.getPersistentID();
if (!isKeyDown.containsKey(player) || TOGGLE_MODE.isKeyDown() != isKeyDown.get(player)) {
isKeyDown.put(player, TOGGLE_MODE.isKeyDown());
Minewatch.network.sendToServer(new PacketToggleMode(TOGGLE_MODE.isKeyDown(), player));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void setAim(Entity shooter, float pitch, float yaw, float velocity, float

@Override
public void onUpdate() {
float f = MathHelper.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
float f = MathHelper.sqrt_float((float) (this.motionX * this.motionX + this.motionZ * this.motionZ));
this.rotationYaw = (float)(MathHelper.atan2(this.motionX, this.motionZ) * (180D / Math.PI));
this.rotationPitch = (float)(MathHelper.atan2(this.motionY, (double)f) * (180D / Math.PI));
this.prevRotationYaw = this.rotationYaw;
Expand All @@ -69,12 +69,12 @@ protected void onImpact(RayTraceResult result) {
if (result.entityHit instanceof EntityLivingBase && result.entityHit != this.getThrower()) {
if (this.heal) {
((EntityLivingBase)result.entityHit).heal(75/ModWeapon.DAMAGE_SCALE);
((WorldServer)result.entityHit.world).spawnParticle(EnumParticleTypes.HEART,
((WorldServer)result.entityHit.worldObj).spawnParticle(EnumParticleTypes.HEART,
result.entityHit.posX+0.5d, result.entityHit.posY+0.5d,result.entityHit.posZ+0.5d,
10, 0.4d, 0.4d, 0.4d, 0d, new int[0]);
if (this.getThrower() != null)
result.entityHit.world.playSound(null, this.getThrower().posX, this.getThrower().posY, this.getThrower().posZ,
SoundEvents.BLOCK_NOTE_PLING, SoundCategory.PLAYERS, 0.3f, result.entityHit.world.rand.nextFloat()/2+1.5f);
result.entityHit.worldObj.playSound(null, this.getThrower().posX, this.getThrower().posY, this.getThrower().posZ,
SoundEvents.BLOCK_NOTE_PLING, SoundCategory.PLAYERS, 0.3f, result.entityHit.worldObj.rand.nextFloat()/2+1.5f);
}
else {
if (this.getThrower() instanceof EntityPlayer)
Expand All @@ -83,8 +83,8 @@ protected void onImpact(RayTraceResult result) {
if (this.getThrower() instanceof EntityPlayer)
((EntityLivingBase)result.entityHit).attackEntityFrom(DamageSource.causeThrownDamage(this, getThrower()), 60F/ModWeapon.DAMAGE_SCALE);
if (this.getThrower() != null)
result.entityHit.world.playSound(null, this.getThrower().posX, this.getThrower().posY, this.getThrower().posZ,
SoundEvents.ENTITY_ARROW_HIT_PLAYER, SoundCategory.PLAYERS, 0.3f, result.entityHit.world.rand.nextFloat()/2+0.75f);
result.entityHit.worldObj.playSound(null, this.getThrower().posX, this.getThrower().posY, this.getThrower().posZ,
SoundEvents.ENTITY_ARROW_HIT_PLAYER, SoundCategory.PLAYERS, 0.3f, result.entityHit.worldObj.rand.nextFloat()/2+0.75f);
}
this.setDead();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public EntityReaperBullet(World worldIn, EntityLivingBase throwerIn) {

@Override
public void onUpdate() {
float f = MathHelper.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
float f = MathHelper.sqrt_float((float) (this.motionX * this.motionX + this.motionZ * this.motionZ));
this.rotationYaw = (float)(MathHelper.atan2(this.motionX, this.motionZ) * (180D / Math.PI));
this.rotationPitch = (float)(MathHelper.atan2(this.motionY, (double)f) * (180D / Math.PI));
this.prevRotationYaw = this.rotationYaw;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package twopiradians.minewatch.common.entity;

import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import twopiradians.minewatch.common.Minewatch;

public class ModEntities
{
public static void registerEntities() {
int id = 0;
EntityRegistry.registerModEntity(new ResourceLocation(Minewatch.MODID, "reaper_pellet"), EntityReaperBullet.class, "reaper_pellet", id++, Minewatch.instance, 16, 1, true);
EntityRegistry.registerModEntity(new ResourceLocation("arrow"), EntityHanzoArrow.class, "hanzo_arrow", id++, Minewatch.instance, 16, 1, true);
EntityRegistry.registerModEntity(new ResourceLocation(Minewatch.MODID, "ana_bullet"), EntityAnaBullet.class, "ana_bullet", id++, Minewatch.instance, 32, 1, true);
EntityRegistry.registerModEntity(EntityReaperBullet.class, "reaper_pellet", id++, Minewatch.instance, 16, 1, true);
EntityRegistry.registerModEntity(EntityHanzoArrow.class, "hanzo_arrow", id++, Minewatch.instance, 16, 1, true);
EntityRegistry.registerModEntity(EntityAnaBullet.class, "ana_bullet", id++, Minewatch.instance, 32, 1, true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ public class ModTokens extends Item
{
@SubscribeEvent
public void onEvent(LivingDropsEvent event) {
if (!event.getEntityLiving().world.isRemote && event.getEntityLiving() instanceof EntityLiving
if (!event.getEntityLiving().worldObj.isRemote && event.getEntityLiving() instanceof EntityLiving
&& event.getEntityLiving().getEntityWorld().rand.nextDouble() < 0.01d * (1+event.getLootingLevel())) {
int i = event.getEntityLiving().world.rand.nextInt(4);
int i = event.getEntityLiving().worldObj.rand.nextInt(4);
ItemStack stack = new ItemStack(ModItems.tokens.get(i));
EntityItem drop = new EntityItem(event.getEntityLiving().world, event.getEntityLiving().posX,
EntityItem drop = new EntityItem(event.getEntityLiving().worldObj, event.getEntityLiving().posX,
event.getEntityLiving().posY, event.getEntityLiving().posZ, stack);
event.getDrops().add(drop);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void onShoot(World worldIn, EntityPlayer playerIn, EnumHand hand) {
if (!worldIn.isRemote) {
EntityAnaBullet bullet = new EntityAnaBullet(worldIn, playerIn, Minewatch.keyMode.isKeyDown(playerIn));
bullet.setAim(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 5.0F, 1.0F);
worldIn.spawnEntity(bullet);
worldIn.spawnEntityInWorld(bullet);
worldIn.playSound(null, playerIn.posX, playerIn.posY, playerIn.posZ,
ModSoundEvents.reaperShotgun, SoundCategory.PLAYERS, 1.0f, worldIn.rand.nextFloat()/2+0.75f);
}
Expand Down
Loading

0 comments on commit e726201

Please sign in to comment.