aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/rosegoldaddons/mixins
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/rosegoldaddons/mixins')
-rw-r--r--src/main/java/rosegoldaddons/mixins/MixinEntity.java4
-rw-r--r--src/main/java/rosegoldaddons/mixins/MixinEntityPlayer.java3
-rw-r--r--src/main/java/rosegoldaddons/mixins/MixinEntityPlayerSP.java30
-rw-r--r--src/main/java/rosegoldaddons/mixins/MixinFMLHandShake.java24
-rw-r--r--src/main/java/rosegoldaddons/mixins/MixinRenderString.java30
-rw-r--r--src/main/java/rosegoldaddons/mixins/MixinRendererLivingEntity.java2
-rw-r--r--src/main/java/rosegoldaddons/mixins/blocksize/MixinBlock.java49
-rw-r--r--src/main/java/rosegoldaddons/mixins/blocksize/MixinBlockLever.java29
-rw-r--r--src/main/java/rosegoldaddons/mixins/blocksize/MixinButton.java28
-rw-r--r--src/main/java/rosegoldaddons/mixins/blocksize/MixinChest.java28
-rw-r--r--src/main/java/rosegoldaddons/mixins/blocksize/MixinCrops.java26
-rw-r--r--src/main/java/rosegoldaddons/mixins/blocksize/MixinSkull.java31
12 files changed, 275 insertions, 9 deletions
diff --git a/src/main/java/rosegoldaddons/mixins/MixinEntity.java b/src/main/java/rosegoldaddons/mixins/MixinEntity.java
index 3319fc1..996f6c6 100644
--- a/src/main/java/rosegoldaddons/mixins/MixinEntity.java
+++ b/src/main/java/rosegoldaddons/mixins/MixinEntity.java
@@ -15,8 +15,8 @@ import java.util.Map;
public class MixinEntity {
@Inject(method = "getDisplayName", at = @At(value = "RETURN"), cancellable = true)
public void getFormattedText(CallbackInfoReturnable<IChatComponent> cir) {
- if(Main.pauseCustom || Main.configFile.nameRenderType == 0) return;
- if (Main.init && Main.configFile.alchsleep != 63 || Main.configFile.skiblock != 263) {
+ if(Main.configFile.nameRenderType == 0) return;
+ if (Main.init && Main.configFile.alchsleep != 88 || Main.configFile.skiblock != 263) {
IChatComponent ict = new ChatComponentText("");
ict.setChatStyle(cir.getReturnValue().getChatStyle());
String text = cir.getReturnValue().getFormattedText();
diff --git a/src/main/java/rosegoldaddons/mixins/MixinEntityPlayer.java b/src/main/java/rosegoldaddons/mixins/MixinEntityPlayer.java
index 1584dac..5384bec 100644
--- a/src/main/java/rosegoldaddons/mixins/MixinEntityPlayer.java
+++ b/src/main/java/rosegoldaddons/mixins/MixinEntityPlayer.java
@@ -15,8 +15,7 @@ import java.util.Map;
public class MixinEntityPlayer {
@Inject(method = "getDisplayName", at = @At(value = "RETURN"), cancellable = true)
public void getFormattedText(CallbackInfoReturnable<IChatComponent> cir) {
- if(Main.pauseCustom) return;
- if (Main.init && Main.configFile.alchsleep != 63 || Main.configFile.skiblock != 263) {
+ if (Main.init && Main.configFile.alchsleep != 88 || Main.configFile.skiblock != 263) {
IChatComponent ict = new ChatComponentText("");
ict.setChatStyle(cir.getReturnValue().getChatStyle());
String text = cir.getReturnValue().getFormattedText();
diff --git a/src/main/java/rosegoldaddons/mixins/MixinEntityPlayerSP.java b/src/main/java/rosegoldaddons/mixins/MixinEntityPlayerSP.java
new file mode 100644
index 0000000..95507be
--- /dev/null
+++ b/src/main/java/rosegoldaddons/mixins/MixinEntityPlayerSP.java
@@ -0,0 +1,30 @@
+package rosegoldaddons.mixins;
+
+import net.minecraft.client.entity.EntityPlayerSP;
+import net.minecraftforge.common.MinecraftForge;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+import rosegoldaddons.events.PlayerMoveEvent;
+import rosegoldaddons.events.ScreenClosedEvent;
+import rosegoldaddons.features.SexAura;
+
+@Mixin(EntityPlayerSP.class)
+public class MixinEntityPlayerSP {
+ @Inject(method = "closeScreen", at = @At("HEAD"), cancellable = true)
+ public void closeScreen(CallbackInfo ci) {
+ if(SexAura.blocked) ci.cancel();
+ MinecraftForge.EVENT_BUS.post(new ScreenClosedEvent());
+ }
+
+ @Inject(method = "onUpdateWalkingPlayer", at = @At("HEAD"), cancellable = true)
+ public void onUpdateWalking(CallbackInfo cir) {
+ if (MinecraftForge.EVENT_BUS.post(new PlayerMoveEvent.Pre())) cir.cancel();
+ }
+
+ @Inject(method = "onUpdateWalkingPlayer", at = @At("RETURN"), cancellable = true)
+ public void onWalking(CallbackInfo cir) {
+ if (MinecraftForge.EVENT_BUS.post(new PlayerMoveEvent.Post())) cir.cancel();
+ }
+}
diff --git a/src/main/java/rosegoldaddons/mixins/MixinFMLHandShake.java b/src/main/java/rosegoldaddons/mixins/MixinFMLHandShake.java
new file mode 100644
index 0000000..6f00741
--- /dev/null
+++ b/src/main/java/rosegoldaddons/mixins/MixinFMLHandShake.java
@@ -0,0 +1,24 @@
+package rosegoldaddons.mixins;
+
+import net.minecraftforge.fml.common.ModContainer;
+import net.minecraftforge.fml.common.network.handshake.FMLHandshakeMessage;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Shadow;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+import rosegoldaddons.Main;
+
+import java.util.List;
+import java.util.Map;
+
+@Mixin(value = FMLHandshakeMessage.ModList.class, remap = false)
+public class MixinFMLHandShake {
+ @Shadow
+ private Map<String, String> modTags;
+
+ @Inject(method = "<init>(Ljava/util/List;)V", at = @At("RETURN"))
+ private void removeRGA(List<ModContainer> modList, CallbackInfo ci) {
+ if(!Main.mc.isIntegratedServerRunning()) modTags.remove(Main.MOD_ID);
+ }
+}
diff --git a/src/main/java/rosegoldaddons/mixins/MixinRenderString.java b/src/main/java/rosegoldaddons/mixins/MixinRenderString.java
index b010d84..8484cdf 100644
--- a/src/main/java/rosegoldaddons/mixins/MixinRenderString.java
+++ b/src/main/java/rosegoldaddons/mixins/MixinRenderString.java
@@ -2,24 +2,29 @@ package rosegoldaddons.mixins;
import net.minecraft.client.gui.FontRenderer;
import org.apache.commons.codec.digest.DigestUtils;
+import org.dom4j.util.StringUtils;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import rosegoldaddons.Main;
import rosegoldaddons.utils.ChatUtils;
-@Mixin(FontRenderer.class)
-public abstract class MixinRenderString {
+import java.util.Arrays;
+import java.util.Locale;
- private boolean replacedRank = false;
+@Mixin(value = FontRenderer.class)
+public abstract class MixinRenderString {
+ private static final char[] normal = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM".toCharArray();
+ private static final char[] custom = "qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnm".toCharArray();
@ModifyVariable(method = "drawString(Ljava/lang/String;FFIZ)I", at = @At(value = "FIELD"))
private String replaceName(String text) {
if (Main.mc.theWorld == null || Main.mc.thePlayer == null) return text;
- if (Main.pauseCustom) return text;
+ if(Main.configFile.antiRacism == 0 || Main.configFile.antiRacism == 1) text = removeRacism(text);
if (Main.configFile.wydsi && text.contains("727")) {
text = text.replace("727", "726");
}
+ if (Main.pauseCustom) return text;
if (Main.init && Main.configFile.alchsleep != 88 || Main.configFile.skiblock != 263) {
String[] words = removeFormatting(text).replace(":", " ").replace("'", " ").split(" ");
String[] formatteds = text.replace(":", " ").replace("'", " ").split(" ");
@@ -65,6 +70,23 @@ public abstract class MixinRenderString {
return text;
}
+ private String removeRacism(String str) {
+ str = str.replace("ˌ","");
+ for(int i = 0; i < custom.length; i++) {
+ if(str.contains(String.valueOf(custom[i]))) {
+ str = str.replace(custom[i], normal[i]);
+ }
+ }
+ for (String word : Main.blacklist) {
+ if (str.toLowerCase().contains(word.toLowerCase())) {
+ char[] censored = new char[word.length()];
+ Arrays.fill(censored, '*');
+ return str.replaceAll("(?i)"+word, new String(censored));
+ }
+ }
+ return str;
+ }
+
private String getRank(String str, String sub) {
if (!str.contains("[") || !str.contains("]")) return null;
if (sub.contains("[") || sub.contains("]")) return null;
diff --git a/src/main/java/rosegoldaddons/mixins/MixinRendererLivingEntity.java b/src/main/java/rosegoldaddons/mixins/MixinRendererLivingEntity.java
index c83028b..e128bba 100644
--- a/src/main/java/rosegoldaddons/mixins/MixinRendererLivingEntity.java
+++ b/src/main/java/rosegoldaddons/mixins/MixinRendererLivingEntity.java
@@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import rosegoldaddons.events.RenderLivingEntityEvent;
-@Mixin(value = RendererLivingEntity.class, priority = 1001)
+@Mixin(value = RendererLivingEntity.class)
@SideOnly(Side.CLIENT)
public abstract class MixinRendererLivingEntity {
@Shadow
diff --git a/src/main/java/rosegoldaddons/mixins/blocksize/MixinBlock.java b/src/main/java/rosegoldaddons/mixins/blocksize/MixinBlock.java
new file mode 100644
index 0000000..1d66ffc
--- /dev/null
+++ b/src/main/java/rosegoldaddons/mixins/blocksize/MixinBlock.java
@@ -0,0 +1,49 @@
+package rosegoldaddons.mixins.blocksize;
+
+import net.minecraft.block.Block;
+import net.minecraft.client.Minecraft;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Shadow;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+import rosegoldaddons.Main;
+
+@Mixin(Block.class)
+public abstract class MixinBlock {
+
+ @Shadow
+ protected double minX;
+
+ @Shadow
+ protected double minY;
+
+ @Shadow
+ protected double minZ;
+
+ @Shadow
+ protected double maxX;
+
+ @Shadow
+ protected double maxY;
+
+ @Shadow
+ protected double maxZ;
+
+ @Shadow public abstract boolean isFullBlock();
+
+ @Inject(method = "setBlockBounds", at = @At("HEAD"), cancellable = true)
+ private void setBlockBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ, CallbackInfo ci) {
+ if(Minecraft.getMinecraft().theWorld != null) {
+ /*if (Main.configFile.allBlocksBig && isFullBlock()) {
+ this.minX = 0.0D;
+ this.minY = 0.0D;
+ this.minZ = 0.0D;
+ this.maxX = 1.0D;
+ this.maxY = 1.0D;
+ this.maxZ = 1.0D;
+ ci.cancel();
+ }*/
+ }
+ }
+}
diff --git a/src/main/java/rosegoldaddons/mixins/blocksize/MixinBlockLever.java b/src/main/java/rosegoldaddons/mixins/blocksize/MixinBlockLever.java
new file mode 100644
index 0000000..9a929f3
--- /dev/null
+++ b/src/main/java/rosegoldaddons/mixins/blocksize/MixinBlockLever.java
@@ -0,0 +1,29 @@
+package rosegoldaddons.mixins.blocksize;
+
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockLever;
+import net.minecraft.block.material.MapColor;
+import net.minecraft.block.material.Material;
+import net.minecraft.util.BlockPos;
+import net.minecraft.world.IBlockAccess;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+import rosegoldaddons.Main;
+
+@Mixin(BlockLever.class)
+public abstract class MixinBlockLever extends Block {
+
+ public MixinBlockLever(Material blockMaterialIn, MapColor blockMapColorIn) {
+ super(blockMaterialIn, blockMapColorIn);
+ }
+
+ @Inject(method = "setBlockBoundsBasedOnState", at = @At("HEAD"), cancellable = true)
+ private void changeBlockBounds(IBlockAccess worldIn, BlockPos pos, CallbackInfo ci) {
+ if(Main.configFile.dungeonBlocksBig) {
+ this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ ci.cancel();
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/java/rosegoldaddons/mixins/blocksize/MixinButton.java b/src/main/java/rosegoldaddons/mixins/blocksize/MixinButton.java
new file mode 100644
index 0000000..e66425f
--- /dev/null
+++ b/src/main/java/rosegoldaddons/mixins/blocksize/MixinButton.java
@@ -0,0 +1,28 @@
+package rosegoldaddons.mixins.blocksize;
+
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockButton;
+import net.minecraft.block.material.MapColor;
+import net.minecraft.block.material.Material;
+import net.minecraft.block.state.IBlockState;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+import rosegoldaddons.Main;
+
+@Mixin(BlockButton.class)
+public abstract class MixinButton extends Block {
+
+ public MixinButton(Material blockMaterialIn, MapColor blockMapColorIn) {
+ super(blockMaterialIn, blockMapColorIn);
+ }
+
+ @Inject(method = "updateBlockBounds", at = @At("HEAD"), cancellable = true)
+ private void changeBlockBounds(IBlockState state, CallbackInfo ci) {
+ if(Main.configFile.dungeonBlocksBig) {
+ this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ ci.cancel();
+ }
+ }
+}
diff --git a/src/main/java/rosegoldaddons/mixins/blocksize/MixinChest.java b/src/main/java/rosegoldaddons/mixins/blocksize/MixinChest.java
new file mode 100644
index 0000000..4025a2a
--- /dev/null
+++ b/src/main/java/rosegoldaddons/mixins/blocksize/MixinChest.java
@@ -0,0 +1,28 @@
+package rosegoldaddons.mixins.blocksize;
+
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockChest;
+import net.minecraft.block.material.Material;
+import net.minecraft.util.BlockPos;
+import net.minecraft.world.IBlockAccess;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+import rosegoldaddons.Main;
+
+@Mixin(BlockChest.class)
+public class MixinChest extends Block {
+
+ public MixinChest(Material materialIn) {
+ super(materialIn);
+ }
+
+ @Inject(method = "setBlockBoundsBasedOnState", at = @At("HEAD"), cancellable = true)
+ private void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos, CallbackInfo ci) {
+ if(Main.configFile.dungeonBlocksBig) {
+ this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.875F, 1.0F);
+ ci.cancel();
+ }
+ }
+}
diff --git a/src/main/java/rosegoldaddons/mixins/blocksize/MixinCrops.java b/src/main/java/rosegoldaddons/mixins/blocksize/MixinCrops.java
new file mode 100644
index 0000000..217672a
--- /dev/null
+++ b/src/main/java/rosegoldaddons/mixins/blocksize/MixinCrops.java
@@ -0,0 +1,26 @@
+package rosegoldaddons.mixins.blocksize;
+
+import net.minecraft.block.BlockBush;
+import net.minecraft.block.BlockCrops;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.MovingObjectPosition;
+import net.minecraft.util.Vec3;
+import net.minecraft.world.World;
+import org.spongepowered.asm.mixin.Mixin;
+
+@Mixin(BlockCrops.class)
+public class MixinCrops extends BlockBush {
+
+ @Override
+ public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) {
+ worldIn.getBlockState(pos).getBlock().setBlockBounds(0, 0, 0, 1, 1, 1);
+ return super.getSelectedBoundingBox(worldIn, pos);
+ }
+
+ @Override
+ public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) {
+ worldIn.getBlockState(pos).getBlock().setBlockBounds(0, 0, 0, 1, 1, 1);
+ return super.collisionRayTrace(worldIn, pos, start, end);
+ }
+}
diff --git a/src/main/java/rosegoldaddons/mixins/blocksize/MixinSkull.java b/src/main/java/rosegoldaddons/mixins/blocksize/MixinSkull.java
new file mode 100644
index 0000000..2dba951
--- /dev/null
+++ b/src/main/java/rosegoldaddons/mixins/blocksize/MixinSkull.java
@@ -0,0 +1,31 @@
+package rosegoldaddons.mixins.blocksize;
+
+import net.minecraft.block.BlockContainer;
+import net.minecraft.block.BlockSkull;
+import net.minecraft.block.material.Material;
+import net.minecraft.util.BlockPos;
+import net.minecraft.world.IBlockAccess;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+import rosegoldaddons.Main;
+
+@Mixin(BlockSkull.class)
+public abstract class MixinSkull extends BlockContainer {
+
+ protected MixinSkull(Material materialIn) {
+ super(materialIn);
+ }
+
+ @Inject(method = "setBlockBoundsBasedOnState", at = @At("HEAD"), cancellable = true)
+ private void changeBlockBounds(IBlockAccess worldIn, BlockPos pos, CallbackInfo ci) {
+ if(Main.configFile.dungeonBlocksBig) {
+ if(worldIn.getTileEntity(pos).serializeNBT().toString().contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvY2I4NTJiYTE1ODRkYTllNTcxNDg1OTk5NTQ1MWU0Yjk0NzQ4YzRkZDYzYWU0NTQzYzE1ZjlmOGFlYzY1YzgifX19") ||
+ worldIn.getTileEntity(pos).serializeNBT().toString().contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzRkYjRhZGZhOWJmNDhmZjVkNDE3MDdhZTM0ZWE3OGJkMjM3MTY1OWZjZDhjZDg5MzQ3NDlhZjRjY2U5YiJ9fX0")) {
+ this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ ci.cancel();
+ }
+ }
+ }
+}