Merge pull request #10 from anonymouspineapple/patch-11

Updated Chinese calcinators
This commit is contained in:
Lure 2012-12-09 17:28:34 -08:00
commit 75bc6d5b3c
11 changed files with 287 additions and 103 deletions

View file

@ -9,6 +9,7 @@ import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.KeyBindingRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.common.registry.TickRegistry;
import ee3.client.core.handlers.DrawBlockHighlightHandler;
@ -24,6 +25,8 @@ import ee3.common.core.CommonProxy;
import ee3.common.lib.BlockIds;
import ee3.common.lib.RenderIds;
import ee3.common.lib.Sprites;
import ee3.common.network.PacketTypeHandler;
import ee3.common.network.PacketWorldEvent;
import ee3.common.tile.TileCalcinator;
import static ee3.common.lib.CustomItemRarity.*;
@ -113,4 +116,10 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileCalcinator.class, new RenderCalcinator());
}
@Override
public void sendWorldEventPacket(byte eventType, int originX, int originY, int originZ, byte sideHit, byte rangeX, byte rangeY, byte rangeZ, String data) {
PacketDispatcher.sendPacketToServer(PacketTypeHandler.populatePacket(new PacketWorldEvent(eventType, originX, originY, originZ, sideHit, rangeX, rangeY, rangeZ, data)));
}
}

View file

