-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extra Utilities Trading Post Village Names nitwit filtering
- Loading branch information
Showing
4 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/jss/bugtorch/mixins/late/extrautils/tweaks/MixinTileEntityTradingPost.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package jss.bugtorch.mixins.late.extrautils.tweaks; | ||
|
||
import com.rwtema.extrautils.tileentity.TileEntityTradingPost; | ||
import jss.bugtorch.modsupport.VillageNamesSupport; | ||
import net.minecraft.entity.EntityLiving; | ||
import net.minecraft.entity.IMerchant; | ||
import net.minecraft.entity.passive.EntityVillager; | ||
import net.minecraft.util.AxisAlignedBB; | ||
import net.minecraft.util.Vec3; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Overwrite; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
@Mixin(value = TileEntityTradingPost.class) | ||
public abstract class MixinTileEntityTradingPost { | ||
|
||
/** | ||
* @author jss2a98aj | ||
* @reason Filter out invalid Nitwit trades from Village Names | ||
*/ | ||
@Overwrite(remap = false) | ||
public boolean isValidVillager(IMerchant villager, boolean locationAlreadyChecked) { | ||
if(!(villager instanceof EntityLiving)) { | ||
return false; | ||
} | ||
EntityVillager entity = (EntityVillager)villager; | ||
boolean mature = !entity.isChild() && entity.getProfession() != VillageNamesSupport.nitwit; | ||
return mature && (locationAlreadyChecked || getAABB().isVecInside(Vec3.createVectorHelper(entity.posX, entity.posY, entity.posZ))); | ||
} | ||
|
||
@Shadow | ||
public AxisAlignedBB getAABB() { return null; } | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters