Skip to content
This repository was archived by the owner on Nov 20, 2017. It is now read-only.

Commit

Permalink
small tweaking for 1.7 also some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Jadar committed Feb 19, 2014
1 parent f1afd59 commit b5b719f
Show file tree
Hide file tree
Showing 12 changed files with 193 additions and 216 deletions.
5 changes: 1 addition & 4 deletions 17-update.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
These are the things commented out of code for updating.

- tick handler
- tick registration
- player events
- convert packet system to netty.
- change from fluid to liquids
- update devcapes
-
- key events
2 changes: 0 additions & 2 deletions TO-DO list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ ToDo in update. (These are the stuff that we undid so we could start testing qui

-Make sure sounds played thru SoundManager work correctly
-Fix tower screen speed being weird depending on angle looked at.
-Clean up scanner block/renderer/tileentity code.
-ScannerPhysics
-xana attacks
-polymorphic specters
-infected mobs
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/net/cortexmodders/lyoko/CodeLyoko.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ public class CodeLyoko
public static CodeLyoko instance;//the instance of the mod that will be defined, populated, and callable

@EventHandler
public void preInit(FMLPreInitializationEvent preevt)
public void preInit(FMLPreInitializationEvent event)
{
Configuration config = new Configuration(preevt.getSuggestedConfigurationFile());
Configuration config = new Configuration(event.getSuggestedConfigurationFile());

proxy.registerBlockIds(config);
proxy.registerItemIds(config);
Expand All @@ -98,7 +98,7 @@ public void preInit(FMLPreInitializationEvent preevt)
}

@EventHandler
public void init(FMLInitializationEvent evt)
public void init(FMLInitializationEvent event)
{
//DevCapesUtil.addFileUrl("https://dl.dropboxusercontent.com/u/87762025/lyokocapes.txt");

Expand All @@ -124,6 +124,7 @@ public void init(FMLInitializationEvent evt)
proxy.addChestLoot();
proxy.registerTileEntities();
proxy.registerDimensions();
proxy.registerEventHandlers();

NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());

Expand All @@ -138,9 +139,9 @@ public void init(FMLInitializationEvent evt)
}

@EventHandler
public void postInit(FMLPostInitializationEvent postevt)
public void postInit(FMLPostInitializationEvent event)
{
proxy.registerEventHandlers();

}

@EventHandler
Expand Down
12 changes: 0 additions & 12 deletions src/main/java/net/cortexmodders/lyoko/blocks/ModBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,6 @@ public static void init()
DigitalSeaBlock = new BlockDigitalSea().setResistance(6000000F).setBlockUnbreakable().setBlockName("DigitalSeaBlock");
DigitalSeaLiquid = new BlockDigitalSeaLiquid(ModFluids.digitalSea, Material.water).setBlockName("DigitalSeaLiquid");

// Portal (Unused)
// LyokoPolarPortal = new
// BlockLyoko(BlockIds.LYOKO_ICE_PORTAL).setBlockName("PolarPortal").setCreativeTab(null);
// LyokoDesertPortal = new
// BlockLyoko(BlockIds.LYOKO_DESERT_PORTAL).setBlockName("DesertPortal").setCreativeTab(null);
// LyokoForestPortal = new
// BlockLyoko(BlockIds.LYOKO_FOREST_PORTAL).setBlockName("ForestPortal").setCreativeTab(null);
// LyokoMountainPortal = new
// BlockLyoko(BlockIds.LYOKO_MOUNTAIN_PORTAL).setBlockName("MountainPortal").setCreativeTab(null);
// LyokoCarthagePortal = new
// BlockLyoko(BlockIds.LYOKO_CARTHAGE_PORTAL).setBlockName("CarthagePortal").setCreativeTab(null);

registerBlocks();
registerLanguage();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@
import java.io.DataOutputStream;
import java.util.EnumSet;

import matt.lyoko.entities.vehicles.EntityVehicle;
import net.cortexmodders.lyoko.entities.vehicles.EntityVehicle;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.packet.Packet;
import cpw.mods.fml.client.registry.KeyBindingRegistry.KeyHandler;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.common.network.PacketDispatcher;
import net.minecraft.network.Packet;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent;

public class KeyBindingHandler extends KeyHandler
public class KeyBindingHandler
{
// static KeyBinding myBinding = new KeyBinding("COMING SOON",
// Keyboard.KEY_L);
Expand All @@ -32,56 +31,45 @@ public KeyBindingHandler()
// the first value is an array of KeyBindings, the second is whether or
// not the call
// keyDown should repeat as long as the key is down
super(new KeyBinding[] {});// new KeyBinding[]{myBinding}, new
//super(new KeyBinding[] {});// new KeyBinding[]{myBinding}, new
// boolean[]{false});
}

@Override
public String getLabel()
{
return "LyokoKeyBindingHandler";
}

@Override
public void keyDown(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat)
{
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
GameSettings settings = Minecraft.getMinecraft().gameSettings;
if (player != null && player.isRiding() && player.ridingEntity instanceof EntityVehicle)
{
EntityVehicle vehicle = (EntityVehicle) player.ridingEntity;
if (kb.getKeyCode() == settings.keyBindJump.getgetKeyCode()())
vehicle.motionY = 1.0D;
else if (kb.getKeyCode() == settings.keyBindSneak.getKeyCode())
vehicle.motionY = -1.0D;
else
vehicle.motionY = 0.0D;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream data = new DataOutputStream(bos);

try
{
data.writeInt(vehicle.getEntityId());
data.writeDouble(vehicle.motionY);
} catch (Exception e)
{
e.printStackTrace();
}
// @Override
// public String getLabel()
// {
// return "LyokoKeyBindingHandler";
// }

Packet packet = PacketDispatcher.getPacket("Vehicle", bos.toByteArray());
PacketDispatcher.sendPacketToServer(packet);
}
}

