Skip to content

Commit

Permalink
Correct SmartRender submodule to forked version
Browse files Browse the repository at this point in the history
Minor cleaning of source
  • Loading branch information
Tommsy64 committed May 24, 2018
1 parent 5351c3a commit c2a4848
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "SmartRender"]
path = SmartRender
url = https://github.com/JonnyNova/SmartRender.git
url = https://github.com/Tommsy64/SmartRender.git
[submodule "PlayerAPI"]
path = PlayerAPI
url = https://github.com/Tommsy64/PlayerAPI.git
Expand Down
2 changes: 1 addition & 1 deletion SmartRender
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ minecraft {
replace "/*@MCVERSIONDEP@*/", ", acceptedMinecraftVersions = \"[${config.minecraft.version},${config.minecraft.version}+)\""
}

sourceCompatibility = targetCompatibility = '1.8'
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}

processResources {
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
Expand Down
10 changes: 0 additions & 10 deletions src/main/java/net/smart/moving/FeetClimbing.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

package net.smart.moving;

import java.io.*;

public class FeetClimbing
{
public static final int DownStep = 1;
Expand Down Expand Up @@ -88,14 +86,6 @@ public String toString()
return "FastUp";
}

public void print(String name)
{
PrintStream stream = System.err;
if(name != null)
stream.print(name + " = ");
stream.println(this);
}

private static FeetClimbing get(int value)
{
if(value <= None._value)
Expand Down
10 changes: 0 additions & 10 deletions src/main/java/net/smart/moving/HandsClimbing.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

package net.smart.moving;

import java.io.*;

public class HandsClimbing
{
public static final int MiddleGrab = 2;
Expand Down Expand Up @@ -95,14 +93,6 @@ public String toString()
return "FastUp";
}

public void print(String name)
{
PrintStream stream = System.err;
if(name != null)
stream.print(name + " = ");
stream.println(this);
}

private static HandsClimbing get(int value)
{
if(value <= None._value)
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/net/smart/moving/Orientation.java
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,7 @@ private boolean isTopStairCompactBack(IBlockState state)
private boolean isStairCompactFront(IBlockState state)
{
EnumFacing facing = getValue(state, BlockStairs.FACING, this._facing);
BlockStairs.EnumShape shape = (BlockStairs.EnumShape)getValue(state, BlockStairs.SHAPE);
BlockStairs.EnumShape shape = getValue(state, BlockStairs.SHAPE);

if(this == NZ)
return ((north(facing) && outer_left(shape)) || (south(facing) && outer_right(shape)) || (west(facing) && (straight(shape) || outer_right(shape) || outer_left(shape))));
Expand All @@ -1384,7 +1384,7 @@ private boolean isStairCompactFront(IBlockState state)
private boolean isStairCompactBack(IBlockState state)
{
EnumFacing facing = getValue(state, BlockStairs.FACING, this._facing);
BlockStairs.EnumShape shape = (BlockStairs.EnumShape)getValue(state, BlockStairs.SHAPE);
BlockStairs.EnumShape shape = getValue(state, BlockStairs.SHAPE);

if(this == NZ)
return ((north(facing) && inner_right(shape)) || (south(facing) && inner_left(shape)) || (east(facing) && (straight(shape) || inner_left(shape) || inner_right(shape))));
Expand Down Expand Up @@ -1452,7 +1452,7 @@ private static boolean east(EnumFacing facing)

private static boolean isTopStairCompact(IBlockState state)
{
return (BlockStairs.EnumHalf)getValue(state, BlockStairs.HALF) == BlockStairs.EnumHalf.TOP;
return getValue(state, BlockStairs.HALF) == BlockStairs.EnumHalf.TOP;
}

private static boolean isRedPowerWireTop(int coverSides)
Expand Down Expand Up @@ -1817,12 +1817,12 @@ private static boolean isTopHalfBlock(IBlockState state)

private static boolean isHalfBlockBottomMetaData(IBlockState state)
{
return (BlockSlab.EnumBlockHalf)getValue(state, BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM;
return getValue(state, BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM;
}

private static boolean isHalfBlockTopMetaData(IBlockState state)
{
return (BlockSlab.EnumBlockHalf)getValue(state, BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP;
return getValue(state, BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP;
}

private static boolean isHalfBlock(IBlockState state)
Expand Down Expand Up @@ -2032,7 +2032,7 @@ private static boolean isDoor(IBlockState state)

private static boolean isDoorTop(IBlockState state)
{
return (BlockDoor.EnumDoorHalf)getValue(state, BlockDoor.HALF) == BlockDoor.EnumDoorHalf.UPPER;
return getValue(state, BlockDoor.HALF) == BlockDoor.EnumDoorHalf.UPPER;
}

@SuppressWarnings("incomplete-switch")
Expand Down Expand Up @@ -2063,7 +2063,7 @@ private EnumFacing getDoorFacing(IBlockState state)
if (!getValue(state, BlockDoor.OPEN))
return facing;

switch((BlockDoor.EnumHingePosition)getValue(state, BlockDoor.HINGE))
switch(getValue(state, BlockDoor.HINGE))
{
case LEFT:
switch(facing)
Expand Down
1 change: 1 addition & 0 deletions src/main/java/net/smart/moving/SmartMovingBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ protected float getLiquidBorder(int i, int j, int k)
return 0F;
}

@SuppressWarnings("deprecation")
protected float getNormalWaterBorder(int i, int j, int k)
{
int level = getValue(getState(i, j, k), BlockLiquid.LEVEL);
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/net/smart/moving/SmartMovingContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import net.minecraft.client.Minecraft;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.GameType;
import net.minecraft.world.World;
Expand Down Expand Up @@ -158,9 +159,9 @@ public static EnumFacing getValue(IBlockState state, PropertyDirection property,
return comparable == null ? null : property.getValueClass().cast(comparable);
}

public static Enum getValue(IBlockState state, PropertyEnum property)
public static <T extends Enum<T> & IStringSerializable> T getValue(IBlockState state, PropertyEnum<T> property)
{
return (Enum)state.getValue(property);
return state.getValue(property);
}

private static MinecraftServer lastMinecraftServer = null;
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/net/smart/moving/SmartMovingMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public SmartMovingMod()
}

@EventHandler
@SuppressWarnings("unused")
public void init(FMLPreInitializationEvent event)
{
if(isClient)
Expand All @@ -76,7 +75,6 @@ public void init(FMLPreInitializationEvent event)
}

@EventHandler
@SuppressWarnings("unused")
public void init(FMLInitializationEvent event)
{
NetworkRegistry.INSTANCE.newEventDrivenChannel(SmartMovingPacketStream.Id).register(this);
Expand All @@ -100,29 +98,25 @@ public void init(FMLInitializationEvent event)
}

@EventHandler
@SuppressWarnings("unused")
public void postInit(FMLPostInitializationEvent event)
{
if(!isClient)
net.smart.moving.playerapi.SmartMovingServerPlayerBase.registerPlayerBase();
}

@SubscribeEvent
@SuppressWarnings({ "static-method", "unused" })
public void tickStart(ClientTickEvent event)
{
SmartMovingContext.onTickInGame();
}

@SubscribeEvent
@SuppressWarnings({ "static-method", "unused" })
public void onPacketData(ServerCustomPacketEvent event)
{
SmartMovingPacketStream.receivePacket(event.getPacket(), SmartMovingServerComm.instance, net.smart.moving.playerapi.SmartMovingServerPlayerBase.getPlayerBase(((NetHandlerPlayServer)event.getHandler()).playerEntity));
}

@SubscribeEvent
@SuppressWarnings({ "static-method", "unused" })
public void onPacketData(ClientCustomPacketEvent event)
{
SmartMovingPacketStream.receivePacket(event.getPacket(), SmartMovingComm.instance, null);
Expand All @@ -133,19 +127,16 @@ public void registerGameTicks()
MinecraftForge.EVENT_BUS.register(this);
}

@SuppressWarnings("static-method")
public Object getInstance(EntityPlayer entityPlayer)
{
return SmartMovingFactory.getInstance(entityPlayer);
}

@SuppressWarnings("static-method")
public Object getClient()
{
return SmartMovingContext.Client;
}

@SuppressWarnings("static-method")
public void checkForPresentModsAndInitializeOptions()
{
List<ModContainer> modList = Loader.instance().getActiveModList();
Expand Down
48 changes: 24 additions & 24 deletions src/main/java/net/smart/moving/SmartMovingSelf.java
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ private float landMotion(float moveForward, float moveStrafing, float speedFacto
else
horizontalDamping = HorizontalGroundDamping;

if(esp.movementInput.jump && isFast && Config.isJumpingEnabled(Config.Sprinting, Config.Up))
if(esp.movementInput.jump && isFast && Config.isJumpingEnabled(SmartMovingClientConfig.Sprinting, SmartMovingClientConfig.Up))
speedFactor *= Config._sprintJumpVerticalFactor.value;
}
else
Expand Down Expand Up @@ -982,7 +982,7 @@ else if(handsClimbing.IsUp())
else if(handsClimbing == HandsClimbing.TopHold || feetClimbing == FeetClimbing.BaseHold || (feetClimbing == FeetClimbing.SlowUpWithHoldWithoutHands && handsClimbing == HandsClimbing.None))
{
// holding at top
if (!jumpButton.StartPressed || !(isClimbJumping = tryJump(feetClimbing != FeetClimbing.None ? Config.ClimbUp : Config.ClimbUpHandsOnly, null, null, null)))
if (!jumpButton.StartPressed || !(isClimbJumping = tryJump(feetClimbing != FeetClimbing.None ? SmartMovingClientConfig.ClimbUp : SmartMovingClientConfig.ClimbUpHandsOnly, null, null, null)))
{
if(handsClimbing == HandsClimbing.Sink && feetClimbing == FeetClimbing.BaseHold || handsClimbing == HandsClimbing.TopHold && feetClimbing == FeetClimbing.TopWithHands)
setShouldClimbSpeed(HoldMotion, HandsClimbing.MiddleGrab, FeetClimbing.DownStep);
Expand Down Expand Up @@ -1033,8 +1033,8 @@ else if(feetClimbing == FeetClimbing.BaseWithHands || feetClimbing == FeetClimbi
boolean handsOnly = feetClimbing != FeetClimbing.None;

int type = (Options._climbJumpBackHeadOnGrab.value ? grabButton.Pressed : !grabButton.Pressed)
? (handsOnly ? Config.ClimbBackHead : Config.ClimbBackHeadHandsOnly)
: (handsOnly ? Config.ClimbBackUp : Config.ClimbBackUpHandsOnly);
? (handsOnly ? SmartMovingClientConfig.ClimbBackHead : SmartMovingClientConfig.ClimbBackHeadHandsOnly)
: (handsOnly ? SmartMovingClientConfig.ClimbBackUp : SmartMovingClientConfig.ClimbBackUpHandsOnly);

float jumpAngle = sp.rotationYaw + 180F;
if(tryJump(type, null, null, jumpAngle))
Expand Down Expand Up @@ -1823,7 +1823,7 @@ public void handleJumping()
else
{
if(jumpCharge > 0)
tryJump(Config.ChargeUp, null, null, null);
tryJump(SmartMovingClientConfig.ChargeUp, null, null, null);
jumpCharge = 0;
}
else
Expand All @@ -1844,7 +1844,7 @@ public void handleJumping()
else
{
if(headJumpCharge > 0 && sp.onGround)
tryJump(Config.HeadUp, null, null, null);
tryJump(SmartMovingClientConfig.HeadUp, null, null, null);
headJumpCharge = 0;
}
else
Expand All @@ -1861,7 +1861,7 @@ public void handleJumping()
sp.motionY -= 0.039999999105930328D;
if(!isStillSwimmingJump && sp.onGround && jumpCharge == 0)
{
if(tryJump(Config.Up, true, null, null))
if(tryJump(SmartMovingClientConfig.Up, true, null, null))
{
Random rand = sp.getRNG();
playSound("random.splash", 0.05F, 1.0F + (rand.nextFloat() - rand.nextFloat()) * 0.4F);
Expand All @@ -1870,7 +1870,7 @@ public void handleJumping()
}

if(jump && !blockJumpTillButtonRelease && !isJumpCharging && !isHeadJumpCharging && !isVineAnyClimbing)
tryJump(Config.Up, false, null, null);
tryJump(SmartMovingClientConfig.Up, false, null, null);

int left = 0;
int back = 0;
Expand All @@ -1891,7 +1891,7 @@ else if(left < 0)
else
angle = 180;

if(tryJump(Config.Angle, null, null, sp.rotationYaw + angle))
if(tryJump(SmartMovingClientConfig.Angle, null, null, sp.rotationYaw + angle))
angleJumpType = ((360 - angle) / 45) % 8;

leftJumpCount = 0;
Expand All @@ -1910,13 +1910,13 @@ public void handleWallJumping()
{
if(sp.fallDistance > Config._wallHeadJumpFallMaximumDistance.value)
return;
jumpType = wasCollidedHorizontally ? Config.WallHeadSlide : Config.WallHead;
jumpType = wasCollidedHorizontally ? SmartMovingClientConfig.WallHeadSlide : SmartMovingClientConfig.WallHead;
}
else
{
if(sp.fallDistance > Config._wallUpJumpFallMaximumDistance.value)
return;
jumpType = wasCollidedHorizontally ? Config.WallUpSlide : Config.WallUp;
jumpType = wasCollidedHorizontally ? SmartMovingClientConfig.WallUpSlide : SmartMovingClientConfig.WallUp;
}

float jumpAngle;
Expand Down Expand Up @@ -1956,17 +1956,17 @@ public void handleWallJumping()
public boolean tryJump(int type, Boolean inWaterOrNull, Boolean isRunningOrNull, Float angle)
{
boolean noVertical = false;
if(type == Config.WallUpSlide || type == Config.WallHeadSlide)
if(type == SmartMovingClientConfig.WallUpSlide || type == SmartMovingClientConfig.WallHeadSlide)
{
type = type == Config.WallUpSlide ? Config.WallUp : Config.WallHead;
type = type == SmartMovingClientConfig.WallUpSlide ? SmartMovingClientConfig.WallUp : SmartMovingClientConfig.WallHead;
noVertical = true;
}

boolean inWater = inWaterOrNull != null ? inWaterOrNull : isDipping;
boolean isRunning = isRunningOrNull != null ? isRunningOrNull : isRunning();
boolean charged = type == Config.ChargeUp;
boolean up = type == Config.Up || type == Config.ChargeUp || type == Config.HeadUp || type == Config.ClimbUp || type == Config.ClimbUpHandsOnly || type == Config.ClimbBackUp || type == Config.ClimbBackUpHandsOnly || type == Config.ClimbBackHead || type == Config.ClimbBackHeadHandsOnly || type == Config.Angle || type == Config.WallUp || type == Config.WallHead;
boolean head = type == Config.HeadUp || type == Config.ClimbBackHead || type == Config.ClimbBackHeadHandsOnly || type == Config.WallHead;
boolean charged = type == SmartMovingClientConfig.ChargeUp;
boolean up = type == SmartMovingClientConfig.Up || type == SmartMovingClientConfig.ChargeUp || type == SmartMovingClientConfig.HeadUp || type == SmartMovingClientConfig.ClimbUp || type == SmartMovingClientConfig.ClimbUpHandsOnly || type == SmartMovingClientConfig.ClimbBackUp || type == SmartMovingClientConfig.ClimbBackUpHandsOnly || type == SmartMovingClientConfig.ClimbBackHead || type == SmartMovingClientConfig.ClimbBackHeadHandsOnly || type == SmartMovingClientConfig.Angle || type == SmartMovingClientConfig.WallUp || type == SmartMovingClientConfig.WallHead;
boolean head = type == SmartMovingClientConfig.HeadUp || type == SmartMovingClientConfig.ClimbBackHead || type == SmartMovingClientConfig.ClimbBackHeadHandsOnly || type == SmartMovingClientConfig.WallHead;

int speed = getJumpSpeed(isStanding, isSlow, isRunning, isFast, angle);
boolean enabled = Config.isJumpingEnabled(speed, type);
Expand Down Expand Up @@ -2026,7 +2026,7 @@ public boolean tryJump(int type, Boolean inWaterOrNull, Boolean isRunningOrNull,
if(angle != null)
{
float jumpAngle = angle / RadiantToAngle;
boolean reset = type == Config.WallUp || type == Config.WallHead;
boolean reset = type == SmartMovingClientConfig.WallUp || type == SmartMovingClientConfig.WallHead;

double horizontal = Math.max(horizontalMotion, horizontalJumpFactor);
double moveX = -Math.sin(jumpAngle);
Expand Down Expand Up @@ -2095,15 +2095,15 @@ private static int getJumpSpeed(boolean isStanding, boolean isSlow, boolean isRu
isRunning &= angle == null;

if(isSprinting)
return Config.Sprinting;
return SmartMovingClientConfig.Sprinting;
else if(isRunning)
return Config.Running;
return SmartMovingClientConfig.Running;
else if(isSlow)
return Config.Sneaking;
return SmartMovingClientConfig.Sneaking;
else if(isStanding)
return Config.Standing;
return SmartMovingClientConfig.Standing;
else
return Config.Walking;
return SmartMovingClientConfig.Walking;
}

private void standupIfPossible()
Expand Down Expand Up @@ -2343,7 +2343,7 @@ else if(isCrawling)
contextContinueCrawl = false;

if (wasCrawling && !isCrawling && esp.capabilities.isFlying)
tryJump(Config.Up, null, null, null);
tryJump(SmartMovingClientConfig.Up, null, null, null);

wantCrawlNotClimb =
(
Expand Down Expand Up @@ -2451,7 +2451,7 @@ else if(!isLevitating && wasLevitating)
{
setHeightOffset(-1);
move(0, (-1D), 0, true);
tryJump(Config.SlideDown, false, wasRunning, null);
tryJump(SmartMovingClientConfig.SlideDown, false, wasRunning, null);
isSliding = true;
isHeadJumping = false;
isAerodynamic = false;
Expand Down
Loading

0 comments on commit c2a4848

Please sign in to comment.