Skip to content

Commit

Permalink
Raytracing null protection.
Browse files Browse the repository at this point in the history
Signed-off-by: King Lemming <[email protected]>
  • Loading branch information
KingLemming committed Jan 2, 2018
1 parent 7b84a37 commit f48ba3a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ dependencies {
compile "cofh:ThermalFoundation:${config.mc_version}-${config.tf_version}:deobf"
}

version = "${project.config.mod_version}." + (System.getenv("BUILD_NUMBER") ?: "11")
version = "${project.config.mod_version}." + (System.getenv("BUILD_NUMBER") ?: "1")

println config.mc_version + "-" + config.forge_version
// Setup the Forge/Minecraft plugin data. Specify the preferred Forge/Minecraft version here.
Expand Down
6 changes: 3 additions & 3 deletions build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ forge_version=14.23.1.2555
mappings=snapshot_20171003

# Mod Version
mod_version=0.1.3
mod_version=0.1.4

# Dependencies
rf_mc_version=1.12
rf_version=2.0.1.+
cofh_core_version=4.3.8.+
tf_version=2.3.8.+
cofh_core_version=4.3.9.+
tf_version=2.3.9.+
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class ThermalCultivation {
public static final String MOD_ID = "thermalcultivation";
public static final String MOD_NAME = "Thermal Cultivation";

public static final String VERSION = "0.1.3";
public static final String VERSION = "0.1.4";
public static final String VERSION_MAX = "1.0.0";
public static final String VERSION_GROUP = "required-after:" + MOD_ID + "@[" + VERSION + "," + VERSION_MAX + ");";
public static final String UPDATE_URL = "https://raw.github.com/cofh/version/master/" + MOD_ID + "_update.json";
Expand Down
15 changes: 8 additions & 7 deletions src/main/java/cofh/thermalcultivation/item/ItemWateringCan.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,13 @@ public double getDurabilityForDisplay(ItemStack stack) {
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {

RayTraceResult traceResult = RayTracer.retrace(player, true);
BlockPos tracePos = traceResult.getBlockPos();
ItemStack stack = player.getHeldItem(hand);

if (traceResult == null) {
return new ActionResult<>(EnumActionResult.PASS, stack);
}
BlockPos tracePos = traceResult.getBlockPos();

if (!player.isSneaking() || !world.isBlockModifiable(player, tracePos) || player instanceof FakePlayer && !allowFakePlayers) {
return new ActionResult<>(EnumActionResult.FAIL, stack);
}
Expand All @@ -209,16 +213,13 @@ public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {

RayTraceResult traceResult = RayTracer.retrace(player, true);
BlockPos tracePos = traceResult.getBlockPos();
IBlockState traceState = world.getBlockState(tracePos);

if (player instanceof FakePlayer && !allowFakePlayers) {
return EnumActionResult.FAIL;
}
if (player.isSneaking()) {
if (traceResult == null || player.isSneaking() || player instanceof FakePlayer && !allowFakePlayers) {
return EnumActionResult.FAIL;
}
ItemStack stack = player.getHeldItem(hand);
BlockPos tracePos = traceResult.getBlockPos();
IBlockState traceState = world.getBlockState(tracePos);
BlockPos offsetPos = traceState.isSideSolid(world, tracePos, traceResult.sideHit) || traceState.getMaterial().isLiquid() ? tracePos.offset(traceResult.sideHit) : tracePos;

if (getWaterStored(stack) < WATER_PER_USE[0]) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/assets/thermalcultivation/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ item.thermalcultivation.watering_can.standard4.name=Watering Can (Resonant)

itemGroup.thermalcultivation.creativeTab=Thermal Cultivation

tile.thermalcultivation.soil.basic.name=Phyto-Soil
tile.thermalcultivation.soil.flux.name=Fluxed Phyto-Soil
tile.thermalcultivation.soil.rich.name=Rich Phyto-Soil
tile.thermalcultivation.soil.basic.name=Phyto-Soil (Not Implemented)
tile.thermalcultivation.soil.flux.name=Fluxed Phyto-Soil (Not Implemented)
tile.thermalcultivation.soil.rich.name=Rich Phyto-Soil (Not Implemented)

0 comments on commit f48ba3a

Please sign in to comment.