aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/rosegoldaddons/mixins/blocksize
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/rosegoldaddons/mixins/blocksize')
-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
6 files changed, 191 insertions, 0 deletions
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();
+ }
+ }
+ }
+}