Skip to content

Commit

Permalink
Update 552
Browse files Browse the repository at this point in the history
  • Loading branch information
ReikaKalseki committed Oct 14, 2017
1 parent 8a1d9a4 commit 205b9f8
Show file tree
Hide file tree
Showing 158 changed files with 2,958 additions and 668 deletions.
12 changes: 12 additions & 0 deletions API/Interfaces/CrystalTypesProxy.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package Reika.ChromatiCraft.API.Interfaces;

This comment has been minimized.

Copy link
@GhostShot3

GhostShot3 Oct 16, 2017

Hello, sorry to put these questions here but I have some questions that I really want to know how you were in that dimension in this video https://www.youtube.com/watch?v=-QPdZa6ig58

And as I may have more knowledge about your mod, I did not find so much content on the internet
How can I contact you?


import net.minecraft.item.ItemStack;


/** Implement this on an item class in order to mark it as "crystal element types" (16 colors, tied to the elements, etc)
* and to allow the crystal cell to store it. */
public interface CrystalTypesProxy {

public boolean isCrystalType(ItemStack is);

}
32 changes: 26 additions & 6 deletions Auxiliary/Ability/AbilityHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
Expand Down Expand Up @@ -99,6 +101,7 @@
import Reika.DragonAPI.Libraries.IO.ReikaPacketHelper;
import Reika.DragonAPI.Libraries.IO.ReikaRenderHelper;
import Reika.DragonAPI.Libraries.IO.ReikaSoundHelper;
import Reika.DragonAPI.Libraries.Java.ReikaJavaLibrary;
import Reika.DragonAPI.Libraries.Java.ReikaRandomHelper;
import Reika.DragonAPI.Libraries.Registry.ReikaItemHelper;
import Reika.DragonAPI.Libraries.World.ReikaBlockHelper;
Expand Down Expand Up @@ -141,8 +144,6 @@ public class AbilityHelper {

private final PlayerMap<LossCache> lossCache = new PlayerMap();

final PlayerMap<Integer> healthCache = new PlayerMap();

final PlayerMap<InventoryArray> inventories = new PlayerMap();

final PlayerMap<HashMap<String, WarpPoint>> teleports = new PlayerMap();
Expand Down Expand Up @@ -229,10 +230,6 @@ public AbilityXRays getAbilityXRay(Object te) {
return xRayMap.get(te.getClass());
}

public void boostHealth(EntityPlayer ep, int attr) {
healthCache.put(ep, attr);
}

public void startDrawingBoxes(EntityPlayer ep) {
isDrawingBox.put(ep, true);
}
Expand Down Expand Up @@ -1555,4 +1552,27 @@ public boolean canReachBoostSelect(World world, int x, int y, int z, EntityPlaye
}
return true;
}

public double getBoostedHealth(EntityPlayer ep) {
AttributeModifier mod = ep.getEntityAttribute(SharedMonsterAttributes.maxHealth).getModifier(Chromabilities.HEALTH_UUID);
double boost = mod != null ? mod.getAmount() : 0;
return boost;
}

public void syncHealth(EntityPlayerMP player) {
double health = this.getBoostedHealth(player);
int[] i = ReikaJavaLibrary.splitDoubleToInts(health);
ChromatiCraft.logger.log("Syncing health boost from server, boost="+health);
ReikaPacketHelper.sendDataPacket(ChromatiCraft.packetChannel, ChromaPackets.HEALTHSYNC.ordinal(), player, i[0], i[1]);
}

@SideOnly(Side.CLIENT)
public void setHealthClient(EntityPlayer ep, double attr) {
ChromatiCraft.logger.log("Receiving health boost sync from server, boost="+attr);
ep.getEntityAttribute(SharedMonsterAttributes.maxHealth).applyModifier(new AttributeModifier(Chromabilities.HEALTH_UUID, "Chroma", attr, 2));
}

