Skip to content

Commit

Permalink
I was Fixins da Mixins
Browse files Browse the repository at this point in the history
  • Loading branch information
darkevilmac committed Jul 18, 2016
1 parent e0f6cd3 commit e961699
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 26 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ group = "darkevilmac.movingworld"
archivesBaseName = "movingworld"

minecraft {
version = "1.10.2-12.18.0.2006-1.10.0"
version = "1.10.2-12.18.1.2014"
runDir = "run"

def replacementVersion = 'MOD_VERSION = \"' + project.version + '\"'

replace("MOD_VERSION = \"@MOVINGWORLDVER@\"",
replacementVersion)

mappings = "snapshot_20160630"
mappings = "snapshot_20160715"
}

mixin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;

import org.spongepowered.asm.launch.MixinBootstrap;
import org.spongepowered.asm.mixin.MixinEnvironment;
import org.spongepowered.asm.mixin.Mixins;

import java.util.Map;

@IFMLLoadingPlugin.MCVersion(value = "1.9")
@IFMLLoadingPlugin.MCVersion(value = "1.10.2")
public class MovingWorldCoreMod implements IFMLLoadingPlugin {

public MovingWorldCoreMod() {
MixinBootstrap.init();
MixinEnvironment.setCompatibilityLevel(MixinEnvironment.CompatibilityLevel.JAVA_7);
MixinEnvironment env = MixinEnvironment.getDefaultEnvironment();
env.addConfiguration("mixins.movingworld.json");
Mixins.addConfiguration("mixins.movingworld.json");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

import darkevilmac.movingworld.MovingWorld;
Expand Down Expand Up @@ -83,8 +82,9 @@ public void chunkAssembled(AssembleResult assembleResult) {
public void chunkDissasembled(AssembleResult assembleResult) {
}

public CanAssemble isBlockAllowed(World world, IBlockState state, BlockPos pos) {
public CanAssemble isBlockAllowed(World world, LocatedBlock lb) {
CanAssemble canAssemble = new CanAssemble(false, false);
IBlockState state = lb.blockState;

canAssemble.justCancel = !(!state.getMaterial().equals(Material.AIR) && !state.getMaterial().isLiquid() && MovingWorld.instance.getNetworkConfig().isStateAllowed(state));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private void assembleIterative(AssembleResult result, MovingWorldAssemblyInterac
closedSet.add(mobileChunkPos);

IBlockState blockState = worldObj.getBlockState(worldPos);
CanAssemble canAssemble = canUseBlockForVehicle(blockState, assemblyInteractor, worldPos);
CanAssemble canAssemble = canUseBlockForVehicle(new LocatedBlock(blockState, worldObj.getTileEntity(worldPos), worldPos), assemblyInteractor);

if (canAssemble.justCancel) {
continue;
Expand Down Expand Up @@ -137,7 +137,7 @@ private void assembleRecursive(AssembleResult result, HashSet<BlockPos> set, Mov
IBlockState blockState = worldObj.getBlockState(pos);
Block block = blockState.getBlock();

CanAssemble canAssemble = canUseBlockForVehicle(blockState, assemblyInteractor, pos);
CanAssemble canAssemble = canUseBlockForVehicle(new LocatedBlock(blockState, worldObj.getTileEntity(pos), pos), assemblyInteractor);

if (canAssemble.justCancel) {
return;
Expand Down Expand Up @@ -181,7 +181,7 @@ private void assembleRecursive(AssembleResult result, HashSet<BlockPos> set, Mov
result.movingWorldMarkingBlock = movingWorldMarker;
}

public CanAssemble canUseBlockForVehicle(IBlockState state, MovingWorldAssemblyInteractor assemblyInteractor, BlockPos pos) {
return assemblyInteractor.isBlockAllowed(worldObj, state, pos);
public CanAssemble canUseBlockForVehicle(LocatedBlock lb, MovingWorldAssemblyInteractor assemblyInteractor) {
return assemblyInteractor.isBlockAllowed(worldObj, lb);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ public float getHorizontalVelocity() {
return (float) Math.sqrt(motionX * motionX + motionZ * motionZ);
}

public void alignToGrid() {
public void alignToGrid(boolean doPosAdjustment) {
rotationYaw = Math.round(rotationYaw / 90F) * 90F;
rotationPitch = 0F;

Expand All @@ -665,9 +665,11 @@ public void alignToGrid() {
int iy = MathHelperMod.round_double(vec.yCoord + posY);
int iz = MathHelperMod.round_double(vec.zCoord + posZ);

posX = ix - vec.xCoord;
posY = iy - vec.yCoord;
posZ = iz - vec.zCoord;
if (doPosAdjustment) {
posX = ix - vec.xCoord;
posY = iy - vec.yCoord;
posZ = iz - vec.zCoord;
}

motionX = motionY = motionZ = 0D;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package darkevilmac.movingworld.common.network;

public enum MovingWorldClientAction {
NONE, ALIGN, DISASSEMBLE, DISASSEMBLEOVERWRITE;
NONE, ALIGN, DISASSEMBLE, DISASSEMBLEWITHOVERWRITE;

public static byte toByte(MovingWorldClientAction action) {
switch (action) {
case ALIGN:
return (byte) 1;
case DISASSEMBLE:
return (byte) 2;
case DISASSEMBLEOVERWRITE:
case DISASSEMBLEWITHOVERWRITE:
return (byte) 3;
default:
return (byte) 0;
Expand All @@ -23,7 +23,7 @@ public static MovingWorldClientAction fromByte(byte actionInt) {
case 2:
return DISASSEMBLE;
case 3:
return DISASSEMBLEOVERWRITE;
return DISASSEMBLEWITHOVERWRITE;
default:
return NONE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,17 @@ public void accept(EntityPlayer entityPlayer, Token token) {
if (movingWorld != null && movingWorld.getControllingPassenger().getEntityId() == entityPlayer.getEntityId()) {
switch (action) {
case DISASSEMBLE:
movingWorld.alignToGrid();
movingWorld.alignToGrid(true);
movingWorld.updatePassengerPosition(entityPlayer, movingWorld.riderDestination, 1);
movingWorld.disassemble(false);
break;
case DISASSEMBLEOVERWRITE:
movingWorld.alignToGrid();
case DISASSEMBLEWITHOVERWRITE:
movingWorld.alignToGrid(true);
movingWorld.updatePassengerPosition(entityPlayer, movingWorld.riderDestination, 1);
movingWorld.disassemble(true);
break;
case ALIGN:
movingWorld.alignToGrid();
movingWorld.alignToGrid(true);
break;
default:
break;
Expand Down
5 changes: 3 additions & 2 deletions src/main/resources/mixins.movingworld.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"required": true,
"package": "darkevilmac.movingworld.common.asm.mixin.core",
"compatibilityLevel": "JAVA_8",
"refmap": "movingworld.mixin.refmap.json",
"mixins": [
"entity.MixinEntity",
"block.property.MixinPropertyEnum",
"block.property.MixinPropertyInteger",
"block.MixinBlockSkull"
],
"refmap": "movingworld.mixin.refmap.json"
]
}

0 comments on commit e961699

Please sign in to comment.