Skip to content
This repository has been archived by the owner on Apr 23, 2023. It is now read-only.

Commit

Permalink
Add Mixin-ExtraUtilities
Browse files Browse the repository at this point in the history
  • Loading branch information
EverNife committed Jan 25, 2020
1 parent bb0201d commit b3ff2de
Show file tree
Hide file tree
Showing 8 changed files with 185 additions and 1 deletion.
12 changes: 12 additions & 0 deletions Mixin-ExtraUtilities/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
description = "A coremod full of patches and fixes made from black magic and suffering."

archivesBaseName = "ExtraUtilities-Mixin"
version = "1.0.1a"


dependencies {
compileOnly fileTree(dir: 'libs', include: ['*.jar']) //Current Folder Libs
compileOnly fileTree(dir: '../libs', include: ['*.jar']) //Main Folder Libs

compileOnly project(':Mixin-Forge')
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package io.github.crucible.grimoire.mixins.extrautilities;

import com.gamerforea.eventhelper.util.EventUtils;
import com.rwtema.extrautils.tileentity.enderquarry.TileEntityEnderQuarry;
import io.github.crucible.grimoire.forge.core.ITileEntity;
import net.minecraft.tileentity.TileEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Pseudo;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

/**
* Created by Frani on 12/08/2017.
*/

@Pseudo
@Mixin(value = TileEntityEnderQuarry.class, remap = false)
public abstract class MixinTileEntityEnderQuarry extends TileEntity implements ITileEntity {

@Inject(method = "mineBlock", at = @At("HEAD"), cancellable = true)
public void fireBreak(final int x, final int y, final int z, final boolean replaceWithDirt, CallbackInfoReturnable<Boolean> cir) {
if (EventUtils.cantBreak(this.getFakePlayer(), x, y, z)) {
cir.setReturnValue(false);
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package io.github.crucible.grimoire.mixins.extrautilities;

import com.gamerforea.eventhelper.util.EventUtils;
import com.rwtema.extrautils.ExtraUtils;
import com.rwtema.extrautils.tileentity.enderquarry.IChunkLoad;
import com.rwtema.extrautils.tileentity.transfernodes.Frequency;
import com.rwtema.extrautils.tileentity.transfernodes.TileEntityTransferNode;
import com.rwtema.extrautils.tileentity.transfernodes.TileEntityTransferNodeUpgradeInventory;
import com.rwtema.extrautils.tileentity.transfernodes.TransferNodeEnderRegistry;
import com.rwtema.extrautils.tileentity.transfernodes.nodebuffer.INode;
import com.rwtema.extrautils.tileentity.transfernodes.nodebuffer.INodeBuffer;
import com.rwtema.extrautils.tileentity.transfernodes.pipes.IPipe;
import com.rwtema.extrautils.tileentity.transfernodes.pipes.IPipeCosmetic;
import net.minecraft.tileentity.TileEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;


@Mixin(value = TileEntityTransferNode.class, remap = false)
public abstract class MixinTileEntityTransferNode extends TileEntity implements IPipe, INode, IPipeCosmetic, IChunkLoad {

@Shadow
public int pipe_type = 0;
@Shadow
public TileEntityTransferNodeUpgradeInventory upgrades;
@Shadow
public boolean isReceiver = false;
@Shadow
public INodeBuffer buffer;
@Shadow
public TileEntityTransferNode.SearchType searchType;
@Shadow
protected int maxCoolDown;
@Shadow
protected int stepCoolDown;

/**
* @author EverNife
* @reason Desativar os upgrades de velocidade!
*/
@Overwrite
public void calcUpgradeModifiers() {
if (this.worldObj != null && !this.worldObj.isRemote) {
if (this.isReceiver) {
TransferNodeEnderRegistry.clearTileRegistrations(this.buffer);
}

this.isReceiver = false;
this.stepCoolDown = 2;
TileEntityTransferNode.SearchType prevSearchType = this.searchType;
this.searchType = TileEntityTransferNode.SearchType.RANDOM_WALK;
int prev_pipe_type = this.pipe_type;
if (this.upgrades.isValidPipeType(this.pipe_type)) {
this.pipe_type = 0;
}

for(int i = 0; i < this.upgrades.getSizeInventory(); ++i) {
if (this.upgrades.getStackInSlot(i) != null && ExtraUtils.nodeUpgrade != null && this.upgrades.getStackInSlot(i).getItem() == ExtraUtils.nodeUpgrade) {
if (this.upgrades.getStackInSlot(i).getItemDamage() == 0) {
//Mixin Replace maxCooldown with a limit of 6
for(int k = 0; k < this.upgrades.getStackInSlot(i).stackSize && this.stepCoolDown < 2; ++k) {
++this.stepCoolDown;
}
} else if (this.upgrades.getStackInSlot(i).getItemDamage() == 6 && this.upgrades.getStackInSlot(i).hasDisplayName()) {
TransferNodeEnderRegistry.registerTile(new Frequency(this.upgrades.getStackInSlot(i)), this.buffer);
this.isReceiver = true;
} else if (this.upgrades.getStackInSlot(i).getItemDamage() == 7) {
this.searchType = TileEntityTransferNode.SearchType.DEPTH_FIRST;
} else if (this.upgrades.getStackInSlot(i).getItemDamage() == 8) {
this.searchType = TileEntityTransferNode.SearchType.BREADTH_FIRST;
}
} else if (this.upgrades.pipeType(this.upgrades.getStackInSlot(i)) > 0) {
this.pipe_type = this.upgrades.pipeType(this.upgrades.getStackInSlot(i));
}
}

if (prevSearchType != this.searchType) {
this.resetSearch();
}

if (prev_pipe_type != this.pipe_type) {
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}

}
}

@Shadow
public void resetSearch() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package io.github.crucible.grimoire.mixins.extrautilities;

import com.rwtema.extrautils.helper.XUHelper;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Pseudo;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

/**
* Created by Frani on 13/06/2017.
*/

@Pseudo
@Mixin(value = XUHelper.class, remap = false)
public abstract class MixinXUHelper {

@Inject(method = "drainBlock", at = @At("HEAD"), cancellable = true)
private static void injectDrainBlock(final World world, final int x, final int y, final int z, final boolean doDrain, CallbackInfoReturnable cir) {
if(!world.blockExists(x, y, z)) {
cir.cancel();
}
}

}
15 changes: 15 additions & 0 deletions Mixin-ExtraUtilities/src/main/resources/mixins.extrautilities.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"required": true,
"package": "io.github.crucible.grimoire.mixins.extrautilities",
"mixins":[
"MixinTileEntityEnderQuarry",
"MixinTileEntityTransferNode",
"MixinXUHelper"
],
"server": [],
"client": [],
"compatibilityLevel": "JAVA_8",
"minVersion": "0.7.11",
"target": "@env(INIT)",
"refmap":"grimoire.refmap.json"
}
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ Seriously, don't throw all of them if you don't need them!
* Requirements:
* EnderIO Mod

###### ExtraUtilities-Mixin

* MixinTileEntityEnderQuarry - Add EventHelper support.
* MixinXUHelper - Extra check for block existency.
* TileEntityTransferNode - Disable Speed Upgrade Modifier.
* Requirements:
* ExtraUtilities Mod
* EventHelper
* Forge-Mixin module.

###### IC2-Mixin

* MixinUtil - IndustrialCraft 2 uses methods that are old even for forge itself, because a few of them, IC2 is not compatible with CrucibleMC. This fix that! With this mixin you can run IC2 inside CrucibleMC.
Expand Down
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ include 'Mixin-OpenBlocks'
include 'Mixin-NEI'
include 'Mixin-ThaumicEnergistics'
include 'Mixin-IC2'
include 'Mixin-Baubles'
include 'Mixin-Baubles'
include 'Mixin-ExtraUtilities'

0 comments on commit b3ff2de

Please sign in to comment.