Skip to content

Commit

Permalink
Asjustements in CargoLift Script.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fexcraft committed Dec 7, 2018
1 parent be8c21c commit 0c976de
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
4 changes: 4 additions & 0 deletions run/addons/Heavy Cargo Pack/assets/hcp/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ script.hcp:container_crane.speed=Movement Speed
script.hcp:container_crane.stepwise=Stepwise Movement
script.hcp:container_crane.searchbox=Toggle Searchbox
script.hcp:container_crane.length=Rail Length
script.hcp:container_lift.expected=Position (exp.)
script.hcp:container_lift.trycatch=Try Catch
script.hcp:container_lift.release=Release
script.hcp:container_lift.align=Try Align



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ private boolean aligned(){
}

protected void tryRelease(EntityPlayer player, VehicleEntity ent){
if(data == null){ Print.chat(player, "Not holding a Container."); return; }
if(!aligned()){ Print.chat(player, "Please align the Vehicle first."); return; }
if(current != expected){ Print.chat(player, "Still moving, please wait.");return;}
if(data == null){ Print.chat(player, "&7Not holding a Container."); return; }
if(!aligned()){ Print.chat(player, "&2Please align the Vehicle first."); return; }
if(current != expected){ Print.chat(player, "&aStill moving, please wait.");return;}
Vec3d pos = ent.getEntity().getPositionVector().addVector(0, (-expected) - 3, 0);
BlockPos blkpos = new BlockPos(pos);
EnumFacing facing = EnumFacing.fromAngle(ent.getAxes().getYaw()/* + 90 */);
Expand All @@ -197,23 +197,23 @@ protected void tryRelease(EntityPlayer player, VehicleEntity ent){
state.getBlock().onBlockPlacedBy(ent.getEntity().world, bp, state.withProperty(ContainerBlock.FACING, facing), player, stack);
});
this.data = null;
Print.chat(player, "Container Placed.");
Print.chat(player, "&9Container Placed.");
}
catch(Exception e){
e.printStackTrace();
Print.chat(player, "ERROR: See Console/Log.");
Print.chat(player, "&cERROR: See Console/Log.");
}
}
else{
Print.chat(player, "Invalid position for a container.");
Print.chat(player, "&cInvalid position for a container.");
}
return;
}

protected void tryCatch(EntityPlayer player, VehicleEntity ent){
if(data != null){ Print.chat(player, "Already holding a Container."); return; }
if(!aligned()){ Print.chat(player, "Please align the Vehicle first."); return; }
if(current != expected){ Print.chat(player, "Still moving, please wait.");return;}
if(data != null){ Print.chat(player, "&7Already holding a Container."); return; }
if(!aligned()){ Print.chat(player, "&2Please align the Vehicle first."); return; }
if(current != expected){ Print.chat(player, "&aStill moving, please wait.");return;}
Vec3d pos = ent.getEntity().getPositionVector().addVector(0, (-expected) - 3, 0);
BlockPos blkpos = new BlockPos(pos);
IBlockState state = ent.getEntity().world.getBlockState(blkpos);
Expand All @@ -222,16 +222,16 @@ protected void tryCatch(EntityPlayer player, VehicleEntity ent){
if(te.isCore()){
this.data = te.getContainerData();
te.notifyBreak(ent.getEntity().world, blkpos, state, false);
Print.chat(player, "Container: " + data.getContainer().getName());
Print.chat(player, "&7Container: &9" + data.getContainer().getName());
}
else{
Print.chat(player, "Not the Container core. ");
Print.chat(player, blkpos.toString());
Print.chat(player, te.getPos().toString());
Print.chat(player, "&cNot the Container core. ");
//Print.chat(player, blkpos.toString());
//Print.chat(player, te.getPos().toString());
}
}
else{
Print.chat(player, "No Container at position found. " + blkpos.toString());
Print.chat(player, "&cNo Container at position found.");
}
//ent.getEntity().world.setBlockState(blkpos, Blocks.ANVIL.getDefaultState(), 2);
Print.debug(pos, blkpos);
Expand Down

0 comments on commit 0c976de

Please sign in to comment.