generated from tilera/1710mod
Compare commits
17 commits
Author | SHA1 | Date | |
---|---|---|---|
Timo Ley | 011786e953 | ||
Timo Ley | f76723b551 | ||
Timo Ley | b89da88a78 | ||
Timo Ley | 18365c9c85 | ||
Timo Ley | d5e9580367 | ||
Timo Ley | 61cd161d8e | ||
Timo Ley | 34a38d2160 | ||
Timo Ley | 3900b28745 | ||
Timo Ley | 725e524497 | ||
Timo Ley | 78636b0f7f | ||
Timo Ley | 0349b88293 | ||
Timo Ley | 4a4798738e | ||
Timo Ley | 3db4a140e3 | ||
Timo Ley | e5587ebd31 | ||
Timo Ley | 3005fdba58 | ||
Timo Ley | 5f9630e891 | ||
Timo Ley | 16fea97234 |
|
@ -24,7 +24,7 @@ apply from: './gradle/scripts/mixins.gradle'
|
|||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
version = "1.8.7"
|
||||
version = "1.10.0-beta-1"
|
||||
group= "dev.tilera"
|
||||
archivesBaseName = "auracore"
|
||||
|
||||
|
@ -37,11 +37,13 @@ minecraft {
|
|||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven { url = "https://maven.tilera.xyz" }
|
||||
maven { url = "https://jitpack.io" }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "net.anvilcraft:anvillib-7:0.1.0:deobf"
|
||||
implementation "thaumcraft:Thaumcraft:1.7.10-4.2.3.5:deobf"
|
||||
implementation "com.github.tox1cozZ:mixin-booter-legacy:1.1.2"
|
||||
annotationProcessor "com.github.tox1cozZ:mixin-booter-legacy:1.1.2:processor"
|
||||
|
|
|
@ -1,163 +0,0 @@
|
|||
/**
|
||||
* DeveloperCapes by Jadar
|
||||
* License: MIT License
|
||||
* (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE)
|
||||
* version 4.0.0.x
|
||||
*/
|
||||
package com.jadarstudios.developercapes;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
|
||||
import com.jadarstudios.developercapes.cape.CapeConfig;
|
||||
import com.jadarstudios.developercapes.cape.CapeConfigManager;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* DeveloperCapes is a library for Minecraft. It allows developers to quickly add capes
|
||||
* for players they specify. DevCapes uses Minecraft Forge.
|
||||
*
|
||||
* @author jadar
|
||||
*/
|
||||
public class DevCapes {
|
||||
private static DevCapes instance;
|
||||
|
||||
public static final Logger logger = LogManager.getLogger("DevCapes");
|
||||
|
||||
protected DevCapes() {
|
||||
MinecraftForge.EVENT_BUS.register(new RenderEventHandler());
|
||||
}
|
||||
|
||||
public static DevCapes getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new DevCapes();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* InputStream.close() needs to be called on this after you're done!
|
||||
*
|
||||
* @return {@link InputStream} for the {@link URL}
|
||||
*/
|
||||
public InputStream getStreamForURL(URL url) {
|
||||
InputStream is = null;
|
||||
try {
|
||||
URLConnection connection = url.openConnection();
|
||||
connection.setRequestProperty(
|
||||
"User-Agent", System.getProperty("java.version")
|
||||
);
|
||||
connection.connect();
|
||||
|
||||
is = connection.getInputStream();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
/**
|
||||
* InputStream.close() needs to be called on this after you're done!
|
||||
*
|
||||
* @return {@link InputStream} for the {@link File}
|
||||
*/
|
||||
public InputStream getStreamForFile(File file) {
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = new FileInputStream(file);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
/**
|
||||
* DEPRECATED: Please use {@link #registerConfig(String jsonUrl)} instead.<p>
|
||||
* Registers a config with DevCapes.
|
||||
*
|
||||
* @param jsonUrl
|
||||
* The URL as a String that links to the Json file that you want
|
||||
* to add
|
||||
* @param identifier
|
||||
* A unique Identifier, normally your mod id
|
||||
* @return The id of the registered config
|
||||
*/
|
||||
public int registerConfig(String jsonURL, String identifier) {
|
||||
return this.registerConfig(jsonURL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a config with DevCapes.
|
||||
*
|
||||
* @param jsonUrl The URL as a String that links to the Json file that you want
|
||||
* to add
|
||||
* @return The id of the registered config
|
||||
*/
|
||||
public int registerConfig(String jsonUrl) {
|
||||
int id = -1;
|
||||
try {
|
||||
URL url = new URL(jsonUrl);
|
||||
id = this.registerConfig(url);
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
/**
|
||||
* DEPRECATED: Please use {@link #registerConfig(URL url)} instead.<p>
|
||||
* Registers a config with DevCapes.
|
||||
*
|
||||
* @param jsonUrl
|
||||
* A {@link URL} that links to the Json file that you want to add
|
||||
* @param identifier
|
||||
* A unique Identifier, normally your mod id
|
||||
* @return The id of the registered config
|
||||
*/
|
||||
public int registerConfig(URL url, String identifier) {
|
||||
return this.registerConfig(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a config with DevCapes and returns the ID of the config.
|
||||
*
|
||||
* @param jsonUrl A {@link URL} that links to the Json file that you want to add
|
||||
* @return The id of the registered config
|
||||
*/
|
||||
public int registerConfig(URL jsonUrl) {
|
||||
int id = -1;
|
||||
InputStream is = this.getStreamForURL(jsonUrl);
|
||||
|
||||
if (is == null) {
|
||||
DevCapes.logger.error(String.format(
|
||||
"Unable to establish a connection to the server, %s", jsonUrl.getHost()
|
||||
));
|
||||
return id;
|
||||
}
|
||||
|
||||
CapeConfig config = CapeConfigManager.getInstance().parse(is);
|
||||
|
||||
try {
|
||||
id = CapeConfigManager.getUniqueId();
|
||||
CapeConfigManager.getInstance().addConfig(id, config);
|
||||
} catch (CapeConfigManager.InvalidCapeConfigIdException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
silentClose(is);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
private static void silentClose(InputStream is) {
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException ignored) {}
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
/**
|
||||
* DeveloperCapes by Jadar
|
||||
* License: MIT License
|
||||
* (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE)
|
||||
* version 3.3.0.0
|
||||
*/
|
||||
package com.jadarstudios.developercapes;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.IImageBuffer;
|
||||
|
||||
/**
|
||||
* This class is an implementation of {@link IImageBuffer} that allows capes to be in HD
|
||||
*
|
||||
* @author Jadar
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class HDImageBuffer implements IImageBuffer {
|
||||
@Override
|
||||
public BufferedImage parseUserSkin(final BufferedImage texture) {
|
||||
if (texture == null)
|
||||
return null;
|
||||
int imageWidth = texture.getWidth(null) <= 64 ? 64 : texture.getWidth(null);
|
||||
int imageHeight = texture.getHeight(null) <= 32 ? 32 : texture.getHeight(null);
|
||||
|
||||
BufferedImage capeImage = new BufferedImage(imageWidth, imageHeight, 2);
|
||||
|
||||
Graphics graphics = capeImage.getGraphics();
|
||||
graphics.drawImage(texture, 0, 0, null);
|
||||
graphics.dispose();
|
||||
|
||||
return capeImage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_152634_a() {}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
/**
|
||||
* DeveloperCapes by Jadar
|
||||
* License: MIT License
|
||||
* (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE)
|
||||
* version 4.0.0.x
|
||||
*/
|
||||
package com.jadarstudios.developercapes;
|
||||
|
||||
import com.jadarstudios.developercapes.cape.ICape;
|
||||
import com.jadarstudios.developercapes.user.User;
|
||||
import com.jadarstudios.developercapes.user.UserManager;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
|
||||
/**
|
||||
* This is not the class you are looking for.
|
||||
*
|
||||
* @author jadar
|
||||
*/
|
||||
public class RenderEventHandler {
|
||||
@SubscribeEvent
|
||||
public void renderPlayer(RenderPlayerEvent.Specials.Pre event) {
|
||||
AbstractClientPlayer player = (AbstractClientPlayer) event.entityPlayer;
|
||||
|
||||
UserManager manager = UserManager.getInstance();
|
||||
User user = manager.getUser(player.getUniqueID().toString());
|
||||
if (user == null)
|
||||
return;
|
||||
|
||||
ICape cape = user.capes.get(0);
|
||||
if (cape == null)
|
||||
return;
|
||||
|
||||
boolean flag = cape.isTextureLoaded(player);
|
||||
if (!flag) {
|
||||
cape.loadTexture(player);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
/**
|
||||
* DeveloperCapes by Jadar
|
||||
* License: MIT License
|
||||
* (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE)
|
||||
* version 4.0.0.x
|
||||
*/
|
||||
package com.jadarstudios.developercapes.cape;
|
||||
|
||||
import net.minecraft.client.renderer.texture.ITextureObject;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**
|
||||
* Abstract Implementation of ICape used within Dev. Capes
|
||||
*
|
||||
* @author jadar
|
||||
*/
|
||||
public abstract class AbstractCape implements ICape {
|
||||
protected String name;
|
||||
protected ITextureObject texture;
|
||||
protected ResourceLocation location;
|
||||
|
||||
public AbstractCape(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public AbstractCape() {}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextureObject getTexture() {
|
||||
return this.texture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getLocation() {
|
||||
return this.location;
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
/**
|
||||
* DeveloperCapes by Jadar
|
||||
* License: MIT License
|
||||
* (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE)
|
||||
* version 4.0.0.x
|
||||
*/
|
||||
package com.jadarstudios.developercapes.cape;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.jadarstudios.developercapes.user.Group;
|
||||
import com.jadarstudios.developercapes.user.User;
|
||||
|
||||
/**
|
||||
* The players that need to be outfitted are stored here
|
||||
*
|
||||
* @author jadar
|
||||
*/
|
||||
public class CapeConfig {
|
||||
public HashMap<String, Group> groups;
|
||||
public HashMap<String, User> users;
|
||||
|
||||
public CapeConfig() {
|
||||
groups = new HashMap<String, Group>();
|
||||
users = new HashMap<String, User>();
|
||||
}
|
||||
}
|
|
@ -1,180 +0,0 @@
|
|||
/**
|
||||
* DeveloperCapes by Jadar
|
||||
* License: MIT License
|
||||
* (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE)
|
||||
* version 4.0.0.x
|
||||
*/
|
||||
package com.jadarstudios.developercapes.cape;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.BitSet;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.primitives.UnsignedBytes;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.jadarstudios.developercapes.DevCapes;
|
||||
import com.jadarstudios.developercapes.user.Group;
|
||||
import com.jadarstudios.developercapes.user.GroupManager;
|
||||
import com.jadarstudios.developercapes.user.User;
|
||||
import com.jadarstudios.developercapes.user.UserManager;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
|
||||
/**
|
||||
* All configs need a manager, this is it.
|
||||
*
|
||||
* @author jadar
|
||||
*/
|
||||
public class CapeConfigManager {
|
||||
protected static CapeConfigManager instance;
|
||||
|
||||
protected static BitSet availableIds = new BitSet(256);
|
||||
protected HashBiMap<Integer, CapeConfig> configs;
|
||||
|
||||
static {
|
||||
availableIds.clear(availableIds.size());
|
||||
}
|
||||
|
||||
public CapeConfigManager() {
|
||||
configs = HashBiMap.create();
|
||||
}
|
||||
|
||||
public static CapeConfigManager getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new CapeConfigManager();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void addConfig(int id, CapeConfig config) throws InvalidCapeConfigIdException {
|
||||
int realId = claimId(id);
|
||||
this.configs.put(realId, config);
|
||||
addUsers(config.users);
|
||||
addGroups(config.groups);
|
||||
}
|
||||
|
||||
protected void addUsers(Map<String, User> users) {
|
||||
try {
|
||||
UserManager.getInstance().addUsers(users.values());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected void addGroups(Map<String, Group> groups) {
|
||||
try {
|
||||
GroupManager.getInstance().addGroups(groups.values());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public CapeConfig getConfig(int id) {
|
||||
return this.configs.get(id);
|
||||
}
|
||||
|
||||
public int getIdForConfig(CapeConfig config) {
|
||||
return this.configs.inverse().get(config);
|
||||
}
|
||||
|
||||
public static int getUniqueId() {
|
||||
return availableIds.nextClearBit(1);
|
||||
}
|
||||
|
||||
public static int claimId(int id) throws InvalidCapeConfigIdException {
|
||||
if (id <= 0) {
|
||||
throw new InvalidCapeConfigIdException(
|
||||
"The config ID must be a positive non-zero integer"
|
||||
);
|
||||
}
|
||||
try {
|
||||
UnsignedBytes.checkedCast(id);
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
boolean isRegistered = availableIds.get(id);
|
||||
if (isRegistered) {
|
||||
throw new InvalidCapeConfigIdException(
|
||||
String.format("The config ID %d is already claimed.", id)
|
||||
);
|
||||
}
|
||||
|
||||
availableIds.set(id);
|
||||
return id;
|
||||
}
|
||||
|
||||
public CapeConfig parse(InputStream is) {
|
||||
if (is == null) {
|
||||
throw new NullPointerException("Can not parse a null input stream!");
|
||||
}
|
||||
|
||||
CapeConfig instance = new CapeConfig();
|
||||
InputStreamReader isr = new InputStreamReader(is);
|
||||
|
||||
try {
|
||||
Map<String, Object> entries = new Gson().fromJson(isr, Map.class);
|
||||
|
||||
for (Map.Entry<String, Object> entry : entries.entrySet()) {
|
||||
final String nodeName = entry.getKey();
|
||||
final Object obj = entry.getValue();
|
||||
if (obj instanceof Map) {
|
||||
parseGroup(instance, nodeName, (Map) obj);
|
||||
} else if (obj instanceof String) {
|
||||
parseUser(instance, nodeName, (String) obj);
|
||||
}
|
||||
}
|
||||
} catch (JsonSyntaxException e) {
|
||||
DevCapes.logger.error("CapeConfig could not be parsed because:");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
protected void parseGroup(CapeConfig config, String node, Map group) {
|
||||
Group g = GroupManager.getInstance().parse(node, group);
|
||||
if (g != null) {
|
||||
config.groups.put(g.name, g);
|
||||
}
|
||||
}
|
||||
|
||||
protected void parseUser(CapeConfig config, String node, String user) {
|
||||
User u = UserManager.getInstance().parse(node, user);
|
||||
if (u != null) {
|
||||
config.users.put(node, u);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DEPRECATED! Please use {@link
|
||||
* com.jadarstudios.developercapes.cape.CapeConfigManager#parse(java.io.InputStream
|
||||
* is)} This will be removed in the next major release.
|
||||
*/
|
||||
@Deprecated
|
||||
public CapeConfig parseFromStream(InputStream is) {
|
||||
return this.parse(is);
|
||||
}
|
||||
|
||||
public static class InvalidCapeConfigIdException extends Exception {
|
||||
public InvalidCapeConfigIdException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public InvalidCapeConfigIdException(String s) {
|
||||
super(s);
|
||||
}
|
||||
|
||||
public InvalidCapeConfigIdException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public InvalidCapeConfigIdException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
/**
|
||||
* DeveloperCapes by Jadar
|
||||
* License: MIT License
|
||||
* (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE)
|
||||
* version 4.0.0.x
|
||||
*/
|
||||
package com.jadarstudios.developercapes.cape;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.jadarstudios.developercapes.DevCapes;
|
||||
|
||||
/**
|
||||
* This manages all of the capes, be nice to it or you won't get one!
|
||||
*
|
||||
* @author jadar
|
||||
*/
|
||||
public class CapeManager {
|
||||
protected static CapeManager instance;
|
||||
|
||||
private HashMap<String, ICape> capes;
|
||||
|
||||
public CapeManager() {
|
||||
this.capes = new HashMap<String, ICape>();
|
||||
}
|
||||
|
||||
public static CapeManager getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new CapeManager();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void addCape(ICape cape) {
|
||||
if (!capes.containsValue(cape)) {
|
||||
capes.put(cape.getName(), cape);
|
||||
}
|
||||
}
|
||||
|
||||
public void addCapes(Collection<ICape> capes) {
|
||||
for (ICape c : capes) {
|
||||
this.addCape(c);
|
||||
}
|
||||
}
|
||||
|
||||
public ICape getCape(String capeName) {
|
||||
return capes.get(capeName);
|
||||
}
|
||||
|
||||
public ICape newCape(String name) {
|
||||
StaticCape cape = new StaticCape(name);
|
||||
this.capes.put(name, cape);
|
||||
return cape;
|
||||
}
|
||||
|
||||
public ICape parse(String name, Object object) {
|
||||
ICape cape = null;
|
||||
if (object instanceof String || object instanceof URL) {
|
||||
cape = parse(name, object.toString());
|
||||
} else {
|
||||
DevCapes.logger.error(String.format(
|
||||
"Cape, %s, could not be parsed because it is not in an accepted format!",
|
||||
object
|
||||
));
|
||||
}
|
||||
return cape;
|
||||
}
|
||||
|
||||
protected ICape parse(String name, String url) {
|
||||
ICape cape = null;
|
||||
|
||||
try {
|
||||
cape = new StaticCape(name, new URL(url));
|
||||
} catch (MalformedURLException e) {
|
||||
DevCapes.logger.error(
|
||||
String.format("Are you crazy?? \"%s\" is not a valid URL!", url)
|
||||
);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return cape;
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
/**
|
||||
* DeveloperCapes by Jadar
|
||||
* License: MIT License
|
||||
* (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE)
|
||||
* version 4.0.0.x
|
||||
*/
|
||||
package com.jadarstudios.developercapes.cape;
|
||||
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.renderer.texture.ITextureObject;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**
|
||||
* Any class implementing this will be requested to act as a cape.
|
||||
*
|
||||
* @author jadar
|
||||
*/
|
||||
public interface ICape {
|
||||
public String getName();
|
||||
|
||||
public ITextureObject getTexture();
|
||||
|
||||
public ResourceLocation getLocation();
|
||||
|
||||
public void loadTexture(AbstractClientPlayer player);
|
||||
|
||||
public boolean isTextureLoaded(AbstractClientPlayer player);
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
/**
|
||||
* DeveloperCapes by Jadar
|
||||
* License: MIT License
|
||||
* (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE)
|
||||
* version 4.0.0.x
|
||||
*/
|
||||
package com.jadarstudios.developercapes.cape;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
import com.jadarstudios.developercapes.HDImageBuffer;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.renderer.ThreadDownloadImageData;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**
|
||||
* Default Cape implementation
|
||||
*
|
||||
* @author jadar
|
||||
*/
|
||||
public class StaticCape extends AbstractCape {
|
||||
public StaticCape(String name, URL url) {
|
||||
this.setName(name);
|
||||
this.setURL(url);
|
||||
}
|
||||
|
||||
public StaticCape(String name) {
|
||||
this(name, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTexture(AbstractClientPlayer player) {
|
||||
ResourceLocation location = this.getLocation();
|
||||
player.func_152121_a(MinecraftProfileTexture.Type.CAPE, location);
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.loadTexture(location, this.getTexture());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTextureLoaded(AbstractClientPlayer player) {
|
||||
ResourceLocation cape = player.getLocationCape();
|
||||
return cape != null;
|
||||
}
|
||||
|
||||
public void setURL(URL url) {
|
||||
if (url == null) {
|
||||
this.texture = null;
|
||||
return;
|
||||
}
|
||||
this.texture = new ThreadDownloadImageData(
|
||||
null, url.toString(), null, new HDImageBuffer()
|
||||
);
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
this.location = new ResourceLocation("DevCapes/" + name);
|
||||
}
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
/**
|
||||
* DeveloperCapes by Jadar
|
||||
* License: MIT License
|
||||
* (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE)
|
||||
* version 4.0.0.x
|
||||
*/
|
||||
package com.jadarstudios.developercapes.user;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
import com.jadarstudios.developercapes.cape.ICape;
|
||||
|
||||
/**
|
||||
* This represents a group of players that share a cape
|
||||
*
|
||||
* @author jadar
|
||||
*/
|
||||
public class Group {
|
||||
protected HashMap<String, User> users;
|
||||
protected ICape cape;
|
||||
public final String name;
|
||||
|
||||
public Group(String name) {
|
||||
this.users = new HashMap<String, User>();
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void addUser(User user) {
|
||||
if (!this.users.containsValue(user)) {
|
||||
user.capes.add(this.cape);
|
||||
this.users.put(user.userUUID, user);
|
||||
}
|
||||
}
|
||||
|
||||
public void addUsers(Set<User> users) {
|
||||
for (User user : users) {
|
||||
this.addUser(user);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeUser(User user) {
|
||||
if (this.users.containsValue(user)) {
|
||||
this.users.remove(user);
|
||||
user.capes.remove(this.cape);
|
||||
}
|
||||
}
|
||||
|
||||
public ICape getCape() {
|
||||
return this.cape;
|
||||
}
|
||||
|
||||
public void setCape(ICape cape) {
|
||||
for (User user : this.users.values()) {
|
||||
user.capes.remove(this.cape);
|
||||
}
|
||||
|
||||
this.cape = cape;
|
||||
}
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
/**
|
||||
* DeveloperCapes by Jadar
|
||||
* License: MIT License
|
||||
* (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE)
|
||||
* version 4.0.0.x
|
||||
*/
|
||||
package com.jadarstudios.developercapes.user;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.jadarstudios.developercapes.DevCapes;
|
||||
import com.jadarstudios.developercapes.cape.CapeManager;
|
||||
|
||||
/**
|
||||
* All groups have to be managed
|
||||
*
|
||||
* @author jadar
|
||||
*/
|
||||
public class GroupManager {
|
||||
protected static GroupManager instance;
|
||||
|
||||
private HashMap<String, Group> groups;
|
||||
|
||||
public GroupManager() {
|
||||
this.groups = new HashMap<String, Group>();
|
||||
}
|
||||
|
||||
public static GroupManager getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new GroupManager();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void addGroup(Group group) {
|
||||
groups.put(group.name, group);
|
||||
|
||||
try {
|
||||
UserManager.getInstance().addUsers(group.users.values());
|
||||
CapeManager.getInstance().addCape(group.cape);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void addGroups(Collection<Group> groups) {
|
||||
for (Group g : groups) {
|
||||
GroupManager.getInstance().addGroup(g);
|
||||
}
|
||||
}
|
||||
|
||||
public Group getGroup(String capeName) {
|
||||
return groups.get(capeName);
|
||||
}
|
||||
|
||||
public Group newGroup(String name) {
|
||||
if (this.getGroup(name) != null) {
|
||||
return this.getGroup(name);
|
||||
}
|
||||
Group group = new Group(name);
|
||||
return group;
|
||||
}
|
||||
|
||||
public Group parse(String name, Map<String, Object> data) {
|
||||
Group group = new Group(name);
|
||||
|
||||
Object usersObj = data.get("users");
|
||||
Object capeUrlObj = data.get("capeUrl");
|
||||
|
||||
if (!(usersObj instanceof ArrayList) || !(capeUrlObj instanceof String)) {
|
||||
DevCapes.logger.error(String.format(
|
||||
"Group %s could not be parsed because it either is invalid or missing elements.",
|
||||
name
|
||||
));
|
||||
return null;
|
||||
}
|
||||
|
||||
ArrayList users = (ArrayList) usersObj;
|
||||
String capeUrl = (String) capeUrlObj;
|
||||
|
||||
group.cape = CapeManager.getInstance().parse(name, capeUrl);
|
||||
|
||||
for (Object obj : users) {
|
||||
User user = UserManager.getInstance().parse((String) obj, group.cape);
|
||||
if (user != null) {
|
||||
group.addUser(user);
|
||||
}
|
||||
}
|
||||
return group;
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
/**
|
||||
* DeveloperCapes by Jadar
|
||||
* License: MIT License
|
||||
* (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE)
|
||||
* version 4.0.0.x
|
||||
*/
|
||||
package com.jadarstudios.developercapes.user;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.jadarstudios.developercapes.cape.ICape;
|
||||
|
||||
/**
|
||||
* This player is getting their own cape
|
||||
*
|
||||
* @author jadar
|
||||
*/
|
||||
public class User {
|
||||
public List<ICape> capes;
|
||||
public final String userUUID;
|
||||
|
||||
public User(String userUUID) {
|
||||
this.userUUID = userUUID;
|
||||
this.capes = new ArrayList<ICape>();
|
||||
}
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
/**
|
||||
* DeveloperCapes by Jadar
|
||||
* License: MIT License
|
||||
* (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE)
|
||||
* version 4.0.0.x
|
||||
*/
|
||||
package com.jadarstudios.developercapes.user;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.jadarstudios.developercapes.DevCapes;
|
||||
import com.jadarstudios.developercapes.cape.CapeManager;
|
||||
import com.jadarstudios.developercapes.cape.ICape;
|
||||
|
||||
/**
|
||||
* Users can not be trusted to put capes on by themselves
|
||||
*
|
||||
* @author jadar
|
||||
*/
|
||||
public class UserManager {
|
||||
protected static UserManager instance;
|
||||
|
||||
protected HashMap<String, User> users;
|
||||
|
||||
public UserManager() {
|
||||
this.users = new HashMap<String, User>();
|
||||
}
|
||||
|
||||
public static UserManager getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new UserManager();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public User getUser(String username) {
|
||||
return this.users.get(username);
|
||||
}
|
||||
|
||||
public void addUser(User user) throws NullPointerException {
|
||||
if (user == null || user.userUUID == null || user.userUUID.isEmpty()) {
|
||||
throw new NullPointerException("Cannot add a null user!");
|
||||
}
|
||||
|
||||
this.users.put(user.userUUID, user);
|
||||
CapeManager.getInstance().addCapes(user.capes);
|
||||
}
|
||||
|
||||
public void addUsers(Collection<User> users) throws NullPointerException {
|
||||
for (User u : users) {
|
||||
this.addUser(u);
|
||||
}
|
||||
}
|
||||
|
||||
public User newUser(String username) {
|
||||
User user = null;
|
||||
if (this.users.containsKey(username)) {
|
||||
user = this.getUser(username);
|
||||
} else {
|
||||
user = new User(username);
|
||||
this.users.put(username, user);
|
||||
}
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
public User parse(String user, Object cape) {
|
||||
User userInstance = new User(user);
|
||||
|
||||
ICape capeInstance = (cape instanceof ICape)
|
||||
? (ICape) cape
|
||||
: CapeManager.getInstance().parse(user, cape.toString());
|
||||
|
||||
if (capeInstance != null) {
|
||||
userInstance.capes.add(capeInstance);
|
||||
} else {
|
||||
DevCapes.logger.error(String.format("Error parsing cape, %s", cape.toString())
|
||||
);
|
||||
}
|
||||
|
||||
return userInstance;
|
||||
}
|
||||
}
|
|
@ -9,9 +9,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
|||
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import dev.tilera.auracore.api.Aspects;
|
||||
import dev.tilera.auracore.aura.AuraCalculationThread;
|
||||
import dev.tilera.auracore.aura.AuraDeleteThread;
|
||||
|
@ -21,15 +19,12 @@ import dev.tilera.auracore.aura.AuraWorldTicker;
|
|||
import dev.tilera.auracore.client.GUITicker;
|
||||
import dev.tilera.auracore.client.RenderEventHandler;
|
||||
import dev.tilera.auracore.network.AuraDeletePacket;
|
||||
import dev.tilera.auracore.network.AuraDeletePacketHandler;
|
||||
import dev.tilera.auracore.network.AuraPacket;
|
||||
import dev.tilera.auracore.network.AuraPacketHandler;
|
||||
import dev.tilera.auracore.network.AuraTransferFXPacket;
|
||||
import dev.tilera.auracore.network.AuraTransferFXPacketHandler;
|
||||
import dev.tilera.auracore.network.NodeZapPacket;
|
||||
import dev.tilera.auracore.network.NodeZapPacketHandler;
|
||||
import dev.tilera.auracore.proxy.CommonProxy;
|
||||
import dev.tilera.auracore.world.WorldGenerator;
|
||||
import net.anvilcraft.anvillib.network.AnvilChannel;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import thaumcraft.api.ThaumcraftApi;
|
||||
|
@ -38,10 +33,10 @@ import thaumcraft.api.aspects.AspectList;
|
|||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
|
||||
@Mod(modid = "auracore", name = "AuraCore", version = "{VERSION}", dependencies = "required-after:Thaumcraft;after:MagicBees")
|
||||
@Mod(modid = "auracore", name = "AuraCore", version = "{VERSION}", dependencies = "required-after:anvillib;required-after:Thaumcraft;after:MagicBees")
|
||||
public class AuraCore {
|
||||
|
||||
public static SimpleNetworkWrapper CHANNEL;
|
||||
public static AnvilChannel CHANNEL;
|
||||
@Mod.Instance("auracore")
|
||||
public static AuraCore INSTANCE;
|
||||
@SidedProxy(modId = "auracore", clientSide = "dev.tilera.auracore.proxy.ClientProxy", serverSide = "dev.tilera.auracore.proxy.CommonProxy")
|
||||
|
@ -51,12 +46,11 @@ public class AuraCore {
|
|||
public void preInit(FMLPreInitializationEvent e) {
|
||||
Config.load();
|
||||
Aspects.load();
|
||||
CHANNEL = NetworkRegistry.INSTANCE.newSimpleChannel("auracore");
|
||||
int pktID = 0;
|
||||
AuraCore.CHANNEL.registerMessage(AuraPacketHandler.class, AuraPacket.class, pktID++, Side.CLIENT);
|
||||
AuraCore.CHANNEL.registerMessage(AuraDeletePacketHandler.class, AuraDeletePacket.class, pktID++, Side.CLIENT);
|
||||
AuraCore.CHANNEL.registerMessage(AuraTransferFXPacketHandler.class, AuraTransferFXPacket.class, pktID++, Side.CLIENT);
|
||||
AuraCore.CHANNEL.registerMessage(NodeZapPacketHandler.class, NodeZapPacket.class, pktID++, Side.CLIENT);
|
||||
CHANNEL = new AnvilChannel("auracore");
|
||||
AuraCore.CHANNEL.register(AuraPacket.class);
|
||||
AuraCore.CHANNEL.register(AuraDeletePacket.class);
|
||||
AuraCore.CHANNEL.register(AuraTransferFXPacket.class);
|
||||
AuraCore.CHANNEL.register(NodeZapPacket.class);
|
||||
proxy.preInit();
|
||||
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new RenderEventHandler());
|
||||
|
|
|
@ -47,6 +47,17 @@ public class EventHandler {
|
|||
}
|
||||
}
|
||||
nodeNBT.setTag("flux", flux);
|
||||
NBTTagList stasis = new NBTTagList();
|
||||
if (node.stasis.size() > 0) {
|
||||
for (Aspect tag : node.stasis.getAspects()) {
|
||||
if (tag == null) continue;
|
||||
NBTTagCompound f = new NBTTagCompound();
|
||||
f.setString("id", tag.getTag());
|
||||
f.setInteger("amount", node.stasis.getAmount(tag));
|
||||
stasis.appendTag(f);
|
||||
}
|
||||
}
|
||||
nodeNBT.setTag("stasis", stasis);
|
||||
nodelist.appendTag(nodeNBT);
|
||||
}
|
||||
}
|
||||
|
@ -83,6 +94,15 @@ public class EventHandler {
|
|||
if (!flux.hasKey("id") || !flux.hasKey("amount")) continue;
|
||||
node.flux.add(Aspect.getAspect(flux.getString("id")), flux.getInteger("amount"));
|
||||
}
|
||||
node.stasis = new AspectList();
|
||||
if (nodeData.hasKey("stasis")) {
|
||||
NBTTagList stasisTags = nodeData.getTagList("stasis", 10);
|
||||
for (int j = 0; j < stasisTags.tagCount(); ++j) {
|
||||
NBTTagCompound stasis = stasisTags.getCompoundTagAt(j);
|
||||
if (!stasis.hasKey("id") || !stasis.hasKey("amount")) continue;
|
||||
node.stasis.add(Aspect.getAspect(stasis.getString("id")), stasis.getInteger("amount"));
|
||||
}
|
||||
}
|
||||
AuraManager.auraNodes.put(node.key, node);
|
||||
AuraManager.addToAuraUpdateList(node);
|
||||
AuraManager.generateNodeNeighbours(node);
|
||||
|
|
|
@ -10,6 +10,7 @@ public class AuraNode implements Serializable {
|
|||
public short baseLevel;
|
||||
public short taint;
|
||||
public AspectList flux = new AspectList();
|
||||
public AspectList stasis = new AspectList();
|
||||
public EnumNodeType type;
|
||||
public int dimension;
|
||||
public double xPos;
|
||||
|
|
|
@ -5,7 +5,7 @@ public class CrystalColors {
|
|||
public static final int[] colors = new int[]{16777215, 16777086, 16727041, 37119, 40960, 15650047, 5592439, 11154172, 0xB0B0BC, 0x800080};
|
||||
|
||||
public static int getColorForShard(int meta) {
|
||||
if (meta > 9 || meta < 0) {
|
||||
if (meta > 9 || meta < 0 || meta == 6) {
|
||||
return 0xFFFFFF;
|
||||
} else if (meta > 6) {
|
||||
return colors[meta];
|
||||
|
|
|
@ -27,4 +27,6 @@ public interface ICrystal {
|
|||
*/
|
||||
void harvestShard(EntityPlayer player);
|
||||
|
||||
boolean canHarvest(EntityPlayer player);
|
||||
|
||||
}
|
||||
|
|
25
src/main/java/dev/tilera/auracore/api/IWandableBlock.java
Normal file
25
src/main/java/dev/tilera/auracore/api/IWandableBlock.java
Normal file
|
@ -0,0 +1,25 @@
|
|||
package dev.tilera.auracore.api;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IWandableBlock {
|
||||
|
||||
/**
|
||||
* Called by wands when interacting with the block
|
||||
* @param world The World of the block
|
||||
* @param stack The ItemStack of the wand
|
||||
* @param impl The IWand implementation for the wand
|
||||
* @param player The player
|
||||
* @param x xCoord of the block
|
||||
* @param y yCoord of the block
|
||||
* @param z zCoord of the block
|
||||
* @param side The side, which was activated
|
||||
* @param md The metadata of the block
|
||||
* @return true, if block was successfully wanded
|
||||
*/
|
||||
boolean onWandRightClick(World world, ItemStack stack, IWand impl, EntityPlayer player, int x, int y, int z, ForgeDirection side, int md);
|
||||
|
||||
}
|
|
@ -3,8 +3,10 @@ package dev.tilera.auracore.aura;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
|
@ -824,12 +826,17 @@ public class AuraManager {
|
|||
}
|
||||
|
||||
public static void queueNodeChanges(int key, int levelMod, int baseMod, boolean toggleLock, AspectList flx, float x, float y, float z) {
|
||||
NodeChanges nc = new NodeChanges(key, levelMod, baseMod, 0, toggleLock, flx, x, y, z);
|
||||
NodeChanges nc = new NodeChanges(key, levelMod, baseMod, 0, toggleLock, flx, null, x, y, z);
|
||||
auraUpdateQueue.add(nc);
|
||||
}
|
||||
|
||||
public static void queueNodeChanges(int key, int levelMod, int baseMod, int taint, boolean toggleLock, AspectList flx, float x, float y, float z) {
|
||||
NodeChanges nc = new NodeChanges(key, levelMod, baseMod, taint, toggleLock, flx, x, y, z);
|
||||
NodeChanges nc = new NodeChanges(key, levelMod, baseMod, taint, toggleLock, flx, null, x, y, z);
|
||||
auraUpdateQueue.add(nc);
|
||||
}
|
||||
|
||||
public static void queueNodeChanges(int key, int levelMod, int baseMod, int taint, boolean toggleLock, AspectList flx, AspectList stasis, float x, float y, float z) {
|
||||
NodeChanges nc = new NodeChanges(key, levelMod, baseMod, taint, toggleLock, flx, stasis, x, y, z);
|
||||
auraUpdateQueue.add(nc);
|
||||
}
|
||||
|
||||
|
@ -838,7 +845,32 @@ public class AuraManager {
|
|||
if (key < 0) {
|
||||
key = registerAuraNode(world, (short)(world.rand.nextInt(50) + 50), EnumNodeType.DARK, world.provider.dimensionId, x, y, z);
|
||||
}
|
||||
queueNodeChanges(key, 0, 0, taint, false, null, x, y, z);
|
||||
queueNodeChanges(key, 0, 0, taint, false, null, 0, 0, 0);
|
||||
}
|
||||
|
||||
public static void addGoodVibes(World world, int x, int y, int z, int amount) {
|
||||
int key = getClosestAuraWithinRange(world, x, y, z, 64);
|
||||
if (key < 0) return;
|
||||
queueNodeChanges(key, 0, 0, 0, false, null, new AspectList().add(Aspect.MAGIC, amount), 0, 0, 0);
|
||||
}
|
||||
|
||||
public static void addBadVibes(World world, int x, int y, int z, int amount) {
|
||||
int key = getClosestAuraWithinRange(world, x, y, z, 64);
|
||||
if (key < 0) return;
|
||||
queueNodeChanges(key, 0, 0, 0, false, new AspectList().add(Aspect.TAINT, amount), null, 0, 0, 0);
|
||||
}
|
||||
|
||||
public static void addBoost(World world, int x, int y, int z, int amount) {
|
||||
int key = getClosestAuraWithinRange(world, x, y, z, 64);
|
||||
if (key < 0) return;
|
||||
queueNodeChanges(key, 0, 0, 0, false, null, new AspectList().add(Aspects.TIME, amount), 0, 0, 0);
|
||||
}
|
||||
|
||||
public static int getBoost(World world, int x, int y, int z) {
|
||||
int key = getClosestAuraWithinRange(world, x, y, z, 64);
|
||||
if (key < 0) return 0;
|
||||
AuraNode node = getNode(key);
|
||||
return node.stasis.getAmount(Aspects.TIME);
|
||||
}
|
||||
|
||||
public static AuraNode copyNode(AuraNode in) {
|
||||
|
@ -854,6 +886,11 @@ public class AuraManager {
|
|||
outflux.add(tag, in.flux.getAmount(tag));
|
||||
}
|
||||
out.flux = outflux;
|
||||
AspectList outstasis = new AspectList();
|
||||
for (Aspect tag : in.stasis.getAspects()) {
|
||||
outstasis.add(tag, in.stasis.getAmount(tag));
|
||||
}
|
||||
out.stasis = outstasis;
|
||||
out.dimension = in.dimension;
|
||||
out.xPos = in.xPos;
|
||||
out.yPos = in.yPos;
|
||||
|
@ -874,6 +911,7 @@ public class AuraManager {
|
|||
out.taint = in.taint;
|
||||
out.type = in.type;
|
||||
out.flux = in.flux;
|
||||
out.stasis = in.stasis;
|
||||
out.dimension = in.dimension;
|
||||
out.xPos = in.xPos;
|
||||
out.yPos = in.yPos;
|
||||
|
@ -889,17 +927,19 @@ public class AuraManager {
|
|||
int taintMod = 0;
|
||||
boolean lock = false;
|
||||
AspectList flux = null;
|
||||
AspectList stasis = null;
|
||||
float motionX;
|
||||
float motionY;
|
||||
float motionZ;
|
||||
|
||||
NodeChanges(int k, int l, int b, int t, boolean lo, AspectList ot, float x, float y, float z) {
|
||||
NodeChanges(int k, int l, int b, int t, boolean lo, AspectList flux, AspectList stasis, float x, float y, float z) {
|
||||
this.key = k;
|
||||
this.levelMod = l;
|
||||
this.baseMod = b;
|
||||
this.taintMod = t;
|
||||
this.lock = lo;
|
||||
this.flux = ot;
|
||||
this.flux = flux;
|
||||
this.stasis = stasis;
|
||||
this.motionX = x;
|
||||
this.motionY = y;
|
||||
this.motionZ = z;
|
||||
|
|
|
@ -74,6 +74,38 @@ public class AuraUpdateThread
|
|||
}
|
||||
}
|
||||
}
|
||||
if (nc.stasis != null) {
|
||||
for (Aspect tag : nc.stasis.getAspects()) {
|
||||
if (nc.stasis.getAmount(tag) > 0) {
|
||||
node.stasis.add(tag, nc.stasis.getAmount(tag));
|
||||
continue;
|
||||
}
|
||||
node.stasis.reduce(tag, -nc.stasis.getAmount(tag)); // TODO:WTF
|
||||
}
|
||||
}
|
||||
if (node.stasis.size() > 0) {
|
||||
ArrayList<Aspect> dt = new ArrayList<>();
|
||||
ArrayList<Aspect> red = new ArrayList<>();
|
||||
for (Aspect tag : node.stasis.getAspects()) {
|
||||
if (node.stasis.getAmount(tag) <= 0) {
|
||||
dt.add(tag);
|
||||
continue;
|
||||
}
|
||||
if (node.stasis.getAmount(tag) <= 100)
|
||||
continue;
|
||||
red.add(tag);
|
||||
}
|
||||
if (red.size() > 0) {
|
||||
for (Aspect tag : red) {
|
||||
node.stasis.reduce(tag, node.stasis.getAmount(tag) - 100);
|
||||
}
|
||||
}
|
||||
if (dt.size() > 0) {
|
||||
for (Aspect tag : dt) {
|
||||
node.stasis.remove(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nc.motionX != 0.0f || nc.motionY != 0.0f || nc.motionZ != 0.0f) {
|
||||
int cx = MathHelper.floor_double((double) node.xPos) / 16;
|
||||
cz = MathHelper.floor_double((double) node.zPos) / 16;
|
||||
|
|
|
@ -30,6 +30,7 @@ class SlotWorkbenchWand extends Slot {
|
|||
!this.workbench.getWorldObj().isRemote &&
|
||||
this.inventory.getStackInSlot(this.getSlotIndex()) != null &&
|
||||
this.inventory.getStackInSlot(this.getSlotIndex()).getItem() instanceof ItemWandCasting) {
|
||||
player.inventory.setItemStack(null);
|
||||
player.openGui(Thaumcraft.instance, 13, this.workbench.getWorldObj(), this.workbench.xCoord, this.workbench.yCoord, this.workbench.zCoord);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -207,6 +207,7 @@ public class LegacyAspects {
|
|||
int var7 = (Integer)var6.next();
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Items.potionitem, 1, var7), new AspectList(new ItemStack(Items.potionitem)));
|
||||
}
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(ConfigItems.itemWispEssence, 1, 0), (new AspectList()).add(Aspect.AURA, 2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(ConfigItems.itemEssence), new AspectList().add(Aspect.VOID, 1).add(Aspect.CRYSTAL, 1));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(ConfigItems.itemNugget, 1, 31), new AspectList().add(Aspect.METAL, 12).add(Aspects.ROCK, 2).add(Aspects.VALUABLE, 8));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(ConfigItems.itemNugget, 1, 16), new AspectList().add(Aspect.METAL, 12).add(Aspects.ROCK, 2));
|
||||
|
|
|
@ -35,7 +35,7 @@ public abstract class MixinThaumcraftWorldGenerator {
|
|||
int z = chunkZ * 16 + random.nextInt(16);
|
||||
int y = world.getHeightValue(x, z);
|
||||
BiomeGenBase bio = world.getBiomeGenForCoords(x, z);
|
||||
if (bio.equals(ThaumcraftWorldGenerator.biomeMagicalForest) || bio.equals(ThaumcraftWorldGenerator.biomeTaint) || !BiomeDictionary.isBiomeOfType(bio, Type.MAGICAL) && bio.biomeID != BiomeGenBase.forestHills.biomeID && bio.biomeID != BiomeGenBase.birchForestHills.biomeID) {
|
||||
if (bio.equals(ThaumcraftWorldGenerator.biomeMagicalForest) || bio.equals(ThaumcraftWorldGenerator.biomeTaint) || !BiomeDictionary.isBiomeOfType(bio, Type.MAGICAL) && BiomeDictionary.isBiomeOfType(bio, Type.FOREST)) {
|
||||
return false;
|
||||
} else if (dev.tilera.auracore.Config.replaceSilverwood) {
|
||||
boolean t = (new WorldGenSilverwoodTreesOld(false)).generate(world, random, x, y, z);
|
||||
|
|
|
@ -119,4 +119,10 @@ public abstract class MixinTileCrystal extends TileThaumcraft implements ICrysta
|
|||
worldObj.spawnEntityInWorld(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvest(EntityPlayer player) {
|
||||
int md = this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord);
|
||||
return md != 6 && md != 9 && crystals > 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
package dev.tilera.auracore.network;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dev.tilera.auracore.api.AuraNode;
|
||||
import dev.tilera.auracore.client.AuraManagerClient;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.anvilcraft.anvillib.network.AnvilPacket;
|
||||
import net.anvilcraft.anvillib.network.IAnvilPacket;
|
||||
|
||||
public class AuraDeletePacket implements IMessage {
|
||||
@AnvilPacket(Side.CLIENT)
|
||||
public class AuraDeletePacket implements IAnvilPacket {
|
||||
|
||||
int key;
|
||||
|
||||
|
@ -23,5 +29,12 @@ public class AuraDeletePacket implements IMessage {
|
|||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeInt(key);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void handle(MessageContext ctx) {
|
||||
AuraManagerClient.auraClientList.remove(this.key);
|
||||
AuraManagerClient.auraClientHistory.remove(this.key);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
package dev.tilera.auracore.network;
|
||||
|
||||
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 cpw.mods.fml.relauncher.SideOnly;
|
||||
import dev.tilera.auracore.client.AuraManagerClient;
|
||||
|
||||
public class AuraDeletePacketHandler implements IMessageHandler<AuraDeletePacket, IMessage> {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IMessage onMessage(AuraDeletePacket message, MessageContext ctx) {
|
||||
AuraManagerClient.auraClientList.remove(message.key);
|
||||
AuraManagerClient.auraClientHistory.remove(message.key);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,10 +1,20 @@
|
|||
package dev.tilera.auracore.network;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dev.tilera.auracore.api.AuraNode;
|
||||
import dev.tilera.auracore.client.AuraManagerClient;
|
||||
import dev.tilera.auracore.client.AuraManagerClient.NodeHistoryStats;
|
||||
import dev.tilera.auracore.client.AuraManagerClient.NodeStats;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.anvilcraft.anvillib.network.AnvilPacket;
|
||||
import net.anvilcraft.anvillib.network.IAnvilPacket;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class AuraPacket implements IMessage {
|
||||
@AnvilPacket(Side.CLIENT)
|
||||
public class AuraPacket implements IAnvilPacket {
|
||||
|
||||
public int key;
|
||||
public double x;
|
||||
|
@ -63,5 +73,18 @@ public class AuraPacket implements IMessage {
|
|||
buf.writeByte(type);
|
||||
buf.writeBoolean(virtual);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void handle(MessageContext ctx) {
|
||||
World world = FMLClientHandler.instance().getWorldClient();
|
||||
if (AuraManagerClient.auraClientHistory.get(this.key) != null) {
|
||||
AuraManagerClient.auraClientHistory.put(this.key, new NodeHistoryStats(AuraManagerClient.auraClientList.get(this.key)));
|
||||
}
|
||||
AuraManagerClient.auraClientList.put(this.key, new NodeStats(this, world.provider.dimensionId));
|
||||
if (AuraManagerClient.auraClientHistory.get(this.key) == null) {
|
||||
AuraManagerClient.auraClientHistory.put(this.key, new NodeHistoryStats(this.level, this.flux, this.taint));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
package dev.tilera.auracore.network;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
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 cpw.mods.fml.relauncher.SideOnly;
|
||||
import dev.tilera.auracore.client.AuraManagerClient;
|
||||
import dev.tilera.auracore.client.AuraManagerClient.NodeHistoryStats;
|
||||
import dev.tilera.auracore.client.AuraManagerClient.NodeStats;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class AuraPacketHandler implements IMessageHandler<AuraPacket, IMessage> {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IMessage onMessage(AuraPacket message, MessageContext ctx) {
|
||||
World world = FMLClientHandler.instance().getWorldClient();
|
||||
if (AuraManagerClient.auraClientHistory.get(message.key) != null) {
|
||||
AuraManagerClient.auraClientHistory.put(message.key, new NodeHistoryStats(AuraManagerClient.auraClientList.get(message.key)));
|
||||
}
|
||||
AuraManagerClient.auraClientList.put(message.key, new NodeStats(message, world.provider.dimensionId));
|
||||
if (AuraManagerClient.auraClientHistory.get(message.key) == null) {
|
||||
AuraManagerClient.auraClientHistory.put(message.key, new NodeHistoryStats(message.level, message.flux, message.taint));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,10 +1,20 @@
|
|||
package dev.tilera.auracore.network;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dev.tilera.auracore.api.AuraNode;
|
||||
import dev.tilera.auracore.client.FXSparkle;
|
||||
import dev.tilera.auracore.helper.Utils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.anvilcraft.anvillib.network.AnvilPacket;
|
||||
import net.anvilcraft.anvillib.network.IAnvilPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class AuraTransferFXPacket implements IMessage {
|
||||
@AnvilPacket(Side.CLIENT)
|
||||
public class AuraTransferFXPacket implements IAnvilPacket {
|
||||
|
||||
double x;
|
||||
double y;
|
||||
|
@ -43,5 +53,23 @@ public class AuraTransferFXPacket implements IMessage {
|
|||
buf.writeDouble(targetY);
|
||||
buf.writeDouble(targetZ);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void handle(MessageContext ctx) {
|
||||
EntityPlayer player = FMLClientHandler.instance().getClientPlayerEntity();
|
||||
if (Utils.hasGoggles(player)) {
|
||||
double var7 = this.x - this.targetX;
|
||||
double var9 = this.y - this.targetY;
|
||||
double var11 = this.z - this.targetZ;
|
||||
int distance = (int)MathHelper.sqrt_double((double)(var7 * var7 + var9 * var9 + var11 * var11));
|
||||
FXSparkle fx = new FXSparkle(player.worldObj, this.x, this.y, this.z, this.targetX, this.targetY, this.targetZ, 2.5f, 0, distance / 2);
|
||||
fx.slowdown = false;
|
||||
fx.noClip = true;
|
||||
fx.leyLineEffect = true;
|
||||
fx.shrink = false;
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(fx);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
package dev.tilera.auracore.network;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
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 cpw.mods.fml.relauncher.SideOnly;
|
||||
import dev.tilera.auracore.client.FXSparkle;
|
||||
import dev.tilera.auracore.helper.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class AuraTransferFXPacketHandler implements IMessageHandler<AuraTransferFXPacket, IMessage> {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IMessage onMessage(AuraTransferFXPacket message, MessageContext ctx) {
|
||||
EntityPlayer player = FMLClientHandler.instance().getClientPlayerEntity();
|
||||
if (Utils.hasGoggles(player)) {
|
||||
double var7 = message.x - message.targetX;
|
||||
double var9 = message.y - message.targetY;
|
||||
double var11 = message.z - message.targetZ;
|
||||
int distance = (int)MathHelper.sqrt_double((double)(var7 * var7 + var9 * var9 + var11 * var11));
|
||||
FXSparkle fx = new FXSparkle(player.worldObj, message.x, message.y, message.z, message.targetX, message.targetY, message.targetZ, 2.5f, 0, distance / 2);
|
||||
fx.slowdown = false;
|
||||
fx.noClip = true;
|
||||
fx.leyLineEffect = true;
|
||||
fx.shrink = false;
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(fx);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,10 +1,18 @@
|
|||
package dev.tilera.auracore.network;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.anvilcraft.anvillib.network.AnvilPacket;
|
||||
import net.anvilcraft.anvillib.network.IAnvilPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.client.fx.bolt.FXLightningBolt;
|
||||
|
||||
public class NodeZapPacket implements IMessage {
|
||||
@AnvilPacket(Side.CLIENT)
|
||||
public class NodeZapPacket implements IAnvilPacket {
|
||||
|
||||
public double x;
|
||||
public double y;
|
||||
|
@ -35,5 +43,18 @@ public class NodeZapPacket implements IMessage {
|
|||
buf.writeDouble(z);
|
||||
buf.writeInt(entityID);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void handle(MessageContext ctx) {
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
Entity targetedEntity = world.getEntityByID(this.entityID);
|
||||
if (targetedEntity != null) {
|
||||
FXLightningBolt bolt = new FXLightningBolt(world, this.x, this.y, this.z, targetedEntity.posX, targetedEntity.posY, targetedEntity.posZ, world.rand.nextLong(), 10, 2.0f, 5);
|
||||
bolt.defaultFractal();
|
||||
bolt.setType(3);
|
||||
bolt.finalizeBolt();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
package dev.tilera.auracore.network;
|
||||
|
||||
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 cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.client.fx.bolt.FXLightningBolt;
|
||||
|
||||
public class NodeZapPacketHandler implements IMessageHandler<NodeZapPacket, IMessage> {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IMessage onMessage(NodeZapPacket message, MessageContext ctx) {
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
Entity targetedEntity = world.getEntityByID(message.entityID);
|
||||
if (targetedEntity != null) {
|
||||
FXLightningBolt bolt = new FXLightningBolt(world, message.x, message.y, message.z, targetedEntity.posX, targetedEntity.posY, targetedEntity.posZ, world.rand.nextLong(), 10, 2.0f, 5);
|
||||
bolt.defaultFractal();
|
||||
bolt.setType(3);
|
||||
bolt.finalizeBolt();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -99,7 +99,7 @@ public class WorldGenerator implements IWorldGenerator {
|
|||
this.structureNode.put(var7.hashCode(), true);
|
||||
int yPos = world.getHeightValue(var7.chunkPosX, var7.chunkPosZ) + 3;
|
||||
int nearKey = AuraManager.getClosestAuraWithinRange(world, var7.chunkPosX, var7.chunkPosZ, 10);
|
||||
if (nearKey < 0 && yPos > 0) {
|
||||
if (nearKey < 0 && yPos > 5) {
|
||||
int value = random.nextInt(200) + 800;
|
||||
AuraManager.registerAuraNode(world, (short)value, EnumNodeType.NORMAL, world.provider.dimensionId, var7.chunkPosX, yPos, var7.chunkPosZ);
|
||||
}
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
package dev.tilera.capes;
|
||||
|
||||
import com.jadarstudios.developercapes.DevCapes;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class Capes {
|
||||
|
||||
private static boolean capesInitialized = false;
|
||||
|
||||
public static void initCapes() {
|
||||
if (!capesInitialized) {
|
||||
capesInitialized = true;
|
||||
try {
|
||||
DevCapes.getInstance().registerConfig(
|
||||
"https://capes.tilera.xyz/devcapes.json"
|
||||
);
|
||||
MinecraftForge.EVENT_BUS.register(new RenderEventHandler());
|
||||
} catch (Exception e) {
|
||||
System.out.print("Cant load capes\n" + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
package dev.tilera.capes;
|
||||
|
||||
import com.jadarstudios.developercapes.cape.ICape;
|
||||
import com.jadarstudios.developercapes.user.User;
|
||||
import com.jadarstudios.developercapes.user.UserManager;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
|
||||
public class RenderEventHandler {
|
||||
@SubscribeEvent
|
||||
public void renderPlayer(RenderPlayerEvent.Specials.Pre event) {
|
||||
AbstractClientPlayer player = (AbstractClientPlayer) event.entityPlayer;
|
||||
|
||||
UserManager manager = UserManager.getInstance();
|
||||
User user = manager.getUser(player.getUniqueID().toString());
|
||||
if (user == null) {
|
||||
player.func_152121_a(MinecraftProfileTexture.Type.CAPE, null);
|
||||
return;
|
||||
}
|
||||
|
||||
ICape cape = user.capes.get(0);
|
||||
if (cape == null) {
|
||||
player.func_152121_a(MinecraftProfileTexture.Type.CAPE, null);
|
||||
return;
|
||||
}
|
||||
|
||||
cape.loadTexture(player);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue