-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tractor texture added & tractor now will till land behind it
Improved EntityMachineModRidable to have helper methods to aid in finding offset for 3 (or more) block wide positions in front of or behind the machine
- Loading branch information
Showing
8 changed files
with
2,944 additions
and
1,607 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
125 changes: 79 additions & 46 deletions
125
src/main/java/com/projectreddog/machinemod/entity/EntityTractor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,94 @@ | ||
package com.projectreddog.machinemod.entity; | ||
|
||
import com.projectreddog.machinemod.init.ModItems; | ||
|
||
import net.minecraft.block.Block; | ||
import net.minecraft.block.material.Material; | ||
import net.minecraft.init.Blocks; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.util.BlockPos; | ||
import net.minecraft.util.MathHelper; | ||
import net.minecraft.world.World; | ||
|
||
import com.projectreddog.machinemod.init.ModItems; | ||
|
||
public class EntityTractor extends EntityMachineModRideable { | ||
|
||
public double bladeOffset = 2.0d; | ||
|
||
public EntityTractor(World world){ | ||
super(world); | ||
setSize (1.5F , 2F); | ||
} | ||
|
||
@Override | ||
/** | ||
* Returns the Y offset from the entity's position for any entity riding this one. | ||
*/ | ||
public double getMountedYOffset() | ||
{ | ||
return (double)this.height * 0.35D; | ||
} | ||
|
||
@Override | ||
public Item getItemToBeDropped() | ||
{ | ||
return ModItems.bulldozer; | ||
} | ||
|
||
@Override | ||
public void onUpdate(){ | ||
super.onUpdate(); | ||
if (!worldObj.isRemote){ | ||
// digMethodA(); | ||
|
||
} | ||
} | ||
|
||
|
||
|
||
// /** | ||
// * Sets the forward direction of the entity. | ||
// */ | ||
// public void setForwardDirection(int value) | ||
// { | ||
// this.dataWatcher.updateObject(18, Integer.valueOf(value)); | ||
// } | ||
// | ||
// /** | ||
// * Gets the forward direction of the entity. | ||
// */ | ||
// public int getForwardDirection() | ||
// { | ||
// return this.dataWatcher.getWatchableObjectInt(18); | ||
// } | ||
|
||
@Override | ||
/** | ||
* Returns the Y offset from the entity's position for any entity riding this one. | ||
*/ | ||
public double getMountedYOffset() | ||
{ | ||
return (double)this.height * 0.55D; | ||
} | ||
|
||
@Override | ||
public Item getItemToBeDropped() | ||
{ | ||
return ModItems.bulldozer; | ||
} | ||
|
||
@Override | ||
public void onUpdate(){ | ||
super.onUpdate(); | ||
if (!worldObj.isRemote){ | ||
// digMethodA(); | ||
BlockPos bp; | ||
int angle = 0; | ||
// this will calcl the offset for three positions behind the tractor (3 wide) | ||
for (int i=-1;i <2;i++){ | ||
if (i ==0){ | ||
angle =0 ; | ||
} | ||
else | ||
{ | ||
angle =90; | ||
} | ||
bp = new BlockPos(posX + calcTwoOffsetX(-3.5,angle,i), posY -1, posZ + calcTwoOffsetZ(-3.5,angle,i)); | ||
if ( worldObj.getBlockState(bp).getBlock() == Blocks.dirt|| | ||
worldObj.getBlockState(bp).getBlock()== Blocks.grass ) | ||
{ | ||
worldObj.setBlockState(bp, Blocks.farmland.getDefaultState()); | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
||
} | ||
} | ||
@Override | ||
public double getMountedXOffset() | ||
{ | ||
return calcOffsetX(0.65d); | ||
} | ||
@Override | ||
public double getMountedZOffset() | ||
{ | ||
return calcOffsetZ(0.65d); | ||
} | ||
|
||
|
||
|
||
// /** | ||
// * Sets the forward direction of the entity. | ||
// */ | ||
// public void setForwardDirection(int value) | ||
// { | ||
// this.dataWatcher.updateObject(18, Integer.valueOf(value)); | ||
// } | ||
// | ||
// /** | ||
// * Gets the forward direction of the entity. | ||
// */ | ||
// public int getForwardDirection() | ||
// { | ||
// return this.dataWatcher.getWatchableObjectInt(18); | ||
// } | ||
} |
Oops, something went wrong.