@Override
public void keyUp(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd)
@SubscribeEvent
public void keyDown(KeyInputEvent event)//EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat)
{
// EntityPlayer player = Minecraft.getMinecraft().thePlayer;
// GameSettings settings = Minecraft.getMinecraft().gameSettings;
// if (player != null && player.isRiding() && player.ridingEntity instanceof EntityVehicle)
// {
// EntityVehicle vehicle = (EntityVehicle) player.ridingEntity;
// if (kb.getKeyCode() == settings.keyBindJump.getgetKeyCode()())
// vehicle.motionY = 1.0D;
// else if (kb.getKeyCode() == settings.keyBindSneak.getKeyCode())
// vehicle.motionY = -1.0D;
// else
// vehicle.motionY = 0.0D;
// ByteArrayOutputStream bos = new ByteArrayOutputStream();
// DataOutputStream data = new DataOutputStream(bos);
//
// try
// {
// data.writeInt(vehicle.getEntityId());
// data.writeDouble(vehicle.motionY);
// } catch (Exception e)
// {
// e.printStackTrace();
// }

}

@Override
public EnumSet<TickType> ticks()
{
return EnumSet.of(TickType.CLIENT);
//TODO: upgrade to new packet system
// Packet packet = PacketDispatcher.getPacket("Vehicle", bos.toByteArray());
// PacketDispatcher.sendPacketToServer(packet);
// }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@

package net.cortexmodders.lyoko.handlers;

import ibxm.Player;

import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.util.EnumSet;

import net.cortexmodders.lyoko.CodeLyoko;
import net.cortexmodders.lyoko.entities.tileentity.TileEntityScanner;
Expand Down
15 changes: 8 additions & 7 deletions src/main/java/net/cortexmodders/lyoko/handlers/SoundHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

package net.cortexmodders.lyoko.handlers;

import java.util.logging.Level;

import net.cortexmodders.lyoko.lib.ModLogger;
import net.cortexmodders.lyoko.lib.ModProperties;
import net.minecraft.client.audio.SoundManager;
import net.minecraftforge.client.event.sound.SoundLoadEvent;
import net.minecraftforge.event.ForgeSubscribe;

import org.apache.logging.log4j.Level;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;

public class SoundHandler
{
Expand All @@ -23,7 +23,7 @@ public class SoundHandler
*
* @param event
*/
@ForgeSubscribe
@SubscribeEvent
public void onSoundLoad(SoundLoadEvent event)
{
this.loadSound(event.manager, "scannerClose.ogg");
Expand All @@ -40,11 +40,12 @@ public void loadSound(SoundManager manager, String file)
{
try
{
manager.addSound(ModProperties.SOUND_PREFIX + file);
//TODO: figure out new sound system
//manager. //(ModProperties.SOUND_PREFIX + file);
}
catch(Exception e)
{
ModLogger.log(Level.WARNING, "Error cannot load sound " + file);
ModLogger.log(Level.WARN, "Error cannot load sound " + file);
}
}
}
11 changes: 7 additions & 4 deletions src/main/java/net/cortexmodders/lyoko/items/ItemBlockEffect.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
import java.util.List;

import net.cortexmodders.lyoko.blocks.ModBlocks;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
Expand All @@ -22,16 +24,17 @@

public class ItemBlockEffect extends ItemBlock
{
public ItemBlockEffect(int par1)

public ItemBlockEffect(Block block)
{
super(par1);
super(block);
}

@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean B)
{
if (stack.itemID == ModBlocks.TowerBase.blockID)
if (stack.getItem() instanceof ModBlocks.)
{
list.add("hold shift when placing the block");
list.add("to be able to walk through it.");
Expand All @@ -42,7 +45,7 @@ public void addInformation(ItemStack stack, EntityPlayer player, List list, bool
@Override
public void onUpdate(ItemStack stack, World world, Entity ent, int par4, boolean par5)
{
if (stack.itemID == ModBlocks.LeadOre.blockID || stack.itemID == ModBlocks.UraniumOre.blockID)
if (stack.getItem() instanceof ModBlocks.LeadOre || stack.itemID == ModBlocks.UraniumOre.blockID)
{
if (ent instanceof EntityPlayer)
{
Expand Down
21 changes: 12 additions & 9 deletions src/main/java/net/cortexmodders/lyoko/lib/PlayerInformation.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.world.World;
import net.minecraftforge.common.IExtendedEntityProperties;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.network.Player;

public final class PlayerInformation implements IExtendedEntityProperties
{
Expand Down Expand Up @@ -173,6 +170,11 @@ public int getScannerPosZ()
return this.scannerPosZ;
}

public EntityPlayer getPlayer()
{
return this.player;
}

/*
* marks that this needs to be resend to the client
*/
Expand All @@ -188,11 +190,12 @@ public void setDirty()
ex.printStackTrace();
}

Packet250CustomPayload packet = new Packet250CustomPayload();
packet.channel = "LifePoints";
packet.data = bos.toByteArray();
packet.length = bos.size();

PacketDispatcher.sendPacketToPlayer(packet, (Player) player);
//TODO: update this to new packet system.
// Packet250CustomPayload packet = new Packet250CustomPayload();
// packet.channel = "LifePoints";
// packet.data = bos.toByteArray();
// packet.length = bos.size();
//
// PacketDispatcher.sendPacketToPlayer(packet, (Player) player);
}
}
Loading

0 comments on commit b5b719f

Please sign in to comment.