-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d8ab18f
commit 5b933ef
Showing
3 changed files
with
163 additions
and
17 deletions.
There are no files selected for viewing
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
54 changes: 54 additions & 0 deletions
54
src/main/java/net/dylan/magicmod/entity/BoulderEntity.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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package net.dylan.magicmod.entity; | ||
|
||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.data.DataTracker; | ||
import net.minecraft.entity.projectile.ProjectileEntity; | ||
import net.minecraft.entity.damage.DamageSources; | ||
import net.minecraft.nbt.NbtCompound; | ||
import net.minecraft.util.hit.EntityHitResult; | ||
import net.minecraft.util.hit.HitResult; | ||
import net.minecraft.world.World; | ||
|
||
public class BoulderEntity extends ProjectileEntity { | ||
|
||
public BoulderEntity(EntityType<? extends BoulderEntity> entityType, World world) { | ||
super(entityType, world); | ||
} | ||
|
||
protected void initDataTracker() { | ||
// Initialize data parameters if needed | ||
} | ||
|
||
@Override | ||
protected void initDataTracker(DataTracker.Builder builder) { | ||
|
||
} | ||
|
||
@Override | ||
public void tick() { | ||
super.tick(); | ||
// Add custom behavior here | ||
} | ||
|
||
@Override | ||
protected void onCollision(HitResult hitResult) { | ||
super.onCollision(hitResult); | ||
if (!this.getWorld().isClient()) { | ||
if (hitResult.getType() == HitResult.Type.ENTITY) { | ||
EntityHitResult entityHitResult = (EntityHitResult) hitResult; | ||
entityHitResult.getEntity().damage(this.getWorld().getDamageSources().thrown(this, this.getOwner()), 10.0F); | ||
} | ||
this.discard(); | ||
} | ||
} | ||
|
||
@Override | ||
public void writeCustomDataToNbt(NbtCompound nbt) { | ||
// Write custom data to NBT | ||
} | ||
|
||
@Override | ||
public void readCustomDataFromNbt(NbtCompound nbt) { | ||
// Read custom data from NBT | ||
} | ||
} |
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