Skip to content

Commit

Permalink
Merge pull request #28 from GTNewHorizons/optional-gt-machine-support
Browse files Browse the repository at this point in the history
Optionally support GT machine blocks
  • Loading branch information
Dream-Master authored Apr 10, 2023
2 parents 4d2ed91 + d300657 commit dcf862a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,7 @@ dependencies {
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.0.34:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.42.48:dev") {
transitive = false
}
}
19 changes: 19 additions & 0 deletions src/main/java/fox/spiteful/avaritia/blocks/BlockResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import fox.spiteful.avaritia.Avaritia;
import gregtech.api.GregTech_API;

public class BlockResource extends Block {

Expand Down Expand Up @@ -62,4 +65,20 @@ public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beac
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) {
return false;
}

@Override
@Optional.Method(modid = "gregtech")
public void onBlockAdded(World aWorld, int aX, int aY, int aZ) {
if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) {
GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
}
}

@Override
@Optional.Method(modid = "gregtech")
public void breakBlock(World aWorld, int aX, int aY, int aZ, Block aBlock, int aMetaData) {
if (GregTech_API.isMachineBlock(this, aMetaData)) {
GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
}
}
}

0 comments on commit dcf862a

Please sign in to comment.