Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
ea04ab5225 | |||
48b33e6766 | |||
321b351354 | |||
338d195240 |
@ -1 +0,0 @@
|
||||
theme: jekyll-theme-slate
|
41
build.gradle
41
build.gradle
@ -1,17 +1,15 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
name = "forge"
|
||||
url = "http://files.minecraftforge.net/maven"
|
||||
}
|
||||
maven {
|
||||
name = "sonatype"
|
||||
url = "https://oss.sonatype.org/content/repositories/snapshots/"
|
||||
url = 'https://maven.minecraftforge.net/'
|
||||
}
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
|
||||
classpath ('com.anatawa12.forge:ForgeGradle:1.2-1.1.+') {
|
||||
changing = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,14 +19,11 @@ version = "0.1.8"
|
||||
group= "fr.jackcartersmith.orbsat" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = "OrbitalSatellite"
|
||||
|
||||
apply plugin: 'java'
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
targetCompatibility = sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
minecraft {
|
||||
version = "1.7.10-10.13.4.1558-1.7.10"
|
||||
replace '${version}', project.version
|
||||
runDir = "eclipse"
|
||||
version = "1.7.10-10.13.4.1614-1.7.10"
|
||||
runDir = "rundir"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@ -56,9 +51,7 @@ processResources
|
||||
inputs.property "mcversion", project.minecraft.version
|
||||
|
||||
// replace stuff in mcmod.info, nothing else
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include 'mcmod.info'
|
||||
|
||||
filesMatching('mcmod.info') {
|
||||
// replace version and mcversion
|
||||
expand 'version':project.version, 'mcversion':project.minecraft.version
|
||||
}
|
||||
@ -69,6 +62,20 @@ processResources
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||
classifier = "sources"
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
|
||||
task devJar(type: Jar) {
|
||||
classifier = "dev"
|
||||
from sourceSets.main.output
|
||||
}
|
||||
|
||||
task deobfJar(type: Jar) {
|
||||
from sourceSets.main.output
|
||||
classifier = 'deobf'
|
||||
@ -78,5 +85,7 @@ task deobfJar(type: Jar) {
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
archives devJar
|
||||
archives deobfJar
|
||||
}
|
Binary file not shown.
@ -1,4 +0,0 @@
|
||||
#Sun Jun 05 18:58:07 CEST 2011
|
||||
version=1
|
||||
eclipse.preferences.version=1
|
||||
refresh.enabled=true
|
@ -1,7 +0,0 @@
|
||||
#Sun Jun 05 19:03:53 CEST 2011
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.debug.ui.UseContextualLaunch=false
|
||||
Console.highWaterMark=88000
|
||||
org.eclipse.debug.ui.PREF_LAUNCH_PERSPECTIVES=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\r\n<launchPerspectives/>\r\n
|
||||
org.eclipse.debug.ui.user_view_bindings=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\r\n<viewBindings>\r\n<view id\="org.eclipse.ui.console.ConsoleView">\r\n<perspective id\="org.eclipse.jdt.ui.JavaPerspective" userAction\="opened"/>\r\n</view>\r\n</viewBindings>\r\n
|
||||
StringVariablePreferencePage=130,107,107,86,
|
@ -1,3 +0,0 @@
|
||||
#Sun Jun 05 18:58:07 CEST 2011
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.epp.usagedata.gathering.enabled=false
|
@ -1,14 +0,0 @@
|
||||
#Sun Sep 18 16:44:39 NZST 2011
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.deprecation=ignore
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedImport=ignore
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
@ -1,4 +0,0 @@
|
||||
#Sun Jun 05 18:58:05 CEST 2011
|
||||
spacesForTabs=true
|
||||
eclipse.preferences.version=1
|
||||
overviewRuler_migration=migrated_3.1
|
@ -1,9 +0,0 @@
|
||||
#Sun Jun 05 18:58:07 CEST 2011
|
||||
IMPORT_FILES_AND_FOLDERS_MODE=prompt
|
||||
IMPORT_FILES_AND_FOLDERS_VIRTUAL_FOLDER_MODE=prompt
|
||||
SAVE_ALL_BEFORE_BUILD=true
|
||||
eclipse.preferences.version=1
|
||||
tipsAndTricks=true
|
||||
platformState=1287081747687
|
||||
quickStart=false
|
||||
PROBLEMS_FILTERS_MIGRATE=true
|
@ -1,3 +0,0 @@
|
||||
#Sun Jun 05 18:50:08 CEST 2011
|
||||
eclipse.preferences.version=1
|
||||
showIntro=false
|
@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/Minecraft/lib/net/minecraft/launchwrapper/1.8/launchwrapper-1.8.jar"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="GradleStart"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Minecraft"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xincgc -Xmx1024M -Xms1024M"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc}"/>
|
||||
</launchConfiguration>
|
@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/Minecraft/src/net/minecraft/server/MinecraftServer.java"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="GradleStartServer"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Minecraft"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xincgc -Xmx1024M -Xms1024M"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc}"/>
|
||||
</launchConfiguration>
|
@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchHistory>
|
||||
<launchGroup id="org.eclipse.ui.externaltools.launchGroup">
|
||||
<mruHistory/>
|
||||
<favorites/>
|
||||
</launchGroup>
|
||||
<launchGroup id="org.eclipse.debug.ui.launchGroup.profile">
|
||||
<mruHistory/>
|
||||
<favorites/>
|
||||
</launchGroup>
|
||||
<launchGroup id="org.eclipse.debug.ui.launchGroup.debug">
|
||||
<mruHistory>
|
||||
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="true" path="Client"/> "/>
|
||||
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="true" path="Server"/> "/>
|
||||
</mruHistory>
|
||||
<favorites/>
|
||||
</launchGroup>
|
||||
<launchGroup id="org.eclipse.debug.ui.launchGroup.run">
|
||||
<mruHistory>
|
||||
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="true" path="Client"/> "/>
|
||||
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="true" path="Server"/> "/>
|
||||
</mruHistory>
|
||||
<favorites/>
|
||||
</launchGroup>
|
||||
</launchHistory>
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
||||
#Wed Jul 02 15:54:47 CDT 2014
|
||||
#Tue May 12 10:11:53 CEST 2020
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip
|
||||
|
@ -16,7 +16,7 @@ import fr.jackcartersmith.orbsat.common.utils.OSLogHelper;
|
||||
public class OrbitalSatellite
|
||||
{
|
||||
//============== DEBUG MODE ===============//
|
||||
public static boolean debug = false;
|
||||
public static boolean debug = true;
|
||||
//=========================================//
|
||||
|
||||
@Mod.Instance(OSRefs.MODID)
|
||||
|
@ -6,6 +6,215 @@ import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
|
||||
/**
|
||||
* ModelDefender - JackCarterSmith
|
||||
* Created using Tabula 4.1.1
|
||||
*/
|
||||
public class ModelDefender extends ModelBase {
|
||||
public ModelRenderer crystalPlateforme;
|
||||
public ModelRenderer crystal;
|
||||
public ModelRenderer photonInjector;
|
||||
public ModelRenderer basePlateforme;
|
||||
public ModelRenderer crystalPlateforme2;
|
||||
public ModelRenderer photonInjector_1;
|
||||
public ModelRenderer baseSide1;
|
||||
public ModelRenderer baseSide2;
|
||||
public ModelRenderer baseSide3;
|
||||
public ModelRenderer baseSide4;
|
||||
public ModelRenderer crystalArmSupport1;
|
||||
public ModelRenderer crystalArmSupport2;
|
||||
public ModelRenderer crystalArmSupport3;
|
||||
public ModelRenderer crystalArmSupport4;
|
||||
public ModelRenderer shape13;
|
||||
public ModelRenderer shape14;
|
||||
public ModelRenderer shape15;
|
||||
public ModelRenderer shape16;
|
||||
public ModelRenderer shape17;
|
||||
public ModelRenderer shape18;
|
||||
public ModelRenderer support1;
|
||||
public ModelRenderer support2;
|
||||
public ModelRenderer support3;
|
||||
public ModelRenderer support4;
|
||||
public ModelRenderer support5;
|
||||
public ModelRenderer support6;
|
||||
public ModelRenderer support7;
|
||||
public ModelRenderer support8;
|
||||
|
||||
public ModelDefender() {
|
||||
this.textureWidth = 128;
|
||||
this.textureHeight = 128;
|
||||
this.shape15 = new ModelRenderer(this, 0, 64);
|
||||
this.shape15.setRotationPoint(2.0F, 17.0F, 0.0F);
|
||||
this.shape15.addBox(0.0F, 0.0F, 0.0F, 2, 1, 1, 0.0F);
|
||||
this.basePlateforme = new ModelRenderer(this, 0, 0);
|
||||
this.basePlateforme.setRotationPoint(-8.0F, 23.0F, -8.0F);
|
||||
this.basePlateforme.addBox(0.0F, 0.0F, 0.0F, 16, 1, 16, 0.0F);
|
||||
this.photonInjector_1 = new ModelRenderer(this, 0, 17);
|
||||
this.photonInjector_1.setRotationPoint(-2.0F, 11.0F, -2.0F);
|
||||
this.photonInjector_1.addBox(0.0F, 0.0F, 0.0F, 4, 12, 4, 0.0F);
|
||||
this.baseSide1 = new ModelRenderer(this, 16, 17);
|
||||
this.baseSide1.mirror = true;
|
||||
this.baseSide1.setRotationPoint(-8.0F, 19.0F, -8.0F);
|
||||
this.baseSide1.addBox(0.0F, 0.0F, 0.0F, 16, 4, 1, 0.0F);
|
||||
this.crystalArmSupport1 = new ModelRenderer(this, 0, 33);
|
||||
this.crystalArmSupport1.setRotationPoint(-6.0F, -1.000000000000001F, -6.0F);
|
||||
this.crystalArmSupport1.addBox(0.0F, 0.0F, 0.0F, 2, 24, 2, 0.0F);
|
||||
this.shape16 = new ModelRenderer(this, 6, 64);
|
||||
this.shape16.setRotationPoint(0.0F, 21.0F, -5.0F);
|
||||
this.shape16.addBox(0.0F, 0.0F, 0.0F, 1, 2, 1, 0.0F);
|
||||
this.baseSide4 = new ModelRenderer(this, 16, 17);
|
||||
this.baseSide4.mirror = true;
|
||||
this.baseSide4.setRotationPoint(8.0F, 19.0F, -8.0F);
|
||||
this.baseSide4.addBox(0.0F, 0.0F, 0.0F, 16, 4, 1, 0.0F);
|
||||
this.setRotateAngle(baseSide4, 0.0F, -1.5707963267948966F, 0.0F);
|
||||
this.shape14 = new ModelRenderer(this, 0, 68);
|
||||
this.shape14.setRotationPoint(3.0F, 18.0F, 0.0F);
|
||||
this.shape14.addBox(0.0F, 0.0F, 0.0F, 1, 5, 1, 0.0F);
|
||||
this.shape17 = new ModelRenderer(this, 10, 64);
|
||||
this.shape17.mirror = true;
|
||||
this.shape17.setRotationPoint(-1.0F, 14.0F, 2.0F);
|
||||
this.shape17.addBox(0.0F, 0.0F, 0.0F, 1, 9, 1, 0.0F);
|
||||
this.support8 = new ModelRenderer(this, 52, 4);
|
||||
this.support8.mirror = true;
|
||||
this.support8.setRotationPoint(5.0F, 8.0F, 5.0F);
|
||||
this.support8.addBox(0.0F, 0.0F, -0.5F, 5, 1, 1, -0.2F);
|
||||
this.setRotateAngle(support8, 0.0F, 2.356194490192345F, 0.0F);
|
||||
this.crystalArmSupport4 = new ModelRenderer(this, 0, 33);
|
||||
this.crystalArmSupport4.setRotationPoint(4.0F, -1.000000000000001F, -6.0F);
|
||||
this.crystalArmSupport4.addBox(0.0F, 0.0F, 0.0F, 2, 24, 2, 0.0F);
|
||||
this.support5 = new ModelRenderer(this, 52, 4);
|
||||
this.support5.mirror = true;
|
||||
this.support5.setRotationPoint(-5.0F, 8.0F, 5.0F);
|
||||
this.support5.addBox(0.0F, 0.0F, -0.5F, 5, 1, 1, -0.2F);
|
||||
this.setRotateAngle(support5, 0.0F, 0.7853981633974483F, 0.0F);
|
||||
this.crystalPlateforme = new ModelRenderer(this, 0, 0);
|
||||
this.crystalPlateforme.setRotationPoint(-1.5F, 10.0F, -1.5F);
|
||||
this.crystalPlateforme.addBox(0.0F, 0.0F, 0.0F, 3, 1, 3, 0.0F);
|
||||
this.support6 = new ModelRenderer(this, 52, 4);
|
||||
this.support6.mirror = true;
|
||||
this.support6.setRotationPoint(-5.0F, 8.0F, -5.0F);
|
||||
this.support6.addBox(0.0F, 0.0F, -0.5F, 5, 1, 1, -0.2F);
|
||||
this.setRotateAngle(support6, 0.0F, -0.7853981633974483F, 0.0F);
|
||||
this.photonInjector = new ModelRenderer(this, 8, 33);
|
||||
this.photonInjector.setRotationPoint(0.0F, -6.0F, -3.5F);
|
||||
this.photonInjector.addBox(0.0F, 0.0F, 0.0F, 5, 12, 5, 0.0F);
|
||||
this.setRotateAngle(photonInjector, 0.0F, -0.7853981633974483F, 0.0F);
|
||||
this.crystalArmSupport2 = new ModelRenderer(this, 0, 33);
|
||||
this.crystalArmSupport2.setRotationPoint(-6.0F, -1.000000000000001F, 4.0F);
|
||||
this.crystalArmSupport2.addBox(0.0F, 0.0F, 0.0F, 2, 24, 2, 0.0F);
|
||||
this.shape13 = new ModelRenderer(this, 0, 64);
|
||||
this.shape13.setRotationPoint(0.0F, 20.0F, -5.0F);
|
||||
this.shape13.addBox(0.0F, 0.0F, 0.0F, 1, 1, 3, 0.0F);
|
||||
this.shape18 = new ModelRenderer(this, 10, 64);
|
||||
this.shape18.mirror = true;
|
||||
this.shape18.setRotationPoint(-3.0F, 16.0F, 0.0F);
|
||||
this.shape18.addBox(0.0F, 0.0F, 0.0F, 1, 7, 1, 0.0F);
|
||||
this.baseSide2 = new ModelRenderer(this, 16, 17);
|
||||
this.baseSide2.mirror = true;
|
||||
this.baseSide2.setRotationPoint(-8.0F, 19.0F, 8.0F);
|
||||
this.baseSide2.addBox(0.0F, 0.0F, 0.0F, 16, 4, 1, 0.0F);
|
||||
this.setRotateAngle(baseSide2, 0.0F, 1.5707963267948966F, 0.0F);
|
||||
this.crystal = new ModelRenderer(this, 0, 4);
|
||||
this.crystal.setRotationPoint(0.0F, 8.5F, 0.0F);
|
||||
this.crystal.addBox(-1.0F, -1.0F, -1.0F, 2, 2, 2, 0.0F);
|
||||
//this.Shape7.addBox(-3.0F, -3.0F, -3.0F, 6, 6, 6);
|
||||
//this.Shape7.setRotationPoint(0.0F, -4.0F, 0.0F);
|
||||
this.support1 = new ModelRenderer(this, 52, 0);
|
||||
this.support1.mirror = true;
|
||||
this.support1.setRotationPoint(-5.0F, 1.0F, 5.0F);
|
||||
this.support1.addBox(0.0F, 0.0F, -0.5F, 5, 3, 1, 0.0F);
|
||||
this.setRotateAngle(support1, 0.0F, 0.7853981633974483F, 0.0F);
|
||||
this.crystalArmSupport3 = new ModelRenderer(this, 0, 33);
|
||||
this.crystalArmSupport3.setRotationPoint(4.0F, -1.000000000000001F, 4.0F);
|
||||
this.crystalArmSupport3.addBox(0.0F, 0.0F, 0.0F, 2, 24, 2, 0.0F);
|
||||
this.support4 = new ModelRenderer(this, 52, 0);
|
||||
this.support4.mirror = true;
|
||||
this.support4.setRotationPoint(5.0F, 1.0F, 5.0F);
|
||||
this.support4.addBox(0.0F, 0.0F, -0.5F, 5, 3, 1, 0.0F);
|
||||
this.setRotateAngle(support4, 0.0F, 2.356194490192345F, 0.0F);
|
||||
this.support2 = new ModelRenderer(this, 52, 0);
|
||||
this.support2.mirror = true;
|
||||
this.support2.setRotationPoint(-5.0F, 1.0F, -5.0F);
|
||||
this.support2.addBox(0.0F, 0.0F, -0.5F, 5, 3, 1, 0.0F);
|
||||
this.setRotateAngle(support2, 0.0F, -0.7853981633974483F, 0.0F);
|
||||
this.support3 = new ModelRenderer(this, 52, 0);
|
||||
this.support3.mirror = true;
|
||||
this.support3.setRotationPoint(5.0F, 1.0F, -5.0F);
|
||||
this.support3.addBox(0.0F, 0.0F, -0.5F, 5, 3, 1, 0.0F);
|
||||
this.setRotateAngle(support3, 0.0F, -2.356194490192345F, 0.0F);
|
||||
this.support7 = new ModelRenderer(this, 52, 4);
|
||||
this.support7.mirror = true;
|
||||
this.support7.setRotationPoint(5.0F, 8.0F, -5.0F);
|
||||
this.support7.addBox(0.0F, 0.0F, -0.5F, 5, 1, 1, -0.2F);
|
||||
this.setRotateAngle(support7, 0.0F, -2.356194490192345F, 0.0F);
|
||||
this.crystalPlateforme2 = new ModelRenderer(this, 0, 0);
|
||||
this.crystalPlateforme2.setRotationPoint(-1.5F, 6.0F, -1.5F);
|
||||
this.crystalPlateforme2.addBox(0.0F, 0.0F, 0.0F, 3, 1, 3, 0.0F);
|
||||
this.baseSide3 = new ModelRenderer(this, 16, 17);
|
||||
this.baseSide3.mirror = true;
|
||||
this.baseSide3.setRotationPoint(8.0F, 19.0F, 8.0F);
|
||||
this.baseSide3.addBox(0.0F, 0.0F, 0.0F, 16, 4, 1, 0.0F);
|
||||
this.setRotateAngle(baseSide3, 0.0F, -3.141592653589793F, 0.0F);
|
||||
}
|
||||
|
||||
public void render() {
|
||||
this.shape15.render(0.0625F);
|
||||
this.basePlateforme.render(0.0625F);
|
||||
this.photonInjector_1.render(0.0625F);
|
||||
this.baseSide1.render(0.0625F);
|
||||
this.crystalArmSupport1.render(0.0625F);
|
||||
this.shape16.render(0.0625F);
|
||||
this.baseSide4.render(0.0625F);
|
||||
this.shape14.render(0.0625F);
|
||||
this.shape17.render(0.0625F);
|
||||
this.support8.render(0.0625F);
|
||||
this.crystalArmSupport4.render(0.0625F);
|
||||
this.support5.render(0.0625F);
|
||||
this.crystalPlateforme.render(0.0625F);
|
||||
this.support6.render(0.0625F);
|
||||
this.photonInjector.render(0.0625F);
|
||||
this.crystalArmSupport2.render(0.0625F);
|
||||
this.shape13.render(0.0625F);
|
||||
this.shape18.render(0.0625F);
|
||||
this.baseSide2.render(0.0625F);
|
||||
this.support1.render(0.0625F);
|
||||
this.crystalArmSupport3.render(0.0625F);
|
||||
this.support4.render(0.0625F);
|
||||
this.support2.render(0.0625F);
|
||||
this.support3.render(0.0625F);
|
||||
this.support7.render(0.0625F);
|
||||
this.crystalPlateforme2.render(0.0625F);
|
||||
this.baseSide3.render(0.0625F);
|
||||
}
|
||||
|
||||
public void renderCrystal(float brightness) {
|
||||
float lastBrightnessX = OpenGlHelper.lastBrightnessX;
|
||||
float lastBrightnessY = OpenGlHelper.lastBrightnessY;
|
||||
|
||||
float b = brightness * 200F;
|
||||
float colour = Math.min(2F, (brightness * 2F) + 0.5F);
|
||||
if (brightness > 0F) GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, Math.min(200F, lastBrightnessX + b), Math.min(200F, lastBrightnessY + b));
|
||||
GL11.glColor4f(colour*10F, colour*0F, colour*20F, 0.9F);
|
||||
this.crystal.render(0.0625F);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lastBrightnessX, lastBrightnessY);
|
||||
if (brightness > 0F) GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a helper function from Tabula to set the rotation of model parts
|
||||
*/
|
||||
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
|
||||
modelRenderer.rotateAngleX = x;
|
||||
modelRenderer.rotateAngleY = y;
|
||||
modelRenderer.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
|
||||
/* v1.0
|
||||
public class ModelDefender extends ModelBase {
|
||||
public ModelRenderer Shape1;
|
||||
public ModelRenderer Shape2;
|
||||
@ -61,7 +270,6 @@ public class ModelDefender extends ModelBase {
|
||||
this.Shape7.setRotationPoint(0.0F, -4.0F, 0.0F);
|
||||
this.Shape7.setTextureSize(128, 128);
|
||||
this.Shape7.mirror = true;
|
||||
//this.setRotateAngle(this.Shape7, ((float)Math.sin(0)), (float)Math.sin(Math.PI/2), (float)Math.sin(3*Math.PI/2));
|
||||
this.Shape8 = new ModelRenderer(this, 10, 26);
|
||||
this.Shape8.addBox(-3.0F, 0.0F, -3.0F, 6, 2, 6);
|
||||
this.Shape8.setRotationPoint(0.0F, 20.0F, 0.0F);
|
||||
@ -97,12 +305,10 @@ public class ModelDefender extends ModelBase {
|
||||
if (brightness > 0F) GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a helper function from Tabula to set the rotation of model parts
|
||||
*/
|
||||
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
|
||||
modelRenderer.rotateAngleX = x;
|
||||
modelRenderer.rotateAngleY = y;
|
||||
modelRenderer.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
@ -29,7 +29,7 @@ public class RenderTileDefender extends TileEntitySpecialRenderer {
|
||||
RenderTileDefender.modelDefender.render();
|
||||
|
||||
float ticks = ((float)Minecraft.getMinecraft().renderViewEntity.ticksExisted + partialTick) * tile.rotationSpeed;
|
||||
if (tile.getWorldObj() != null)
|
||||
if (tile.getWorld() != null)
|
||||
{
|
||||
GL11.glRotatef(ticks % 360.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(35.0F, 1.0F, 0.0F, 0.0F);
|
||||
@ -41,7 +41,7 @@ public class RenderTileDefender extends TileEntitySpecialRenderer {
|
||||
*/
|
||||
}
|
||||
|
||||
GL11.glTranslatef(-0.125F,0.125F,0.125F);
|
||||
GL11.glTranslatef(0.3F,-0.22F,-0.3F);
|
||||
RenderTileDefender.modelDefender.renderCrystal(tile.crystalBrightness);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
@ -13,6 +13,7 @@ import fr.jackcartersmith.orbsat.client.render.particle.ParticleLaserBeam;
|
||||
import fr.jackcartersmith.orbsat.common.handler.FMLEventHandler;
|
||||
import fr.jackcartersmith.orbsat.common.lib.OSConstants;
|
||||
import fr.jackcartersmith.orbsat.common.lib.OSRefs;
|
||||
import fr.jackcartersmith.orbsat.common.network.PhotonPacket;
|
||||
import fr.jackcartersmith.orbsat.common.network.TileObjectPacket;
|
||||
import fr.jackcartersmith.orbsat.common.tileentities.TileDefender;
|
||||
import fr.jackcartersmith.orbsat.common.utils.OSLogHelper;
|
||||
@ -51,33 +52,8 @@ public class CommonProxy {
|
||||
OrbitalSatellite.network = NetworkRegistry.INSTANCE.newSimpleChannel(OrbitalSatellite.networkChannelName);
|
||||
OrbitalSatellite.network.registerMessage(TileObjectPacket.Handler.class, TileObjectPacket.class, 0, Side.SERVER);
|
||||
OrbitalSatellite.network.registerMessage(TileObjectPacket.Handler.class, TileObjectPacket.class, 1, Side.CLIENT);
|
||||
//OrbitalSatellite.network.registerMessage(OBNetwork.Handler.class, OBNetwork.class, 1, Side.SERVER);
|
||||
//OrbitalSatellite.network.registerMessage(OBNetworkClient.Handler.class, OBNetworkClient.class, 2, Side.CLIENT);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
DraconicEvolution.network.registerMessage(ButtonPacket.Handler.class, ButtonPacket.class, 0, Side.SERVER);
|
||||
DraconicEvolution.network.registerMessage(ParticleGenPacket.Handler.class, ParticleGenPacket.class, 1, Side.SERVER);
|
||||
DraconicEvolution.network.registerMessage(PlacedItemPacket.Handler.class, PlacedItemPacket.class, 2, Side.SERVER);
|
||||
DraconicEvolution.network.registerMessage(PlayerDetectorButtonPacket.Handler.class, PlayerDetectorButtonPacket.class, 3, Side.SERVER);
|
||||
DraconicEvolution.network.registerMessage(PlayerDetectorStringPacket.Handler.class, PlayerDetectorStringPacket.class, 4, Side.SERVER);
|
||||
DraconicEvolution.network.registerMessage(TeleporterPacket.Handler.class, TeleporterPacket.class, 5, Side.SERVER);
|
||||
DraconicEvolution.network.registerMessage(TileObjectPacket.Handler.class, TileObjectPacket.class, 6, Side.CLIENT);
|
||||
DraconicEvolution.network.registerMessage(MountUpdatePacket.Handler.class, MountUpdatePacket.class, 7, Side.CLIENT);
|
||||
DraconicEvolution.network.registerMessage(MountUpdatePacket.Handler.class, MountUpdatePacket.class, 8, Side.SERVER);
|
||||
DraconicEvolution.network.registerMessage(ItemConfigPacket.Handler.class, ItemConfigPacket.class, 9, Side.SERVER);
|
||||
DraconicEvolution.network.registerMessage(TileObjectPacket.Handler.class, TileObjectPacket.class, 10, Side.SERVER);
|
||||
DraconicEvolution.network.registerMessage(BlockUpdatePacket.Handler.class, BlockUpdatePacket.class, 11, Side.SERVER);
|
||||
DraconicEvolution.network.registerMessage(SpeedRequestPacket.Handler.class, SpeedRequestPacket.class, 12, Side.SERVER);
|
||||
DraconicEvolution.network.registerMessage(SpeedRequestPacket.Handler.class, SpeedRequestPacket.class, 13, Side.CLIENT);
|
||||
DraconicEvolution.network.registerMessage(ToolModePacket.Handler.class, ToolModePacket.class, 14, Side.SERVER);
|
||||
DraconicEvolution.network.registerMessage(GenericParticlePacket.Handler.class, GenericParticlePacket.class, 15, Side.CLIENT);
|
||||
DraconicEvolution.network.registerMessage(ShieldHitPacket.Handler.class, ShieldHitPacket.class, 16, Side.CLIENT);
|
||||
DraconicEvolution.network.registerMessage(ContributorPacket.Handler.class, ContributorPacket.class, 17, Side.CLIENT);
|
||||
DraconicEvolution.network.registerMessage(ContributorPacket.Handler.class, ContributorPacket.class, 18, Side.SERVER);
|
||||
*/
|
||||
|
||||
OrbitalSatellite.network.registerMessage(PhotonPacket.Handler.class, PhotonPacket.class, 10, Side.SERVER);
|
||||
OrbitalSatellite.network.registerMessage(PhotonPacket.Handler.class, PhotonPacket.class, 11, Side.CLIENT);
|
||||
}
|
||||
|
||||
public void registerTileEntities() {
|
||||
|
@ -31,7 +31,7 @@ public class BlockOS extends Block{
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(OSRefs.RESOURCESPREFIX + getUnwrappedUnlocalizedName(super.getUnlocalizedName()));
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ import net.minecraft.world.World;
|
||||
public class Defender extends BlockOS {
|
||||
public Defender() {
|
||||
super(Material.iron);
|
||||
this.setBlockName(OSStrings.defenderName);
|
||||
this.setUnlocalizedName(OSStrings.defenderName);
|
||||
this.setCreativeTab(OrbitalSatellite.OSCreaTab);
|
||||
this.setStepSound(soundTypeStone);
|
||||
OSBlocks.register(this);
|
||||
@ -26,7 +26,7 @@ public class Defender extends BlockOS {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
blockIcon = iconRegister.registerIcon(OSRefs.RESOURCESPREFIX + "machine");
|
||||
}
|
||||
|
||||
@ -111,6 +111,8 @@ public class Defender extends BlockOS {
|
||||
|
||||
//player.addChatComponentMessage(new ChatComponentText(Float.toString(tile.xAngle)));
|
||||
//FMLNetworkHandler.openGui(player, OrbitalSatellite.instance, GuiHandler.GUIID_ENERGY_INFUSER, world, x, y, z);
|
||||
} else {
|
||||
if (tile.firing != false) tile.firing = false; else tile.firing = true;
|
||||
}
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
|
@ -0,0 +1,32 @@
|
||||
package fr.jackcartersmith.orbsat.common.interfaces;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class PhotonConsuming extends TileEntity {
|
||||
public int currentCharge = 0;
|
||||
public int maxCharge = 0;
|
||||
|
||||
public void addCharge(int incomingCharge) {
|
||||
this.currentCharge += incomingCharge;
|
||||
}
|
||||
|
||||
public void removeCharge(int outgoingCharge) {
|
||||
this.currentCharge -= outgoingCharge;
|
||||
}
|
||||
|
||||
public int getCurrentCharge() {
|
||||
return this.currentCharge;
|
||||
}
|
||||
|
||||
public void setCurrentCharge(int currentCharge) {
|
||||
this.currentCharge = currentCharge;
|
||||
}
|
||||
|
||||
public int getMaxCharge() {
|
||||
return this.maxCharge;
|
||||
}
|
||||
|
||||
public void setMaxCharge(int maxCharge) {
|
||||
this.maxCharge = maxCharge;
|
||||
}
|
||||
}
|
@ -0,0 +1,233 @@
|
||||
package fr.jackcartersmith.orbsat.common.interfaces;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import fr.jackcartersmith.orbsat.OrbitalSatellite;
|
||||
import fr.jackcartersmith.orbsat.common.network.PhotonPacket;
|
||||
import fr.jackcartersmith.orbsat.common.utils.OSLogHelper;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class PhotonProducing extends TileEntity {
|
||||
int chargeRate = 0;
|
||||
int currentCharge = 0;
|
||||
public long time = 0L;
|
||||
public int powerIncoming;
|
||||
public int scaledOutput;
|
||||
private int tickCount = 0;
|
||||
public float rotate = -3.141F;
|
||||
|
||||
public List<PhotonConsuming> getSurroundingPhotonConsumers()
|
||||
{
|
||||
ArrayList<PhotonConsuming> surroundingConsumers = new ArrayList<PhotonConsuming>();
|
||||
|
||||
try
|
||||
{
|
||||
if (this.worldObj.getTileEntity(this.xCoord + 1, this.yCoord, this.zCoord) instanceof PhotonConsuming)
|
||||
{
|
||||
surroundingConsumers.add((PhotonConsuming)this.worldObj.getTileEntity(this.xCoord + 1, this.yCoord, this.zCoord));
|
||||
}
|
||||
|
||||
if (this.worldObj.getTileEntity(this.xCoord - 1, this.yCoord, this.zCoord) instanceof PhotonConsuming)
|
||||
{
|
||||
surroundingConsumers.add((PhotonConsuming)this.worldObj.getTileEntity(this.xCoord - 1, this.yCoord, this.zCoord));
|
||||
}
|
||||
|
||||
if (this.worldObj.getTileEntity(this.xCoord, this.yCoord + 1, this.zCoord) instanceof PhotonConsuming)
|
||||
{
|
||||
surroundingConsumers.add((PhotonConsuming)this.worldObj.getTileEntity(this.xCoord, this.yCoord + 1, this.zCoord));
|
||||
}
|
||||
|
||||
if (this.worldObj.getTileEntity(this.xCoord, this.yCoord - 1, this.zCoord) instanceof PhotonConsuming)
|
||||
{
|
||||
surroundingConsumers.add((PhotonConsuming)this.worldObj.getTileEntity(this.xCoord, this.yCoord - 1, this.zCoord));
|
||||
}
|
||||
|
||||
if (this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord + 1) instanceof PhotonConsuming)
|
||||
{
|
||||
surroundingConsumers.add((PhotonConsuming)this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord + 1));
|
||||
}
|
||||
|
||||
if (this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord - 1) instanceof PhotonConsuming)
|
||||
{
|
||||
surroundingConsumers.add((PhotonConsuming)this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord - 1));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OSLogHelper.error("Cannot cast entity into PhotonConsuming");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return surroundingConsumers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count
|
||||
* ticks and creates a new spawn inside its implementation.
|
||||
*/
|
||||
public void updateEntity()
|
||||
{
|
||||
/*
|
||||
if (this.getPowerIncoming() > 0)
|
||||
{
|
||||
this.rotate += 1.0E-4F * (float)this.getPowerIncoming();
|
||||
}
|
||||
|
||||
if (this.rotate >= 3.141F)
|
||||
{
|
||||
this.rotate = -3.141F;
|
||||
}
|
||||
*/
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
List<PhotonConsuming> surroundingPhotonConsumers = this.getSurroundingPhotonConsumers();
|
||||
this.addCharge(this.getChargeRate());
|
||||
int howMany = surroundingPhotonConsumers.size();
|
||||
int var8;
|
||||
|
||||
if (howMany == 0)
|
||||
{
|
||||
howMany = 1;
|
||||
var8 = this.getCurrentCharge() / howMany;
|
||||
}
|
||||
else
|
||||
{
|
||||
var8 = this.getCurrentCharge() / howMany;
|
||||
}
|
||||
|
||||
if (this.tickCount == 10)
|
||||
{
|
||||
this.sendPhotonPacket13();
|
||||
this.sendPhotonPacket15();
|
||||
|
||||
this.tickCount = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
++this.tickCount;
|
||||
}
|
||||
|
||||
this.setScaledOutput(var8);
|
||||
this.setPowerIncoming(this.getCurrentCharge());
|
||||
|
||||
if (var8 > 0)
|
||||
{
|
||||
Iterator<PhotonConsuming> i$ = surroundingPhotonConsumers.iterator();
|
||||
|
||||
while (i$.hasNext())
|
||||
{
|
||||
PhotonConsuming entity = (PhotonConsuming)i$.next();
|
||||
|
||||
try
|
||||
{
|
||||
if (entity.getCurrentCharge() < entity.getMaxCharge())
|
||||
{
|
||||
entity.addCharge(var8);
|
||||
}
|
||||
|
||||
var8 = this.getCurrentCharge() / howMany;
|
||||
entity.currentCharge += var8;
|
||||
}
|
||||
catch (Exception var7)
|
||||
{
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
this.removeCharge(this.getCurrentCharge());
|
||||
}
|
||||
}
|
||||
|
||||
this.time = this.worldObj.getWorldTime();
|
||||
this.time %= 24000L;
|
||||
}
|
||||
|
||||
public void addCharge(int incomingCharge)
|
||||
{
|
||||
this.currentCharge += incomingCharge;
|
||||
}
|
||||
|
||||
public void removeCharge(int outgoingCharge)
|
||||
{
|
||||
this.currentCharge -= outgoingCharge;
|
||||
}
|
||||
|
||||
public int getChargeRate()
|
||||
{
|
||||
return this.chargeRate;
|
||||
}
|
||||
|
||||
public void setChargeRate(int chargeRate)
|
||||
{
|
||||
this.chargeRate = chargeRate;
|
||||
}
|
||||
|
||||
public int getCurrentCharge()
|
||||
{
|
||||
return this.currentCharge;
|
||||
}
|
||||
|
||||
public void setCurrentCharge(int currentCharge)
|
||||
{
|
||||
this.currentCharge = currentCharge;
|
||||
}
|
||||
|
||||
public long getTime()
|
||||
{
|
||||
return this.time;
|
||||
}
|
||||
|
||||
public void setTime(long time)
|
||||
{
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public int getPowerIncoming()
|
||||
{
|
||||
return this.powerIncoming;
|
||||
}
|
||||
|
||||
public void setPowerIncoming(int powerIncoming)
|
||||
{
|
||||
this.powerIncoming = powerIncoming;
|
||||
}
|
||||
|
||||
public int getScaledOutput()
|
||||
{
|
||||
return this.scaledOutput;
|
||||
}
|
||||
|
||||
public void setScaledOutput(int scaledOutput)
|
||||
{
|
||||
this.scaledOutput = scaledOutput;
|
||||
}
|
||||
|
||||
public void sendPhotonPacket13()
|
||||
{
|
||||
List<Integer> bos = new ArrayList<Integer>();
|
||||
|
||||
bos.add(13);
|
||||
bos.add(this.xCoord);
|
||||
bos.add(this.yCoord);
|
||||
bos.add(this.zCoord);
|
||||
bos.add(this.getScaledOutput());
|
||||
|
||||
OrbitalSatellite.network.sendToAll(new PhotonPacket(bos));
|
||||
}
|
||||
|
||||
public void sendPhotonPacket15()
|
||||
{
|
||||
List<Integer> bos = new ArrayList<Integer>();
|
||||
|
||||
bos.add(15);
|
||||
bos.add(this.xCoord);
|
||||
bos.add(this.yCoord);
|
||||
bos.add(this.zCoord);
|
||||
bos.add(this.getPowerIncoming());
|
||||
|
||||
OrbitalSatellite.network.sendToAll(new PhotonPacket(bos));
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package fr.jackcartersmith.orbsat.common.interfaces;
|
||||
|
||||
public class PhotonRecieving extends PhotonProducing{
|
||||
public void recievePhotons(int power)
|
||||
{
|
||||
this.currentCharge += power;
|
||||
}
|
||||
}
|
@ -0,0 +1,203 @@
|
||||
package fr.jackcartersmith.orbsat.common.interfaces;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import fr.jackcartersmith.orbsat.OrbitalSatellite;
|
||||
import fr.jackcartersmith.orbsat.common.lib.OSConstants;
|
||||
import fr.jackcartersmith.orbsat.common.network.PhotonPacket;
|
||||
|
||||
public class PhotonSending extends PhotonConsuming {
|
||||
public int outputRate;
|
||||
public int listSize;
|
||||
public int scaledOutput;
|
||||
private int tickCount = 0;
|
||||
public float rotate = -3.141F;
|
||||
|
||||
public List<PhotonRecieving> getNearbyPhotonRecievingEntities()
|
||||
{
|
||||
int radius = OSConstants.PhotonSendingRadius;
|
||||
ArrayList<PhotonRecieving> entities = new ArrayList<PhotonRecieving>();
|
||||
int xC = this.xCoord;
|
||||
int yC = this.yCoord;
|
||||
int zC = this.zCoord;
|
||||
|
||||
for (int x = radius / 2 * -1; x <= radius / 2; ++x)
|
||||
{
|
||||
for (int y = radius / 2 * -1; y <= radius / 2; ++y)
|
||||
{
|
||||
for (int z = radius / 2 * -1; z <= radius / 2; ++z)
|
||||
{
|
||||
if (this.worldObj.getTileEntity(xC + x, yC + y, zC + z) instanceof PhotonRecieving && entities.size() <= 3)
|
||||
{
|
||||
entities.add((PhotonRecieving)this.worldObj.getTileEntity(xC + x, yC + y, zC + z));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return entities;
|
||||
}
|
||||
|
||||
public void sendPhotonsTo(PhotonRecieving entity, int power)
|
||||
{
|
||||
PhotonRecieving photonRecievingEntity = (PhotonRecieving)this.worldObj.getTileEntity(entity.xCoord, entity.yCoord, entity.zCoord);
|
||||
|
||||
if (photonRecievingEntity != null)
|
||||
{
|
||||
photonRecievingEntity.recievePhotons(power);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count
|
||||
* ticks and creates a new spawn inside its implementation.
|
||||
*/
|
||||
public void updateEntity()
|
||||
{
|
||||
this.rotate += 0.01F;
|
||||
|
||||
if (this.rotate >= 3.141F)
|
||||
{
|
||||
this.rotate = -3.141F;
|
||||
}
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
List<?> entitiesForPowerRecieving = this.getNearbyPhotonRecievingEntities();
|
||||
int scaledPowerOutput = 0;
|
||||
int howMany = entitiesForPowerRecieving.size();
|
||||
|
||||
if (howMany != 0)
|
||||
{
|
||||
scaledPowerOutput = this.getCurrentCharge() / howMany;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.scaledOutput = this.getCurrentCharge();
|
||||
}
|
||||
|
||||
if (entitiesForPowerRecieving.size() > 0 && this.getCurrentCharge() > 0)
|
||||
{
|
||||
Iterator<?> i$ = entitiesForPowerRecieving.iterator();
|
||||
|
||||
while (i$.hasNext())
|
||||
{
|
||||
PhotonRecieving entity = (PhotonRecieving)i$.next();
|
||||
this.sendPhotonsTo(entity, scaledPowerOutput);
|
||||
}
|
||||
}
|
||||
|
||||
this.setScaledOutput(scaledPowerOutput);
|
||||
this.setOutputRate(scaledPowerOutput * howMany);
|
||||
this.setListSize(howMany);
|
||||
|
||||
if (this.tickCount == 10)
|
||||
{
|
||||
this.sendPhotonPacket7();
|
||||
this.sendPhotonPacket9();
|
||||
this.sendPhotonPacket11();
|
||||
this.tickCount = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
++this.tickCount;
|
||||
}
|
||||
|
||||
this.setCurrentCharge(this.getCurrentCharge() - scaledPowerOutput * howMany);
|
||||
}
|
||||
}
|
||||
|
||||
public int getOutputRate()
|
||||
{
|
||||
return this.outputRate;
|
||||
}
|
||||
|
||||
public void setOutputRate(int outputRate)
|
||||
{
|
||||
this.outputRate = outputRate;
|
||||
}
|
||||
|
||||
public int getListSize()
|
||||
{
|
||||
return this.listSize;
|
||||
}
|
||||
|
||||
public void setListSize(int listSize)
|
||||
{
|
||||
this.listSize = listSize;
|
||||
}
|
||||
|
||||
public int getScaledOutput()
|
||||
{
|
||||
return this.scaledOutput;
|
||||
}
|
||||
|
||||
public void setScaledOutput(int scaledOutput)
|
||||
{
|
||||
this.scaledOutput = scaledOutput;
|
||||
}
|
||||
|
||||
public void sendPhotonPacket7()
|
||||
{
|
||||
List<Integer> bos = new ArrayList<Integer>();
|
||||
|
||||
bos.add(7);
|
||||
bos.add(this.xCoord);
|
||||
bos.add(this.yCoord);
|
||||
bos.add(this.zCoord);
|
||||
bos.add(this.getOutputRate());
|
||||
|
||||
OrbitalSatellite.network.sendToAll(new PhotonPacket(bos));
|
||||
}
|
||||
|
||||
public void sendPhotonPacket9()
|
||||
{
|
||||
List<Integer> bos = new ArrayList<Integer>();
|
||||
|
||||
bos.add(9);
|
||||
bos.add(this.xCoord);
|
||||
bos.add(this.yCoord);
|
||||
bos.add(this.zCoord);
|
||||
bos.add(this.getScaledOutput());
|
||||
|
||||
OrbitalSatellite.network.sendToAll(new PhotonPacket(bos));
|
||||
}
|
||||
|
||||
public void sendPhotonPacket11()
|
||||
{
|
||||
/*
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
|
||||
DataOutputStream outputStream = new DataOutputStream(bos);
|
||||
|
||||
try
|
||||
{
|
||||
outputStream.writeInt(11);
|
||||
outputStream.writeInt(this.xCoord);
|
||||
outputStream.writeInt(this.yCoord);
|
||||
outputStream.writeInt(this.zCoord);
|
||||
outputStream.writeInt(this.getListSize());
|
||||
}
|
||||
catch (Exception var4)
|
||||
{
|
||||
var4.printStackTrace();
|
||||
}
|
||||
|
||||
Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||
packet.channel = "OB";
|
||||
packet.data = bos.toByteArray();
|
||||
packet.length = bos.size();
|
||||
PacketDispatcher.sendPacketToAllPlayers(packet);
|
||||
*/
|
||||
List<Integer> bos = new ArrayList<Integer>();
|
||||
|
||||
bos.add(11);
|
||||
bos.add(this.xCoord);
|
||||
bos.add(this.yCoord);
|
||||
bos.add(this.zCoord);
|
||||
bos.add(this.getListSize());
|
||||
|
||||
OrbitalSatellite.network.sendToAll(new PhotonPacket(bos));
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@ package fr.jackcartersmith.orbsat.common.lib;
|
||||
public class OSRefs {
|
||||
public static final String MODID = "orbsat";
|
||||
public static final String MODNAME = "Orbital Satellite";
|
||||
public static final String VERSION = "0.1";
|
||||
public static final String VERSION = "0.1.8";
|
||||
public static final String MCVERSION = "1.7.10";
|
||||
public static final String CLIENTPROXYLOCATION = "fr.jackcartersmith.orbsat.client.ClientProxy";
|
||||
public static final String SERVERPROXYLOCATION = "fr.jackcartersmith.orbsat.common.CommonProxy";
|
||||
|
@ -0,0 +1,357 @@
|
||||
package fr.jackcartersmith.orbsat.common.network;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.ConcurrentModificationException;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import fr.jackcartersmith.orbsat.OrbitalSatellite;
|
||||
import fr.jackcartersmith.orbsat.common.interfaces.PhotonRecieving;
|
||||
import fr.jackcartersmith.orbsat.common.interfaces.PhotonSending;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class PhotonPacket implements IMessage {
|
||||
private List<Integer> dataArray = new ArrayList<Integer>();
|
||||
|
||||
public PhotonPacket() {}
|
||||
public PhotonPacket(List<Integer> dataArray) {
|
||||
this.dataArray = dataArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf){
|
||||
for (int i = 0; i < 5; i++){
|
||||
this.dataArray.add(buf.readInt());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf){
|
||||
for (int i = 0; i < 5; i++){
|
||||
buf.writeInt(this.dataArray.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<PhotonPacket, IMessage>{
|
||||
int function;
|
||||
int xCoord;
|
||||
int yCoord;
|
||||
int zCoord;
|
||||
int data_value;
|
||||
|
||||
public void sendChangeToClient(int xCoord, int yCoord, int zCoord, int chargeLevel)
|
||||
{
|
||||
List<Integer> bos = new ArrayList<Integer>();
|
||||
|
||||
bos.add(5);
|
||||
bos.add(xCoord);
|
||||
bos.add(yCoord);
|
||||
bos.add(zCoord);
|
||||
bos.add(chargeLevel);
|
||||
|
||||
//OrbitalSatellite.network.sendToAll(new OBNetworkClient(bos));
|
||||
OrbitalSatellite.network.sendToAll(new PhotonPacket(bos));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PhotonPacket message, MessageContext ctx) {
|
||||
if (ctx.side == Side.CLIENT) {
|
||||
try{
|
||||
this.function = message.dataArray.get(0);
|
||||
this.xCoord = message.dataArray.get(1);
|
||||
this.yCoord = message.dataArray.get(2);
|
||||
this.zCoord = message.dataArray.get(3);
|
||||
this.data_value = message.dataArray.get(4);
|
||||
}catch(Exception var8){
|
||||
var8.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
System.out.println(this.function);
|
||||
System.out.println(this.x);
|
||||
System.out.println(this.y);
|
||||
System.out.println(this.zCoord);
|
||||
System.out.println(this.data_value);
|
||||
*/
|
||||
|
||||
try{
|
||||
/*
|
||||
if (this.function == 1){
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
OverriderBlockTileEntity overrider = (OverriderBlockTileEntity)player.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord);
|
||||
|
||||
if (overrider != null && overrider instanceof OverriderBlockTileEntity){
|
||||
overrider.currentCharge = this.data_value;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.function == 3){
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
ExtenderTileEntity extender = (ExtenderTileEntity)player.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord);
|
||||
|
||||
if (extender instanceof ExtenderTileEntity){
|
||||
extender.currentCharge = this.data_value;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.function == 5){
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
OverriderBlockTileEntity overrider = (OverriderBlockTileEntity)player.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord);
|
||||
|
||||
if (overrider instanceof OverriderBlockTileEntity){
|
||||
overrider.shotsLeft = this.data_value;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if (this.function == 7)
|
||||
{
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
PhotonSending ext2 = (PhotonSending)player.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord);
|
||||
|
||||
if (ext2 instanceof PhotonSending)
|
||||
{
|
||||
ext2.setOutputRate(this.data_value);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.function == 9)
|
||||
{
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
PhotonSending ext2 = (PhotonSending)player.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord);
|
||||
|
||||
if (ext2 instanceof PhotonSending)
|
||||
{
|
||||
ext2.setScaledOutput(this.data_value);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.function == 11)
|
||||
{
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
PhotonSending ext2 = (PhotonSending)player.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord);
|
||||
|
||||
if (ext2 instanceof PhotonSending)
|
||||
{
|
||||
ext2.setListSize(this.data_value);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.function == 13)
|
||||
{
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
PhotonRecieving ext3 = (PhotonRecieving)player.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord);
|
||||
|
||||
if (ext3 instanceof PhotonRecieving)
|
||||
{
|
||||
ext3.setScaledOutput(this.data_value);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.function == 15)
|
||||
{
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
PhotonRecieving ext3 = (PhotonRecieving)player.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord);
|
||||
|
||||
if (ext3 instanceof PhotonRecieving)
|
||||
{
|
||||
ext3.setPowerIncoming(this.data_value);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.function == 17)
|
||||
{
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
PhotonRecieving ext3 = (PhotonRecieving)player.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord);
|
||||
|
||||
if (ext3 instanceof PhotonRecieving)
|
||||
{
|
||||
ext3.setCurrentCharge(this.data_value);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.function == 19)
|
||||
{
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
player.worldObj.playSoundEffect((double)this.xCoord, (double)this.yCoord, (double)this.zCoord, "ob:defender_strike", 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
return null;
|
||||
}catch (Exception var7){
|
||||
//var7.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
EntityPlayer sender = ctx.getServerHandler().playerEntity;
|
||||
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
|
||||
|
||||
try{
|
||||
this.function = message.dataArray.get(0);
|
||||
}catch(Exception var22){
|
||||
var22.printStackTrace();
|
||||
}
|
||||
|
||||
try{
|
||||
|
||||
|
||||
if (this.function == 2){
|
||||
this.xCoord = message.dataArray.get(1);
|
||||
this.yCoord = message.dataArray.get(2);
|
||||
this.zCoord = message.dataArray.get(3);
|
||||
this.data_value = message.dataArray.get(4);
|
||||
|
||||
try{
|
||||
List<?> charge1 = player.worldObj.getEntitiesWithinAABB(EntityLiving.class,
|
||||
AxisAlignedBB.getBoundingBox((double)(this.xCoord - this.data_value / 3),
|
||||
(double)(this.yCoord - this.data_value / 3), (double)(this.zCoord - this.data_value / 3),
|
||||
(double)(this.xCoord + this.data_value / 3), (double)(this.yCoord + this.data_value / 3),
|
||||
(double)(this.zCoord + this.data_value / 3)));
|
||||
|
||||
if (charge1.size() > 0){
|
||||
for(int y = 0; y <= charge1.size() - 1; y++){
|
||||
Random next = new Random();
|
||||
EntityLiving e1 = (EntityLiving)charge1.get(y);
|
||||
e1.setHealth(0.5F);
|
||||
e1.motionY = (double)(this.data_value / 5);
|
||||
e1.motionX = next.nextGaussian() * 5.0D;
|
||||
e1.motionZ = next.nextGaussian() * 5.0D;
|
||||
}
|
||||
}
|
||||
}catch(Exception var27){
|
||||
var27.printStackTrace();
|
||||
}
|
||||
|
||||
if (this.data_value <= 10){
|
||||
player.worldObj.playSoundAtEntity(player, "ob:explode", 0.3F, 5.0F);
|
||||
}
|
||||
|
||||
if (this.data_value > 10 && this.data_value <= 40){
|
||||
player.worldObj.playSoundAtEntity(player, "ob:explode", 0.3F, 1.5F);
|
||||
}
|
||||
|
||||
if (this.data_value > 40){
|
||||
player.worldObj.playSoundAtEntity(player, "ob:explode", 0.4F, 0.3F);
|
||||
}
|
||||
|
||||
player.worldObj.createExplosion((Entity)null, (double)this.xCoord, (double)this.yCoord, (double)this.zCoord, (float)this.data_value, true);
|
||||
}
|
||||
|
||||
/* ---Meteor function
|
||||
if (this.function == 5 && message != null){
|
||||
this.xCoord = message.dataArray.get(1);
|
||||
this.yCoord = message.dataArray.get(2);
|
||||
this.zCoord = message.dataArray.get(3);
|
||||
Random rand = new Random();
|
||||
OBNetwork$1 obNetworkServerThread = new OBNetwork$1(rand, player,this.xCoord, this.yCoord, this.zCoord);
|
||||
obNetworkServerThread.start();
|
||||
}*/
|
||||
|
||||
if (this.function == 9){
|
||||
this.xCoord = message.dataArray.get(1);
|
||||
this.yCoord = message.dataArray.get(2);
|
||||
this.zCoord = message.dataArray.get(3);
|
||||
player.worldObj.spawnEntityInWorld(new EntityLightningBolt(player.worldObj, (double)this.xCoord, (double)this.yCoord, (double)this.zCoord));
|
||||
}
|
||||
|
||||
if (this.function == 12){
|
||||
synchronized (sender){
|
||||
this.xCoord = message.dataArray.get(1);
|
||||
this.yCoord = message.dataArray.get(2);
|
||||
this.zCoord = message.dataArray.get(3);
|
||||
this.data_value = message.dataArray.get(4);
|
||||
World world = player.worldObj;
|
||||
int var36 = this.yCoord + 1;
|
||||
world.playSoundAtEntity(player, "ob:digging", 0.7F, 0.3F);
|
||||
|
||||
do{
|
||||
--var36;
|
||||
|
||||
try{
|
||||
Block found = world.getBlock(this.xCoord, var36, this.zCoord);
|
||||
ItemStack itemBlock = new ItemStack(found);
|
||||
new Random();
|
||||
EntityItem droppedItem = new EntityItem(world, (double)this.xCoord, (double)this.yCoord, (double)this.zCoord, itemBlock);
|
||||
Random rand = new Random();
|
||||
droppedItem.motionX = rand.nextGaussian() / 10.0D;
|
||||
droppedItem.motionY = 0.8D;
|
||||
droppedItem.motionZ = rand.nextGaussian() / 10.0D;
|
||||
world.spawnEntityInWorld(droppedItem);
|
||||
world.setBlockToAir(this.xCoord, var36, this.zCoord);
|
||||
Thread.sleep(5L);
|
||||
}catch(NullPointerException var23){
|
||||
}catch(ConcurrentModificationException var24){
|
||||
break;
|
||||
}catch(Exception var25){}
|
||||
}while(world.getBlock(this.xCoord, var36 - 1, this.zCoord) != Blocks.bedrock
|
||||
&& world.getBlock(this.xCoord, var36 - 1, this.zCoord) != Blocks.flowing_lava
|
||||
&& world.getBlock(this.xCoord, var36 - 1, this.zCoord) != Blocks.lava
|
||||
&& world.getBlock(this.xCoord, var36 - 1, this.zCoord) != Blocks.flowing_water
|
||||
&& world.getBlock(this.xCoord, var36 - 1, this.zCoord) != Blocks.water);
|
||||
|
||||
world.setBlockToAir(this.xCoord, this.yCoord + 1, this.zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if (this.function == 15){
|
||||
this.xCoord = message.dataArray.get(1);
|
||||
this.yCoord = message.dataArray.get(2);
|
||||
this.zCoord = message.dataArray.get(3);
|
||||
this.data_value = message.dataArray.get(4);
|
||||
OverriderBlockTileEntity overrider = (OverriderBlockTileEntity)player.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord);
|
||||
overrider.currentCharge -= this.data_value;
|
||||
--overrider.shotsLeft;
|
||||
}
|
||||
|
||||
if (this.function == 18){
|
||||
this.xCoord = message.dataArray.get(1);
|
||||
this.yCoord = message.dataArray.get(2);
|
||||
this.zCoord = message.dataArray.get(3);
|
||||
this.data_value = message.dataArray.get(4);
|
||||
player.worldObj.playSoundAtEntity(player, "ob:satelliteLaunch", 1.0F, 1.0F);
|
||||
OverriderBlockTileEntity overrider = (OverriderBlockTileEntity)player.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord);
|
||||
overrider.shotsLeft += this.data_value;
|
||||
overrider.currentCharge -= OSConstants.SateliteLaunchPUCost;
|
||||
this.sendChangeToClient(this.xCoord, this.yCoord, this.zCoord, this.data_value);
|
||||
}*/
|
||||
|
||||
if (this.function == 21){
|
||||
this.xCoord = message.dataArray.get(1);
|
||||
this.yCoord = message.dataArray.get(2);
|
||||
this.zCoord = message.dataArray.get(3);
|
||||
this.data_value = message.dataArray.get(4);
|
||||
player.worldObj.removeTileEntity(this.xCoord, this.yCoord, this.zCoord);
|
||||
player.worldObj.setBlockToAir(this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
|
||||
if (this.function == 24){
|
||||
player.worldObj.playSoundAtEntity(player, "ob:start", 1.0F, 1.0F);
|
||||
player.worldObj.playSoundAtEntity(player, "ob:middle", 1.0F, 0.7F);
|
||||
}
|
||||
|
||||
}catch(Exception var28){}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,50 +1,95 @@
|
||||
package fr.jackcartersmith.orbsat.common.tileentities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fr.jackcartersmith.orbsat.OrbitalSatellite;
|
||||
import fr.jackcartersmith.orbsat.client.render.particle.ParticleLaserBeam;
|
||||
import fr.jackcartersmith.orbsat.common.OSBlocks;
|
||||
import fr.jackcartersmith.orbsat.common.interfaces.PhotonRecieving;
|
||||
import fr.jackcartersmith.orbsat.common.lib.OSConstants;
|
||||
import fr.jackcartersmith.orbsat.common.network.PhotonPacket;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
//public class TileDefender extends TileObjectSync implements IEnergyReceiver, ISidedInventory {
|
||||
public class TileDefender extends TileEntity {
|
||||
public float modelIllumination = 30F;
|
||||
public class TileDefender extends PhotonRecieving {
|
||||
public int ticksCount = 0;
|
||||
public static float modelIllumination = 30F;
|
||||
public int facingDirection = ForgeDirection.UP.ordinal();
|
||||
public boolean running = false;
|
||||
public boolean runningCach = false;
|
||||
public int pow = 75;
|
||||
public boolean firing = false;
|
||||
private static int beamPow = 125;
|
||||
public float rotationSpeed = 4.0F;
|
||||
public float crystalBrightness = 1.0F;
|
||||
|
||||
private float xTarget = this.xCoord + 2F;
|
||||
private float yTarget = this.yCoord;
|
||||
private float zTarget = this.zCoord + 4F;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private ParticleLaserBeam beam;
|
||||
private ParticleLaserBeam beam_turret;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private ParticleLaserBeam beam_target;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
/*
|
||||
if (this.rotation != 1.0F)
|
||||
{
|
||||
if (this.rotation < 1.0F)
|
||||
{
|
||||
this.rotation += Math.max(this.rotation / 10.0F, 0.001F);
|
||||
++ticksCount;
|
||||
|
||||
if (worldObj.isRemote) {
|
||||
updateBeam();
|
||||
}
|
||||
|
||||
if ((double)this.rotation > 0.999D)
|
||||
//if (!this.worldObj.isRemote && this.getCurrentCharge() > 500)
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
this.rotation = 1.0F;
|
||||
if (ticksCount > 75) {
|
||||
firing = false;
|
||||
ticksCount = 0; //Reset tick counter
|
||||
}
|
||||
|
||||
if (ticksCount > 35 && !firing)
|
||||
{
|
||||
sendPhotonPacket17();
|
||||
List<?> entities = getNearByEntities();
|
||||
int thisX = xCoord;
|
||||
int thisY = yCoord;
|
||||
int thisZ = zCoord;
|
||||
Random random = new Random();
|
||||
|
||||
if (entities.size() > 0)
|
||||
{
|
||||
worldObj.playSoundEffect((double)thisX, (double)thisY, (double)thisZ, "ob:defenderLock", 1.0F, 1.0F);
|
||||
EntityMob mob = (EntityMob)entities.get(random.nextInt(entities.size()));
|
||||
|
||||
xTarget = (int)mob.lastTickPosX;
|
||||
yTarget = (int)mob.lastTickPosY;
|
||||
zTarget = (int)mob.lastTickPosZ;
|
||||
firing = true;
|
||||
//this.worldObj.setBlock((int)this.xTarget, (int)this.yTarget, (int)this.zTarget, OSBlocks.defender);
|
||||
//this.worldObj.setBlock(thisX, thisY + 1, thisZ, OSBlocks.laserDef);
|
||||
/*
|
||||
if (this.getCurrentCharge() > 500)
|
||||
{
|
||||
this.removeCharge(500);
|
||||
this.xTarget = (int)mob.lastTickPosX;
|
||||
this.yTarget = (int)mob.lastTickPosY;
|
||||
this.zTarget = (int)mob.lastTickPosZ;
|
||||
this.firing = true;
|
||||
//this.worldObj.setBlock((int)this.xTarget, (int)this.yTarget, (int)this.zTarget, OSBlocks.defender);
|
||||
//this.worldObj.setBlock(thisX, thisY + 1, thisZ, OSBlocks.laserDef);
|
||||
this.removeCharge(500);
|
||||
}
|
||||
*/
|
||||
|
||||
if (worldObj.isRemote)
|
||||
beam = OrbitalSatellite.proxy.energyBeam(worldObj, this.xCoord + 0.52F, this.yCoord, this.zCoord + 0.48F, this.xCoord, this.yCoord + 1024, this.zCoord, pow, 8, beam, true, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -90,6 +135,20 @@ public class TileDefender extends TileEntity {
|
||||
*/
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void updateBeam() {
|
||||
if (worldObj.isRemote) {
|
||||
if (firing) {
|
||||
crystalBrightness = 0.95F;
|
||||
} else {
|
||||
crystalBrightness = 0.0F;
|
||||
}
|
||||
|
||||
beam_turret = OrbitalSatellite.proxy.energyBeam(worldObj, xCoord + 0.51F, yCoord, zCoord + 0.5F, xCoord + 0.51F, yCoord + 1024, zCoord + 0.5F, beamPow, 8, beam_turret, firing, 0);
|
||||
beam_target = OrbitalSatellite.proxy.energyBeam(worldObj, xTarget + 0.51F, yTarget + 1024, zTarget + 0.5F, xTarget + 0.51F, yTarget, zTarget + 0.5F, beamPow, 8, beam_target, firing, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
private boolean tryStartOrStop() {
|
||||
if (items[0] != null && items[0].stackSize == 1 && items[0] != null && items[0].getItem() instanceof IEnergyContainerItem) {
|
||||
@ -107,16 +166,51 @@ public class TileDefender extends TileEntity {
|
||||
}
|
||||
*/
|
||||
|
||||
public List<?> getNearByEntities()
|
||||
{
|
||||
int radius = OSConstants.DefenderRadius;
|
||||
List<?> entities = this.worldObj.getEntitiesWithinAABB(EntityMob.class, AxisAlignedBB.getBoundingBox((double)(this.xCoord - radius), (double)(this.yCoord - radius), (double)(this.zCoord - radius), (double)(this.xCoord + radius), (double)(this.yCoord + radius), (double)(this.zCoord + radius)));
|
||||
return entities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
this.writeToNBT(tagCompound);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tagCompound);
|
||||
tagCompound.setBoolean("IsFiring", firing);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
readFromNBT(pkt.func_148857_g());
|
||||
NBTTagCompound compound = pkt.getNbtCompound();
|
||||
firing = compound.getBoolean("IsFiring");
|
||||
super.onDataPacket(net, pkt);
|
||||
}
|
||||
|
||||
public void sendPhotonPacket17()
|
||||
{
|
||||
List<Integer> bos = new ArrayList<Integer>();
|
||||
|
||||
bos.add(17);
|
||||
bos.add(this.xCoord);
|
||||
bos.add(this.yCoord);
|
||||
bos.add(this.zCoord);
|
||||
bos.add(this.getCurrentCharge());
|
||||
|
||||
OrbitalSatellite.network.sendToAll(new PhotonPacket(bos));
|
||||
}
|
||||
|
||||
public void sendPhotonPacket19()
|
||||
{
|
||||
List<Integer> bos = new ArrayList<Integer>();
|
||||
|
||||
bos.add(19);
|
||||
bos.add(this.xCoord);
|
||||
bos.add(this.yCoord);
|
||||
bos.add(this.zCoord);
|
||||
bos.add(0);
|
||||
|
||||
OrbitalSatellite.network.sendToAll(new PhotonPacket(bos));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -131,27 +225,18 @@ public class TileDefender extends TileEntity {
|
||||
public void receiveObjectFromServer(int index, Object object) {
|
||||
if (index == 0) running = (Boolean) object;
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound) {
|
||||
super.writeToNBT(compound);
|
||||
|
||||
masterLocation.writeToNBT(compound, "Master");
|
||||
compound.setInteger("Facing", facingDirection);
|
||||
compound.setBoolean("IsValid", isValid);
|
||||
compound.setInteger("RedstoneMode", redstoneMode);
|
||||
compound.setBoolean("IsFiring", this.firing);
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
super.readFromNBT(compound);
|
||||
/*
|
||||
masterLocation.readFromNBT(compound, "Master");
|
||||
facingDirection = compound.getInteger("Facing");
|
||||
isValid = compound.getBoolean("IsValid");
|
||||
redstoneMode = compound.getInteger("RedstoneMode");
|
||||
*/
|
||||
this.firing = compound.getBoolean("IsFiring");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user