public void copyHealthBoost(EntityPlayer original, EntityPlayer ep) {
ep.getEntityAttribute(SharedMonsterAttributes.maxHealth).applyModifier(new AttributeModifier(Chromabilities.HEALTH_UUID, "Chroma", this.getBoostedHealth(original), 2));
}
}
12 changes: 6 additions & 6 deletions Auxiliary/Ability/LoginApplier.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import Reika.ChromatiCraft.ChromatiCraft;
import Reika.ChromatiCraft.Registry.ChromaPackets;
import Reika.ChromatiCraft.Registry.Chromabilities;
import Reika.DragonAPI.Auxiliary.Trackers.PlayerHandler.PlayerTracker;
import Reika.DragonAPI.Libraries.IO.ReikaPacketHelper;

class LoginApplier implements PlayerTracker {

Expand All @@ -30,6 +27,11 @@ public void onPlayerLogin(EntityPlayer ep) {
if (Chromabilities.REACH.enabledOn(ep)) {
Chromabilities.triggerAbility(ep, Chromabilities.REACH, 0, true);
}
if (Chromabilities.HEALTH.enabledOn(ep)) {
if (ep instanceof EntityPlayerMP) {
AbilityHelper.instance.syncHealth((EntityPlayerMP)ep);
}
}
WarpPointData.readFromNBT(ep);
//WarpPointData.initWarpData(ep.worldObj).setDirty(true);
}
Expand All @@ -42,9 +44,7 @@ public void onPlayerLogout(EntityPlayer player) {
@Override
public void onPlayerChangedDimension(EntityPlayer player, int dimFrom, int dimTo) {
if (!player.worldObj.isRemote && Chromabilities.HEALTH.enabledOn(player)) {
Integer get = AbilityHelper.instance.healthCache.get(player);
int health = get != null ? get.intValue() : 0;
ReikaPacketHelper.sendDataPacket(ChromatiCraft.packetChannel, ChromaPackets.HEALTHSYNC.ordinal(), (EntityPlayerMP)player, health);
AbilityHelper.instance.syncHealth((EntityPlayerMP)player);
}
}

Expand Down
31 changes: 25 additions & 6 deletions Auxiliary/Ability/WarpPointData.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import Reika.ChromatiCraft.ChromatiCraft;
import Reika.DragonAPI.DragonAPICore;
import Reika.DragonAPI.IO.ReikaFileReader;
import Reika.DragonAPI.Instantiable.Data.Immutable.WorldLocation;
Expand Down Expand Up @@ -130,8 +131,14 @@ private static void readMapWriterFile(File f, HashSet<WarpPoint> map) {
String y = parts[2];
String z = parts[3];
String dim = parts[4];
WarpPoint p = new WarpPoint("["+idx+"] "+label, new WorldLocation(Integer.parseInt(dim), Integer.parseInt(x), Integer.parseInt(y), Integer.parseInt(z)));
map.add(p);
try {
WarpPoint p = new WarpPoint("["+idx+"] "+label, new WorldLocation(Integer.parseInt(dim), Integer.parseInt(x), Integer.parseInt(y), Integer.parseInt(z)));
map.add(p);
}
catch (Exception e) {
ChromatiCraft.logger.logError("Could not parse waypoint entry: "+s);
e.printStackTrace();
}
idx++;
}
}
Expand All @@ -147,8 +154,14 @@ private static void readJourneyMapFile(File f, HashSet<WarpPoint> map) {
int y = j.getAsJsonPrimitive("y").getAsInt();
int z = j.getAsJsonPrimitive("z").getAsInt();
String id = j.getAsJsonPrimitive("name").getAsString();
WarpPoint p = new WarpPoint(id, new WorldLocation(dims.get(0).getAsInt(), x, y, z));
map.add(p);
try {
WarpPoint p = new WarpPoint(id, new WorldLocation(dims.get(0).getAsInt(), x, y, z));
map.add(p);
}
catch (Exception ex) {
ChromatiCraft.logger.logError("Could not parse waypoint entry: "+e.toString());
ex.printStackTrace();
}
}
}