@ -16,6 +16,9 @@ import net.minecraftforge.event.ForgeSubscribe;
public class DrawBlockHighlightHandler {
private static int pulse = 0;
private static boolean doInc = true;
@ForgeSubscribe
public void onDrawBlockHighlightEvent(DrawBlockHighlightEvent event) {
@ -40,66 +43,69 @@ public class DrawBlockHighlightHandler {
double iPZ = event.player.prevPosZ + (event.player.posZ - event.player.prevPosZ) * event.partialTicks;
int texture = event.context.renderEngine.getTexture(Sprites.SPRITE_SHEET_LOCATION + Sprites.WORLD_TRANSMUTATION_TEXTURE);
int xScale = 1;
int yScale = 1;
int zScale = 1;
float xScale = 1;
float yScale = 1;
float zScale = 1;
float xShift = 0.1F;
float yShift = 0.1F;
float zShift = 0.1F;
int chargeLevel;
int itemChargeLevel = 0;
if (event.currentItem.getItem() instanceof IChargeable) {
itemChargeLevel = ((IChargeable) event.currentItem.getItem()).getCharge(event.currentItem);
}
chargeLevel = 1 + itemChargeLevel * 2;
if ((event.target.sideHit == 0) || (event.target.sideHit == 1)) {
xScale = chargeLevel;
zScale = chargeLevel;
}
else if ((event.target.sideHit == 2) || (event.target.sideHit == 3)) {
xScale = chargeLevel;
yScale = chargeLevel;
}
else if ((event.target.sideHit == 4) || (event.target.sideHit == 5)) {
yScale = chargeLevel;
zScale = chargeLevel;
}
ForgeDirection sideHit = ForgeDirection.getOrientation(event.target.sideHit);
float xShift = 0.1F;
float yShift = 0.1F;
float zShift = 0.1F;
if (event.target.sideHit == 0) {
switch (sideHit) {
case UP: {
xScale = chargeLevel + 0.1F;
zScale = chargeLevel + 0.1F;
xShift = 0;
zShift = 0;
break;
}
case DOWN: {
xScale = chargeLevel + 0.1F;
zScale = chargeLevel + 0.1F;
xShift = 0;
yShift = -yShift;
zShift = 0;
break;
}
else if (event.target.sideHit == 1) {
xShift = 0;
zShift = 0;
}
else if (event.target.sideHit == 2) {
case NORTH: {
xScale = chargeLevel + 0.1F;
yScale = chargeLevel + 0.1F;
xShift = 0;
yShift = 0;
if (chargeLevel > 1) {
zShift = -zShift - 1;
}
else {
zShift = -zShift;
break;
}
}
else if (event.target.sideHit == 3) {
case SOUTH: {
xScale = chargeLevel + 0.1F;
yScale = chargeLevel + 0.1F;
xShift = 0;
yShift = 0;
break;
}
else if (event.target.sideHit == 4) {
case EAST: {
yScale = chargeLevel + 0.1F;
zScale = chargeLevel + 0.1F;
yShift = 0;
zShift = 0;
break;
}
case WEST: {
yScale = chargeLevel + 0.1F;
zScale = chargeLevel + 0.1F;
xShift = -xShift;
yShift = 0;
zShift = 0;
break;
}
else if (event.target.sideHit == 5) {
yShift = 0;
zShift = 0;
default: break;
}
GL11.glDepthMask(false);
@ -107,13 +113,14 @@ public class DrawBlockHighlightHandler {
for (int i = 0; i < 6; i++) {
ForgeDirection forgeDir = ForgeDirection.getOrientation(i);
int zCorrection = (i == 2) ? -1 : 1;
GL11.glPushMatrix();
GL11.glTranslated(-iPX + x + xShift, -iPY + y + yShift, -iPZ + z + zShift);
GL11.glScalef(1F * xScale, 1F * yScale, 1F * zScale);
GL11.glRotatef(90, forgeDir.offsetX, forgeDir.offsetY, forgeDir.offsetZ);
GL11.glTranslated(0, 0, 0.5f);
GL11.glTranslated(0, 0, 0.5f * zCorrection);
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
renderSlidingQuad(texture, 0.75F);
renderPulsingQuad(texture, 0.75F);
GL11.glPopMatrix();
}
@ -121,9 +128,8 @@ public class DrawBlockHighlightHandler {
GL11.glDepthMask(true);
}
public static void renderSlidingQuad(int texture, float transparency) {
float pulse = (System.currentTimeMillis() % 3000) / 3000f;
public static void renderPulsingQuad(int texture, float maxTransparency) {
float pulseTransparency = (getPulseValue() * maxTransparency) / 3000f;
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
Tessellator tessellator = Tessellator.instance;
@ -131,10 +137,10 @@ public class DrawBlockHighlightHandler {
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(1, 1, 1, pulse);
GL11.glColor4f(1, 1, 1, pulseTransparency);
tessellator.startDrawingQuads();
tessellator.setColorRGBA_F(1, 1, 1, pulse);
tessellator.setColorRGBA_F(1, 1, 1, pulseTransparency);
tessellator.addVertexWithUV(-0.5D, 0.5D, 0F, 0, 1);
tessellator.addVertexWithUV(0.5D, 0.5D, 0F, 1, 1);
@ -146,4 +152,24 @@ public class DrawBlockHighlightHandler {
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
}
private static int getPulseValue() {
if (doInc) {
pulse += 8;
}
else {
pulse -= 8;
}
if (pulse == 3000) {
doInc = false;
}
if (pulse == 0) {
doInc = true;
}
return pulse;
}
}

View file

@ -65,9 +65,9 @@ public class RenderTickHandler implements ITickHandler {
private static void renderStoneHUD(Minecraft minecraft, EntityPlayer player, ItemStack stack, float partialTicks) {
float overlayScale = 2F; // TODO config option
float overlayScale = 2F;
float blockScale = overlayScale / 2;
float overlayOpacity = 1F; // TODO config option
float overlayOpacity = 0.5F;
MovingObjectPosition rayTrace = minecraft.objectMouseOver;
ItemStack currentBlock = null;
@ -92,9 +92,15 @@ public class RenderTickHandler implements ITickHandler {
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
GL11.glEnable(GL11.GL_LIGHTING);
RenderUtils.renderItemIntoGUI(minecraft.fontRenderer, minecraft.renderEngine, stack, (int) (sr.getScaledWidth() - (16 * overlayScale)), (int) (sr.getScaledHeight() - (16 * overlayScale)), overlayOpacity / 2, overlayScale);
int hudOverlayX = (int) (sr.getScaledWidth() - (16 * overlayScale));
int hudOverlayY = (int) (sr.getScaledHeight() - (16 * overlayScale));
int hudBlockX = (int) (sr.getScaledWidth() - (16 * overlayScale) / 2 - 8);
int hudBlockY = (int) (sr.getScaledHeight() - (16 * overlayScale) / 2 - 8);
RenderUtils.renderItemIntoGUI(minecraft.fontRenderer, minecraft.renderEngine, stack, hudOverlayX, hudOverlayY, overlayOpacity, overlayScale);
if ((currentBlock != null) && (currentBlock.getItem() instanceof ItemBlock)) {
RenderUtils.renderRotatingBlockIntoGUI(minecraft.fontRenderer, minecraft.renderEngine, currentBlock, (int) (sr.getScaledWidth() - (16 * overlayScale) / 2 - 8), (int) (sr.getScaledHeight() - (16 * overlayScale) / 2 - 8), -90, blockScale);
RenderUtils.renderRotatingBlockIntoGUI(minecraft.fontRenderer, minecraft.renderEngine, currentBlock, hudBlockX, hudBlockY, -90, blockScale);
}
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glPopMatrix();

View file

@ -25,35 +25,56 @@ import ee3.common.tile.TileCalcinator;
*/
public class CommonProxy implements IGuiHandler {
public void registerKeyBindingHandler() {}
public void registerKeyBindingHandler() {
public void registerRenderTickHandler() {}
}
public void registerDrawBlockHighlightHandler() {}
public void registerRenderTickHandler() {
public void setKeyBinding(String name, int value) {}
}
public void registerSoundHandler() {}
public void registerDrawBlockHighlightHandler() {
public void initCustomRarityTypes() {}
}
public void setKeyBinding(String name, int value) {
}
public void registerSoundHandler() {
}
public void initCustomRarityTypes() {
}
public EnumRarity getCustomRarityType(String customRarity) {
return null;
}
public void initRenderingAndTextures() {}
public void initRenderingAndTextures() {
}
public void initTileEntities() {
GameRegistry.registerTileEntity(TileCalcinator.class, Strings.TE_CALCINATOR_NAME);
}
public void sendWorldEventPacket(byte eventType, int originX, int originY, int originZ, byte sideHit, byte rangeX, byte rangeY, byte rangeZ, String data) {
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
if (ID == GuiIds.PORTABLE_CRAFTING) {
return new ContainerPortableCrafting(player.inventory, world, x, y, z);
}
else if (ID == GuiIds.CALCINATOR) {
TileCalcinator calcinator = (TileCalcinator)world.getBlockTileEntity(x, y, z);
TileCalcinator calcinator = (TileCalcinator) world.getBlockTileEntity(x, y, z);
return new ContainerCalcinator(player.inventory, calcinator);
}
@ -62,11 +83,12 @@ public class CommonProxy implements IGuiHandler {
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
if (ID == GuiIds.PORTABLE_CRAFTING) {
return new GuiPortableCrafting(player, world, x, y, z);
}
else if (ID == GuiIds.CALCINATOR) {
TileCalcinator calcinator = (TileCalcinator)world.getBlockTileEntity(x, y, z);
TileCalcinator calcinator = (TileCalcinator) world.getBlockTileEntity(x, y, z);
return new GuiCalcinator(player.inventory, calcinator);
}

View file

@ -67,7 +67,7 @@ public class ItemMiniumStone extends ItemEE
}
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z, int l, float f1, float f2, float f3) {
public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z, int sideHit, float hitVecX, float hitVecY, float hitVecZ) {
boolean result = TransmutationHelper.transmuteInWorld(world, entityPlayer, itemStack, x, y, z);

View file

@ -3,7 +3,6 @@ package ee3.common.item;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import cpw.mods.fml.common.network.PacketDispatcher;
import ee3.common.EquivalentExchange3;
import ee3.common.core.helper.NBTHelper;
import ee3.common.core.helper.TransmutationHelper;
@ -13,8 +12,10 @@ import ee3.common.lib.GuiIds;
import ee3.common.lib.Reference;
import ee3.common.lib.Sounds;
import ee3.common.lib.Strings;
import ee3.common.lib.WorldEvents;
import ee3.common.network.PacketKeyPressed;
import ee3.common.network.PacketTypeHandler;
import ee3.common.network.PacketWorldEvent;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.EnumRarity;
import net.minecraft.src.ItemStack;
@ -77,14 +78,18 @@ public class ItemPhilosopherStone extends ItemEE
}
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z, int l, float f1, float f2, float f3) {
boolean result = TransmutationHelper.transmuteInWorld(world, entityPlayer, itemStack, x, y, z);
public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z, int sideHit, float hitVecX, float hitVecY, float hitVecZ) {
//boolean result = TransmutationHelper.transmuteInWorld(world, entityPlayer, itemStack, x, y, z);
boolean result = true;
if (!world.isRemote) {
EquivalentExchange3.proxy.sendWorldEventPacket(WorldEvents.TRANSMUTATION, x, y, z, (byte)sideHit, (byte)getCharge(itemStack), (byte)getCharge(itemStack), (byte)getCharge(itemStack), "50:0");
}
/*
if (result) {
itemStack.damageItem(1, entityPlayer);
}
*/
return result;
}

View file

@ -0,0 +1,8 @@
package ee3.common.lib;
public class WorldEvents {
public static final byte TRANSMUTATION = 0;
}

View file

@ -20,7 +20,7 @@ import net.minecraft.src.Packet250CustomPayload;
public enum PacketTypeHandler {
KEY(PacketKeyPressed.class),
TILE(PacketTileUpdate.class),
WORLD_TRANSMUTATION(PacketWorldTransmutation.class);
WORLD_EVENT(PacketWorldEvent.class);
private Class<? extends PacketEE> clazz;

View file

@ -0,0 +1,122 @@
package ee3.common.network;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.INetworkManager;
import net.minecraft.src.World;
import cpw.mods.fml.common.network.Player;
public class PacketWorldEvent extends PacketEE {
public byte eventType;
public int originX, originY, originZ;
public byte sideHit;
public byte rangeX, rangeY, rangeZ;
public String data;
public PacketWorldEvent() {
super(PacketTypeHandler.WORLD_EVENT, false);
}
public PacketWorldEvent(byte eventType, int originX, int originY, int originZ, byte sideHit, byte rangeX, byte rangeY, byte rangeZ, String data) {
super(PacketTypeHandler.WORLD_EVENT, false);
this.eventType = eventType;
this.originX = originX;
this.originY = originY;
this.originZ = originZ;
this.sideHit = sideHit;
this.rangeX = rangeX;
this.rangeY = rangeY;
this.rangeZ = rangeZ;
this.data = data;
}
public void setEventType(byte eventType) {
this.eventType = eventType;
}
public void setOrigin(int originX, int originY, int originZ) {
this.originX = originX;
this.originY = originY;
this.originZ = originZ;
}
public void setSideHit(byte sideHit) {
this.sideHit = sideHit;
}
public void setRange(byte rangeX, byte rangeY, byte rangeZ) {
this.rangeX = rangeX;
this.rangeY = rangeY;
this.rangeZ = rangeZ;
}
public void setData(String data) {
this.data = data;
}
public void writeData(DataOutputStream data) throws IOException {
data.writeByte(eventType);
data.writeInt(originX);
data.writeInt(originY);
data.writeInt(originZ);
data.writeByte(sideHit);
data.writeByte(rangeX);
data.writeByte(rangeY);
data.writeByte(rangeZ);
data.writeUTF(this.data);
}
public void readData(DataInputStream data) throws IOException {
this.eventType = data.readByte();
this.originX = data.readInt();
this.originY = data.readInt();
this.originZ = data.readInt();
this.sideHit = data.readByte();
this.rangeX = data.readByte();
this.rangeY = data.readByte();
this.rangeZ = data.readByte();
this.data = data.readUTF();
}
public void execute(INetworkManager manager, Player player) {
System.out.println("World Event Packet received");
System.out.println("eventType: " + eventType);
System.out.println("originX: " + originX);
System.out.println("originY: " + originY);
System.out.println("originZ: " + originZ);
System.out.println("sideHit: " + sideHit);
System.out.println("rangeX: " + rangeX);
System.out.println("rangeY: " + rangeY);
System.out.println("rangeZ: " + rangeZ);
System.out.println("data: " + data);
EntityPlayer thePlayer = (EntityPlayer) player;
World world = thePlayer.worldObj;
/*
* Server knows the world, the player, and all the packet data
* Server checks (for each block);
* 1) If the action on that block is allowed for the player
* 2) If the action is a valid action
*
* AoE options are; 1x1, 3x3, 5x5, and 7x7
* Charge options; 0, 1, 2, 3
* so Range would be 1, 2, 4, 6
* 1 + 0, 1 + 1, 1 + 3, 1 + 5
*/
}
}

View file

@ -1,14 +0,0 @@
package ee3.common.network;
public class PacketWorldTransmutation extends PacketEE {
public int originX, originY, originZ;
public int rangeX, rangeY, rangeZ;
public int targetID, targetMeta;
public PacketWorldTransmutation() {
super(PacketTypeHandler.TILE, true);
}
}

View file

@ -12,8 +12,6 @@
<entry key="item.philStone.name">圣人石</entry>
<entry key="tile.redWaterStill.name">红水 (静止)</entry>
<entry key="tile.redWaterFlowing.name">红水 (流动)</entry>
<entry key="tile.calcinator.name">煅烧炉</entry>
<entry key="gui.calcinator.name">煅烧炉</entry>
<entry key="item.alchemyDust.ash.name"></entry>
<entry key="item.alchemyDust.minium.name">铅丹灰</entry>
<entry key="item.alchemyDust.verdant.name">玉灰</entry>
@ -36,6 +34,8 @@
<entry key="item.alchemyBag.green.name">绿色魔力包</entry>
<entry key="item.alchemyBag.red.name">红色魔力包</entry>
<entry key="item.alchemyBag.black.name">黑色魔力包</entry>
<entry key="tile.calcinator.name">煆烧炉</entry>
<entry key="gui.calcinator.name">煆烧炉</entry>
<entry key="itemGroup.EE3">Equivalent Exchange 3</entry>
<entry key="version.init_log_message">Initializing version check against the remote version authority file, located at</entry>
<entry key="version.uninitialized">The version check did not complete successfully (version check did not initialize properly)</entry>