Move Icon sprites in to the gui folder and particles sprites in to the entity folder and Fix #1143

This commit is contained in:
Nedelosk committed 2016-04-29 21:02:13 +02:00
1 parent 43ac71b022
commit 3cfc158875
108 files changed
+50 -10

No files matched your search

@@ -70,6 +70,7 @@ import forestry.apiculture.blocks.BlockRegistryApiculture;
import forestry.apiculture.blocks.BlockTypeApiculture;
import forestry.apiculture.blocks.BlockTypeApicultureTesr;
import forestry.apiculture.commands.CommandBee;
import forestry.apiculture.entities.EntityFXBee;
import forestry.apiculture.entities.EntityMinecartApiary;
import forestry.apiculture.entities.EntityMinecartBeehouse;
import forestry.apiculture.flowers.Flower;
@@ -948,8 +949,9 @@ public class PluginApiculture extends BlankForestryPlugin {
public void textureHook(TextureStitchEvent.Pre event) {
EntityFXSnow.sprites = new TextureAtlasSprite[3];
for (int i = 0; i < EntityFXSnow.sprites.length; i++) {
EntityFXSnow.sprites[i] = event.map.registerSprite(new ResourceLocation("forestry:items/particles/snow." + (i + 1)));
EntityFXSnow.sprites[i] = event.map.registerSprite(new ResourceLocation("forestry:entity/particles/snow." + (i + 1)));
}
EntityFXBee.beeSprite = event.map.registerSprite(new ResourceLocation("forestry:entity/particles/swarm_bee"));
ItemHabitatLocator.registerSprite();
}
@@ -12,15 +12,19 @@ package forestry.apiculture.entities;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
public class EntityFXBee extends EntityFX {
private final double originX;
private final double originZ;
public static TextureAtlasSprite beeSprite;
public EntityFXBee(World world, double x, double y, double z, int color) {
super(world, x, y, z, 0.0D, 0.0D, 0.0D);
setParticleIcon(beeSprite);
this.originX = x;
this.originZ = z;
@@ -104,7 +104,7 @@ public abstract class AlleleEffect extends AlleleCategorized implements IAlleleB
@Override
public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
Vec3 beeFXCoordinates = housing.getBeeFXCoordinates();
Proxies.render.addBeeHiveFX("particles/swarm_bee", housing.getWorld(), beeFXCoordinates.xCoord, beeFXCoordinates.yCoord, beeFXCoordinates.zCoord, genome.getPrimary().getSpriteColour(0));
Proxies.render.addBeeHiveFX(housing.getWorld(), beeFXCoordinates.xCoord, beeFXCoordinates.yCoord, beeFXCoordinates.zCoord, genome.getPrimary().getSpriteColour(0));
return storedData;
}
@@ -111,7 +111,8 @@ public enum EnumErrorCode implements IErrorState {
@SideOnly(Side.CLIENT)
@Override
public void registerSprite() {
texture = TextureManager.registerSprite("items/errors/" + iconName);
String location = "forestry:gui/errors/" + iconName;
texture = TextureManager.registerSprite(new ErrorAtlasSprite(location), location);
}
@SideOnly(Side.CLIENT)
@@ -0,0 +1,28 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.errors;
import java.awt.image.BufferedImage;
import java.io.IOException;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.data.AnimationMetadataSection;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ErrorAtlasSprite extends TextureAtlasSprite {
public ErrorAtlasSprite(String spriteName) {
super(spriteName);
}
}
@@ -14,6 +14,7 @@ import javax.annotation.Nullable;
import forestry.api.core.IErrorState;
import forestry.core.utils.StringUtil;
import net.minecraft.client.renderer.GlStateManager;
/**
* A ledger displaying error messages and help text.
@@ -109,7 +109,7 @@ public class ProxyRender {
/* FX */
public void addBeeHiveFX(String texture, World world, double x, double y, double z, int color) {
public void addBeeHiveFX(World world, double x, double y, double z, int color) {
}
public void addEntityHoneyDustFX(World world, double x, double y, double z) {
@@ -194,14 +194,12 @@ public class ProxyRenderClient extends ProxyRender {
}
@Override
public void addBeeHiveFX(String icon, World world, double x, double y, double z, int color) {
public void addBeeHiveFX(World world, double x, double y, double z, int color) {
if (!shouldSpawnParticle(world)) {
return;
}
EntityFX fx = new EntityFXBee(world, x, y, z, color);
TextureAtlasSprite sprite = TextureManager.getInstance().getDefault(icon);
fx.setParticleIcon(sprite);
ParticleRenderer.getInstance().addEffect(fx);
}
@@ -55,11 +55,11 @@ public class TextureManager implements ITextureManager {
"analyzer/anything", "analyzer/bee", "analyzer/cave", "analyzer/closed", "analyzer/drone", "analyzer/flyer",
"analyzer/item", "analyzer/nocturnal", "analyzer/princess", "analyzer/pure_breed", "analyzer/pure_cave",
"analyzer/pure_flyer", "analyzer/pure_nocturnal", "analyzer/queen",
"particles/swarm_bee", "errors/errored", "errors/unknown",
"errors/errored", "errors/unknown",
"slots/blocked", "slots/blocked_2", "slots/liquid", "slots/container", "slots/locked",
"mail/carrier.player", "mail/carrier.trader"};
for (String str : defaultIconNames) {
TextureAtlasSprite icon = registerSprite("items/" + str);
TextureAtlasSprite icon = registerSprite("gui/" + str);
defaultIcons.put(str, icon);
}
}
@@ -69,6 +69,12 @@ public class TextureManager implements ITextureManager {
return map.registerSprite(new ResourceLocation("forestry:" + identifier));
}
public static TextureAtlasSprite registerSprite(TextureAtlasSprite sprite, String identifier) {
TextureMap map = Proxies.common.getClientInstance().getTextureMapBlocks();
map.setTextureEntry(identifier, sprite);
return sprite;
}
public static TextureAtlasSprite getSprite(String modID, String identifier) {
TextureMap map = Proxies.common.getClientInstance().getTextureMapBlocks();
if (map.getAtlasSprite(new ResourceLocation(modID + ":" + identifier).toString()) == map.getMissingSprite()) {
@@ -67,7 +67,7 @@ public abstract class Trigger implements ITriggerExternal {
private TextureAtlasSprite icon;
@SideOnly(Side.CLIENT)
public void registerIcons() {
public void registerSprites() {
icon = TextureManager.registerSprite("triggers/" + unlocalized.replace("trigger.", ""));
}