Expand All @@ -172,8 +185,14 @@ private static void readVoxelMapFile(File f, HashSet<WarpPoint> map) {
String label = dat.get("name");
label = label.replaceAll("~comma~", ",");
label = label.replaceAll("~colon~", ":");
WarpPoint p = new WarpPoint("["+idx+"] "+label, new WorldLocation(Integer.parseInt(dat.get("dimensions")), Integer.parseInt(dat.get("x")), Integer.parseInt(dat.get("y")), Integer.parseInt(dat.get("z"))));
map.add(p);
try {
WarpPoint p = new WarpPoint("["+idx+"] "+label, new WorldLocation(Integer.parseInt(dat.get("dimensions")), Integer.parseInt(dat.get("x")), Integer.parseInt(dat.get("y")), Integer.parseInt(dat.get("z"))));
map.add(p);
}
catch (Exception e) {
ChromatiCraft.logger.logError("Could not parse waypoint entry: "+s);
e.printStackTrace();
}
idx++;
}
}
Expand Down
30 changes: 3 additions & 27 deletions Auxiliary/ChromaASMHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private static enum ClassPatch implements ASMEnum {
ENDPROVIDER("net.minecraft.world.gen.ChunkProviderEnd", "ara"),
REACHDIST("net.minecraft.client.multiplayer.PlayerControllerMP", "bje"),
//CHARWIDTH("Reika.ChromatiCraft.Auxiliary.ChromaFontRenderer"), //Thank you, Optifine T_T
CHUNKPOPLN("net.minecraft.world.gen.ChunkProviderServer", "ms"),
//CHUNKPOPLN("net.minecraft.world.gen.ChunkProviderServer", "ms"),
//WORLDLIGHT("net.minecraft.world.World", "ahb"),
//WORLDLIGHT2("net.minecraft.world.ChunkCache", "ahr"),
//ENTITYCOLLISION("net.minecraft.entity.Entity", "sa"),
Expand Down Expand Up @@ -192,31 +192,7 @@ else if (primed && (ain.getOpcode() == Opcodes.IALOAD || ain.getOpcode() == Opco
}
}*//*
break;
}*/
case CHUNKPOPLN: {
MethodNode m = ReikaASMHelper.getMethodByName(cn, "func_73153_a", "populate", "(Lnet/minecraft/world/chunk/IChunkProvider;II)V");
boolean primed = false;
for (int i = 0; i < m.instructions.size(); i++) {
AbstractInsnNode ain = m.instructions.get(i);
if (ain.getOpcode() == Opcodes.INVOKEINTERFACE) {
primed = true;
}
else if (primed && ain.getOpcode() == Opcodes.INVOKESTATIC) {
MethodInsnNode min = (MethodInsnNode)ain;
if (min.owner.contains("GameRegistry") && min.name.equals("generateWorld")) {
primed = false;

min.owner = "Reika/ChromatiCraft/Auxiliary/ChromaAux";
min.name = "interceptChunkPopulation";
min.desc = "(IILnet/minecraft/world/World;Lnet/minecraft/world/chunk/IChunkProvider;Lnet/minecraft/world/chunk/IChunkProvider;)V";

ReikaASMHelper.log("Successfully applied "+this+" ASM handler!");
break;
}
}
}
}
break;/*
}*//*
case WORLDLIGHT:
case WORLDLIGHT2: {
MethodNode m = ReikaASMHelper.getMethodByName(cn, "func_72802_i", "getLightBrightnessForSkyBlocks", "(IIII)I");
Expand All @@ -231,7 +207,7 @@ else if (primed && ain.getOpcode() == Opcodes.INVOKESTATIC) {
ReikaASMHelper.log("Successfully applied "+this+" ASM handler!");
break;
}
*/
*/
/*
case ENTITYCOLLISION: {
String func = FMLForgePlugin.RUNTIME_DEOBF ? "func_72945_a" : "getCollidingBoundingBoxes";
Expand Down
Loading

0 comments on commit 205b9f8

Please sign in to comment.