Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FramezAPI usage #21

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions ModInteract/DeepInteract/FrameBlacklist.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
import Reika.DragonAPI.ASM.APIStripper.Strippable;
import Reika.DragonAPI.ASM.DependentMethodStripper.SmartStrip;

import com.amadornes.framez.api.FramezApi;
import com.amadornes.framez.api.movement.BlockMovementType;
import com.amadornes.framez.api.movement.HandlingPriority;
import com.amadornes.framez.api.movement.HandlingPriority.Priority;
import com.amadornes.framez.api.movement.IMovement;
import com.amadornes.framez.api.Priority;
import com.amadornes.framez.api.movement.IMovementHandler;
import com.amadornes.framez.api.movement.IMovingBlock;

Expand All @@ -33,7 +34,7 @@ public class FrameBlacklist {

private FrameBlacklist() {
if (Loader.isModLoaded("framez"))
FramezApi.inst().getMovementApi().registerMovementHandler(new FramezHandler());
FramezApi.instance().movement().registerMovementHandler(new FramezHandler());
}

private boolean isBlacklisted(World world, int x, int y, int z, Block b, int meta, TileEntity te) {
Expand All @@ -49,25 +50,30 @@ private FramezHandler() {

@Override
@SmartStrip
@HandlingPriority(Priority.HIGH)
public boolean handleStartMoving(IMovingBlock block) {
@Priority(Priority.PriorityEnum.HIGH)
public boolean startMoving(IMovingBlock block) {
return FrameBlacklist.this.isBlacklisted(block.getWorld(), block.getX(), block.getY(), block.getZ(), block.getBlock(), block.getMetadata(), block.getTileEntity());
}

@Override
@SmartStrip
@HandlingPriority(Priority.HIGH)
public boolean handleFinishMoving(IMovingBlock block) {
@Priority(Priority.PriorityEnum.HIGH)
public boolean finishMoving(IMovingBlock block) {
return FrameBlacklist.this.isBlacklisted(block.getWorld(), block.getX(), block.getY(), block.getZ(), block.getBlock(), block.getMetadata(), block.getTileEntity());
}

@Override
@SmartStrip
@HandlingPriority(Priority.HIGH)
public BlockMovementType getMovementType(World world, Integer x, Integer y, Integer z) {
public BlockMovementType getMovementType(World world, int x, int y, int z, ForgeDirection side,
IMovement movement) {
return FrameBlacklist.this.isBlacklisted(world, x, y, z, world.getBlock(x, y, z), world.getBlockMetadata(x, y, z), world.getTileEntity(x, y, z)) ? BlockMovementType.UNMOVABLE : null;
}

@Override
public boolean canHandle(World world, int x, int y, int z) {
// TODO Auto-generated method stub
return false;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should obviously be changed with whatever it needs to be, probably the isBlacklisted list check.

}

}

public boolean fireFrameEvent(World world, int x, int y, int z) {
Expand Down