Skip to content

Commit

Permalink
Fix broken stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmeow committed Nov 21, 2019
1 parent 71a1383 commit c2fe554
Show file tree
Hide file tree
Showing 12 changed files with 114 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

import java.util.EnumSet;
import java.util.function.Function;

import com.google.common.base.Predicate;
import java.util.function.Predicate;

import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
Expand All @@ -16,8 +15,6 @@

public class EntityAIEatGrassCustom extends Goal {

// wtf jvm
@SuppressWarnings("unchecked")
private static final Predicate<BlockState> IS_GRASS = (Predicate<BlockState>) BlockStateMatcher.forBlock(Blocks.GRASS);
protected final MobEntity eater;
protected final World world;
Expand All @@ -39,25 +36,29 @@ public EntityAIEatGrassCustom(MobEntity eater, int childChance, int adultChance,
this.setMutexFlags(EnumSet.of(Goal.Flag.MOVE, Goal.Flag.LOOK, Goal.Flag.JUMP));
}

@Override
public boolean shouldExecute() {
if(this.eater.getRNG().nextInt(this.eater.isChild() ? childChance : adultChance) != 0) {
return false;
} else {
BlockPos blockpos = getPosition.apply(eater);
return IS_GRASS.apply(this.world.getBlockState(blockpos)) || this.world.getBlockState(blockpos.down()).getBlock() == Blocks.GRASS;
return IS_GRASS.test(this.world.getBlockState(blockpos)) || this.world.getBlockState(blockpos.down()).getBlock() == Blocks.GRASS;
}
}

@Override
public void startExecuting() {
this.eatingGrassTimer = 40;
this.world.setEntityState(this.eater, (byte) 10);
this.eater.getNavigator().clearPath();
}

@Override
public void resetTask() {
this.eatingGrassTimer = 0;
}

@Override
public boolean shouldContinueExecuting() {
return this.eatingGrassTimer > 0;
}
Expand All @@ -66,11 +67,12 @@ public int getEatingGrassTimer() {
return this.eatingGrassTimer;
}

public void updateTask() {
@Override
public void tick() {
this.eatingGrassTimer = Math.max(0, this.eatingGrassTimer - 1);
if(this.eatingGrassTimer == 4) {
BlockPos blockpos = this.getPosition.apply(eater);
if(IS_GRASS.apply(this.world.getBlockState(blockpos))) {
if(IS_GRASS.test(this.world.getBlockState(blockpos))) {
if(net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this.eater)) {
this.world.destroyBlock(blockpos, false);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"variants": {
"facing=east": { "model": "minecraft:soul_sand" },
"facing=west": { "model": "minecraft:soul_sand" },
"facing=north": { "model": "minecraft:soul_sand" },
"facing=south": { "model": "minecraft:soul_sand" },
"facing=up": { "model": "minecraft:soul_sand" }
"facing=east": { "model": "minecraft:block/soul_sand" },
"facing=west": { "model": "minecraft:block/soul_sand" },
"facing=north": { "model": "minecraft:block/soul_sand" },
"facing=south": { "model": "minecraft:block/soul_sand" },
"facing=up": { "model": "minecraft:block/soul_sand" }
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"variants": {
"facing=east": { "model": "minecraft:soul_sand" },
"facing=west": { "model": "minecraft:soul_sand" },
"facing=north": { "model": "minecraft:soul_sand" },
"facing=south": { "model": "minecraft:soul_sand" },
"facing=up": { "model": "minecraft:soul_sand" }
"facing=east": { "model": "minecraft:block/soul_sand" },
"facing=west": { "model": "minecraft:block/soul_sand" },
"facing=north": { "model": "minecraft:block/soul_sand" },
"facing=south": { "model": "minecraft:block/soul_sand" },
"facing=up": { "model": "minecraft:block/soul_sand" }
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"variants": {
"facing=east": { "model": "minecraft:soul_sand" },
"facing=west": { "model": "minecraft:soul_sand" },
"facing=north": { "model": "minecraft:soul_sand" },
"facing=south": { "model": "minecraft:soul_sand" },
"facing=up": { "model": "minecraft:soul_sand" }
"facing=east": { "model": "minecraft:block/soul_sand" },
"facing=west": { "model": "minecraft:block/soul_sand" },
"facing=north": { "model": "minecraft:block/soul_sand" },
"facing=south": { "model": "minecraft:block/soul_sand" },
"facing=up": { "model": "minecraft:block/soul_sand" }
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"variants": {
"facing=east": { "model": "minecraft:soul_sand" },
"facing=west": { "model": "minecraft:soul_sand" },
"facing=north": { "model": "minecraft:soul_sand" },
"facing=south": { "model": "minecraft:soul_sand" },
"facing=up": { "model": "minecraft:soul_sand" }
"facing=east": { "model": "minecraft:block/soul_sand" },
"facing=west": { "model": "minecraft:block/soul_sand" },
"facing=north": { "model": "minecraft:block/soul_sand" },
"facing=south": { "model": "minecraft:block/soul_sand" },
"facing=up": { "model": "minecraft:block/soul_sand" }
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"variants": {
"facing=east": { "model": "minecraft:soul_sand" },
"facing=west": { "model": "minecraft:soul_sand" },
"facing=north": { "model": "minecraft:soul_sand" },
"facing=south": { "model": "minecraft:soul_sand" },
"facing=up": { "model": "minecraft:soul_sand" }
"facing=east": { "model": "minecraft:block/soul_sand" },
"facing=west": { "model": "minecraft:block/soul_sand" },
"facing=north": { "model": "minecraft:block/soul_sand" },
"facing=south": { "model": "minecraft:block/soul_sand" },
"facing=up": { "model": "minecraft:block/soul_sand" }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "item/template_spawn_egg"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "betteranimalsplus:hirschgeistskull_1"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"entries": [
{
"type": "minecraft:item",
"name": "betteranimalsplus:hirshgeistskull_1"
"name": "betteranimalsplus:moosehead_1"
}
],
"conditions": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "betteranimalsplus:moosehead_2"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "betteranimalsplus:moosehead_3"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "betteranimalsplus:moosehead_4"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

0 comments on commit c2fe554

Please sign in to comment.