Skip to content

Commit

Permalink
1.7.10-0.3.4f
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuxelus committed Jun 18, 2023
1 parent c8b1524 commit 9014285
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 35 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ buildscript {

apply plugin: 'forge'

version = "1.7.10-0.3.4e"
version = "1.7.10-0.3.4f"
group= "com.zuxelus.energycontrol"
archivesBaseName = "EnergyControl"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.zuxelus.energycontrol.crossmod;

import ic2.api.energy.event.EnergyTileLoadEvent;
import ic2.api.energy.event.EnergyTileUnloadEvent;
import ic2.api.energy.tile.IEnergyTile;
import ic2.api.item.ICustomDamageItem;
import ic2.api.reactor.IReactor;
import ic2.api.reactor.IReactorChamber;
Expand All @@ -11,6 +14,7 @@
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;

public class IC2ReactorHelper {
Expand Down Expand Up @@ -84,4 +88,11 @@ public static ChunkCoordinates get5x5TargetCoordinates(World world, int x, int y
public static int euToSteam(int eu) {
return (int) Math.floor((eu) * STEAM_PER_EU);
}

public static void energyLoadEvent(TileEntity te, boolean isLoad) {
if (isLoad)
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent((IEnergyTile) te));
else
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent((IEnergyTile) te));
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.zuxelus.energycontrol.tileentities;

import com.zuxelus.energycontrol.crossmod.CrossModLoader;
import com.zuxelus.energycontrol.crossmod.IC2ReactorHelper;
import com.zuxelus.energycontrol.crossmod.ModIDs;
import com.zuxelus.energycontrol.init.ModItems;

import ic2.api.energy.event.EnergyTileLoadEvent;
import ic2.api.energy.event.EnergyTileUnloadEvent;
import ic2.api.info.Info;
import cpw.mods.fml.common.Loader;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
Expand Down Expand Up @@ -185,14 +184,12 @@ private void refreshData() {
capacity = output * 2;
tier = upgradeCountTransormer + 1;

if (Info.isIc2Available()) {
if (Loader.isModLoaded(ModIDs.IC2)) {
if (addedToEnet) {
EnergyTileUnloadEvent event = new EnergyTileUnloadEvent(this);
MinecraftForge.EVENT_BUS.post(event);
IC2ReactorHelper.energyLoadEvent(this, false);
}
addedToEnet = false;
EnergyTileLoadEvent event = new EnergyTileLoadEvent(this);
MinecraftForge.EVENT_BUS.post(event);
IC2ReactorHelper.energyLoadEvent(this, true);
addedToEnet = true;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.zuxelus.energycontrol.tileentities;

import com.zuxelus.energycontrol.crossmod.CrossModLoader;
import com.zuxelus.energycontrol.crossmod.IC2ReactorHelper;
import com.zuxelus.energycontrol.crossmod.ModIDs;
import com.zuxelus.energycontrol.init.ModItems;

import ic2.api.energy.event.EnergyTileLoadEvent;
import ic2.api.energy.event.EnergyTileUnloadEvent;
import ic2.api.info.Info;
import cpw.mods.fml.common.Loader;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
Expand Down Expand Up @@ -127,14 +126,12 @@ private void refreshData() {
capacity = output * 2;
tier = upgradeCountTransormer + 1;

if (Info.isIc2Available() ) {
if (Loader.isModLoaded(ModIDs.IC2)) {
if (addedToEnet) {
EnergyTileUnloadEvent event = new EnergyTileUnloadEvent(this);
MinecraftForge.EVENT_BUS.post(event);
IC2ReactorHelper.energyLoadEvent(this, false);
}
addedToEnet = false;
EnergyTileLoadEvent event = new EnergyTileLoadEvent(this);
MinecraftForge.EVENT_BUS.post(event);
IC2ReactorHelper.energyLoadEvent(this, true);
addedToEnet = true;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
package com.zuxelus.energycontrol.tileentities;

import com.zuxelus.energycontrol.crossmod.IC2ReactorHelper;
import com.zuxelus.energycontrol.crossmod.ModIDs;
import com.zuxelus.zlib.containers.slots.ISlotItemFilter;
import com.zuxelus.zlib.tileentities.ITilePacketHandler;
import com.zuxelus.zlib.tileentities.TileEntityInventory;

import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Optional;
import ic2.api.energy.event.EnergyTileLoadEvent;
import ic2.api.energy.event.EnergyTileUnloadEvent;
import ic2.api.energy.tile.IEnergyAcceptor;
import ic2.api.energy.tile.IEnergyEmitter;
import ic2.api.energy.tile.IEnergySink;
import ic2.api.energy.tile.IEnergySource;
import ic2.api.info.Info;
import ic2.api.item.ElectricItem;
import ic2.api.item.IElectricItem;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;

@Optional.InterfaceList({
Expand Down Expand Up @@ -77,8 +72,8 @@ protected NBTTagCompound writeProperties(NBTTagCompound tag) {
}

public void onLoad() {
if (!addedToEnet && worldObj != null && !worldObj.isRemote && Info.isIc2Available()) {
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
if (!addedToEnet && worldObj != null && !worldObj.isRemote && Loader.isModLoaded(ModIDs.IC2)) {
IC2ReactorHelper.energyLoadEvent(this, true);
addedToEnet = true;
}
}
Expand All @@ -91,8 +86,8 @@ public void invalidate() {

@Override
public void onChunkUnload() {
if (addedToEnet && worldObj != null && !worldObj.isRemote && Info.isIc2Available()) {
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
if (addedToEnet && worldObj != null && !worldObj.isRemote && Loader.isModLoaded(ModIDs.IC2)) {
IC2ReactorHelper.energyLoadEvent(this, false);
addedToEnet = false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.zuxelus.energycontrol.blocks.KitAssembler;
import com.zuxelus.energycontrol.crossmod.CrossModLoader;
import com.zuxelus.energycontrol.crossmod.IC2ReactorHelper;
import com.zuxelus.energycontrol.crossmod.ModIDs;
import com.zuxelus.energycontrol.init.ModItems;
import com.zuxelus.energycontrol.items.cards.ItemCardMain;
Expand All @@ -16,10 +17,7 @@
import cofh.api.energy.IEnergyReceiver;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Optional;
import ic2.api.energy.event.EnergyTileLoadEvent;
import ic2.api.energy.event.EnergyTileUnloadEvent;
import ic2.api.energy.tile.IEnergySink;
import ic2.api.info.Info;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
Expand Down Expand Up @@ -172,8 +170,8 @@ public void writeToNBT(NBTTagCompound tag) {

@Optional.Method(modid = ModIDs.IC2)
public void onLoad() {
if (!addedToEnet && !worldObj.isRemote && Info.isIc2Available()) {
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
if (!addedToEnet && !worldObj.isRemote && Loader.isModLoaded(ModIDs.IC2)) {
IC2ReactorHelper.energyLoadEvent(this, true);
addedToEnet = true;
updateActive();
}
Expand All @@ -188,8 +186,8 @@ public void invalidate() {
@Override
@Optional.Method(modid = ModIDs.IC2)
public void onChunkUnload() {
if (addedToEnet && !worldObj.isRemote && Info.isIc2Available()) {
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
if (addedToEnet && !worldObj.isRemote && Loader.isModLoaded(ModIDs.IC2)) {
IC2ReactorHelper.energyLoadEvent(this, false);
addedToEnet = false;
}
isLoaded = false; // HBM only
Expand Down

0 comments on commit 9014285

Please sign in to comment.