use of cpw.mods.fml.common.eventhandler.SubscribeEvent in project BluePower by Qmunity.
the class IconSupplier method onTextureStitch.
@SubscribeEvent
public void onTextureStitch(TextureStitchEvent.Pre event) {
TextureMap reg = event.map;
if (reg.getTextureType() == 0) {
pneumaticTubeSide = reg.registerIcon(Refs.MODID + ":tubes/pneumatic_tube_side");
pneumaticTubeGlass = reg.registerIcon(Refs.MODID + ":tubes/glass");
pneumaticTubeGlass2 = reg.registerIcon(Refs.MODID + ":tubes/glass2");
pneumaticTubeOpaqueSide = reg.registerIcon(Refs.MODID + ":tubes/pneumatic_tube_side_opaque");
pneumaticTubeOpaqueNode = reg.registerIcon(Refs.MODID + ":tubes/pneumatic_tube_end_opaque");
restrictionTubeSide = reg.registerIcon(Refs.MODID + ":tubes/restriction_tube_side");
restrictionTubeNodeOpaque = reg.registerIcon(Refs.MODID + ":tubes/restriction_tube_end_opaque");
restrictionTubeSideOpaque = reg.registerIcon(Refs.MODID + ":tubes/restriction_tube_side_opaque");
magTubeSide = reg.registerIcon(Refs.MODID + ":tubes/mag_side");
magCoilSide = reg.registerIcon(Refs.MODID + ":tubes/mag_casing");
magCoilFront = reg.registerIcon(Refs.MODID + ":tubes/mag_casing_end");
magTubeGlass = reg.registerIcon(Refs.MODID + ":tubes/glass_reinforced");
magTubeGlass2 = reg.registerIcon(Refs.MODID + ":tubes/glass_reinforced2");
acceleratorFront = reg.registerIcon(Refs.MODID + ":machines/accelerator_front");
acceleratorFrontPowered = reg.registerIcon(Refs.MODID + ":machines/accelerator_front_powered");
acceleratorSide = reg.registerIcon(Refs.MODID + ":machines/accelerator_side");
acceleratorSidePowered = reg.registerIcon(Refs.MODID + ":machines/accelerator_side_powered");
acceleratorInside = reg.registerIcon(Refs.MODID + ":machines/accelerator_inside");
pneumaticTubeColoring = reg.registerIcon(Refs.MODID + ":tubes/coloring");
cagedLampFootSide = reg.registerIcon(Refs.MODID + ":lamps/cage_foot_side");
cagedLampFootTop = reg.registerIcon(Refs.MODID + ":lamps/cage_foot_top");
cagedLampCageSide = reg.registerIcon(Refs.MODID + ":lamps/cage");
cagedLampCageTop = reg.registerIcon(Refs.MODID + ":lamps/cage_top");
cagedLampLampActive = reg.registerIcon(Refs.MODID + ":lamps/cage_lamp_on");
cagedLampLampInactive = reg.registerIcon(Refs.MODID + ":lamps/cage_lamp_off");
cagedLampLampActiveTop = reg.registerIcon(Refs.MODID + ":lamps/cage_lamp_on_top");
cagedLampLampInactiveTop = reg.registerIcon(Refs.MODID + ":lamps/cage_lamp_off_top");
fixtureFootSide = reg.registerIcon(Refs.MODID + ":lamps/fixture_foot_side");
fixtureFootTop = reg.registerIcon(Refs.MODID + ":lamps/fixture_foot_top");
fixtureLampSideOn = reg.registerIcon(Refs.MODID + ":lamps/fixture_lamp_on");
fixtureLampTopOn = reg.registerIcon(Refs.MODID + ":lamps/fixture_lamp_on_top");
fixtureLampSideOff = reg.registerIcon(Refs.MODID + ":lamps/fixture_lamp_off");
fixtureLampTopOff = reg.registerIcon(Refs.MODID + ":lamps/fixture_lamp_off_top");
lampOn = reg.registerIcon(Refs.MODID + ":lamps/lamp_off");
lampOff = reg.registerIcon(Refs.MODID + ":lamps/lamp_on");
bluestoneTorchOff = reg.registerIcon(Refs.MODID + ":bluestone_torch_off");
bluestoneTorchOn = reg.registerIcon(Refs.MODID + ":bluestone_torch_on");
wire = reg.registerIcon(Refs.MODID + ":wire/wire");
wireInsulation1 = reg.registerIcon(Refs.MODID + ":wire/insulation1");
wireInsulation2 = reg.registerIcon(Refs.MODID + ":wire/insulation2");
wireBundledConnection = reg.registerIcon(Refs.MODID + ":wire/bundled_connection");
wireBundledCross = reg.registerIcon(Refs.MODID + ":wire/bundled_cross");
wireBundledStraight1 = reg.registerIcon(Refs.MODID + ":wire/bundled_straight_1");
wireBundledStraight2 = reg.registerIcon(Refs.MODID + ":wire/bundled_straight_2");
wireBundledSide1 = reg.registerIcon(Refs.MODID + ":wire/bundled_side_1");
wireBundledSide2 = reg.registerIcon(Refs.MODID + ":wire/bundled_side_2");
gateButton = reg.registerIcon(Refs.MODID + ":gates/components/button");
siliconChipOff = reg.registerIcon(Refs.MODID + ":gates/components/silicon_chip_off");
siliconChipOn = reg.registerIcon(Refs.MODID + ":gates/components/silicon_chip_on");
taintedSiliconChipOff = reg.registerIcon(Refs.MODID + ":gates/components/tainted_silicon_chip_off");
taintedSiliconChipOn = reg.registerIcon(Refs.MODID + ":gates/components/tainted_silicon_chip_on");
quartzResonator = reg.registerIcon(Refs.MODID + ":gates/components/resonator");
gateSolarPanel = reg.registerIcon(Refs.MODID + ":gates/components/solarpanel");
for (PartInfo i : PartManager.getRegisteredParts()) i.getExample().registerIcons(reg);
}
}
use of cpw.mods.fml.common.eventhandler.SubscribeEvent in project Engine by VoltzEngine-Project.
the class ClientProxy method clientUpdate.
@SubscribeEvent
public void clientUpdate(TickEvent.WorldTickEvent event) {
if (///TODO reduce check to every 10 ticks
Engine.enableExtendedMetaPacketSync) {
try {
if (event.side == Side.CLIENT) {
Minecraft mc = Minecraft.getMinecraft();
if (mc != null) {
EntityPlayer player = mc.thePlayer;
World world = mc.theWorld;
if (player != null && world != null) {
if (ExtendedBlockDataManager.CLIENT.dimID != world.provider.dimensionId) {
ExtendedBlockDataManager.CLIENT.clear();
ExtendedBlockDataManager.CLIENT.dimID = world.provider.dimensionId;
}
int renderDistance = mc.gameSettings.renderDistanceChunks + 2;
int centerX = ((int) Math.floor(player.posX)) >> 4;
int centerZ = ((int) Math.floor(player.posZ)) >> 4;
//Clear out chunks outside of render distance
List<ChunkData> chunksToRemove = new ArrayList();
for (ChunkData data : ExtendedBlockDataManager.CLIENT.chunks.values()) {
if (Math.abs(data.position.chunkXPos - centerX) > renderDistance || Math.abs(data.position.chunkZPos - centerZ) > renderDistance) {
chunksToRemove.add(data);
}
}
for (ChunkData data : chunksToRemove) {
ExtendedBlockDataManager.CLIENT.chunks.remove(data.position);
}
renderDistance = mc.gameSettings.renderDistanceChunks;
for (int x = centerX - renderDistance; x < centerX + renderDistance; x++) {
for (int z = centerZ - renderDistance; z < centerZ + renderDistance; z++) {
ChunkData chunkData = ExtendedBlockDataManager.CLIENT.getChunk(x, z);
if (chunkData == null) {
Engine.instance.packetHandler.sendToServer(new PacketRequestData(world.provider.dimensionId, x, z, 0));
}
}
}
}
}
}
} catch (Exception e) {
Engine.logger().error("Unexpected error while updating client chunk data state", e);
}
}
}
use of cpw.mods.fml.common.eventhandler.SubscribeEvent in project Engine by VoltzEngine-Project.
the class ChunkMap method onChunkLoaded.
@SubscribeEvent
public void onChunkLoaded(ChunkEvent.Load event) {
Chunk chunk = event.getChunk();
ChunkCoordIntPair coords = chunk.getChunkCoordIntPair();
if (chunks.containsKey(coords)) {
//TODO load data into existing object
} else {
//TODO load object
}
}
use of cpw.mods.fml.common.eventhandler.SubscribeEvent in project Minechem by iopleke.
the class AugmentLight method onBlockHarvest.
@SubscribeEvent
public void onBlockHarvest(BlockEvent.HarvestDropsEvent event) {
if (event.harvester != null) {
ItemStack stack = event.harvester.getHeldItem();
if (stack != null && stack.getItem() instanceof IAugmentedItem) {
IAugmentedItem augmentedItem = (IAugmentedItem) stack.getItem();
int level = augmentedItem.getAugmentLevel(stack, this);
if (level > -1 && event.world.getBlockLightValue(event.x, event.y, event.z) < 8) {
consumeAugment(stack, level);
event.world.setBlock(event.x, event.y, event.z, BlockRegistry.blockLight, level, 3);
}
}
}
}
use of cpw.mods.fml.common.eventhandler.SubscribeEvent in project Trains-In-Motion-1.7.10 by EternalBlueFlame.
the class EventManager method onClientKeyPress.
/**
* <h2>Keybind management</h2>
* called when a client presses a key. this coveres pretty much everything.
* Most cases just send a packet to manage things
* @see PacketKeyPress
*
* Credit to Ferdinand for help with this function.
*
* @param event the event of a key being pressed on client.
*/
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onClientKeyPress(InputEvent.KeyInputEvent event) {
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
if (player.ridingEntity instanceof GenericRailTransport || player.ridingEntity instanceof EntitySeat) {
//for lamp
if (ClientProxy.KeyLamp.isPressed()) {
TrainsInMotion.keyChannel.sendToServer(new PacketKeyPress(0, player.ridingEntity.getEntityId()));
((GenericRailTransport) player.ridingEntity).setBoolean(GenericRailTransport.boolValues.LAMP, !((GenericRailTransport) player.ridingEntity).getBoolean(GenericRailTransport.boolValues.LAMP));
}
//for inventory
if (ClientProxy.KeyInventory.isPressed()) {
TrainsInMotion.keyChannel.sendToServer(new PacketKeyPress(1, player.ridingEntity.getEntityId()));
}
if (player.ridingEntity instanceof EntityTrainCore) {
//for speed change
if (ClientProxy.KeyAccelerate.isPressed()) {
TrainsInMotion.keyChannel.sendToServer(new PacketKeyPress(2, player.ridingEntity.getEntityId()));
} else if (ClientProxy.KeyReverse.getIsKeyPressed()) {
TrainsInMotion.keyChannel.sendToServer(new PacketKeyPress(3, player.ridingEntity.getEntityId()));
} else if (ClientProxy.KeyHorn.isPressed()) {
TrainsInMotion.keyChannel.sendToServer(new PacketKeyPress(4, player.ridingEntity.getEntityId()));
}
}
}
}
Aggregations