forked from progwml6/ironchest
-
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.
Upgrade Iron Chests to 1.15.2. Textures are broken at the moment due …
…to vanilla changes.
- Loading branch information
Showing
42 changed files
with
548 additions
and
147 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,5 @@ out/ | |
.idea/ | ||
/*.iml | ||
/*.ipr | ||
/*.iws | ||
/*.iws | ||
/generated |
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
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
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
5 changes: 0 additions & 5 deletions
5
src/main/java/com/progwml6/ironchest/common/IronChestsTags.java
This file was deleted.
Oops, something went wrong.
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,16 @@ | ||
package com.progwml6.ironchest.common; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
|
||
import java.util.Arrays; | ||
import java.util.Locale; | ||
import java.util.stream.Collectors; | ||
|
||
public class Util { | ||
|
||
public static String toEnglishName(String internalName) { | ||
return Arrays.stream(internalName.toLowerCase(Locale.ROOT).split("_")) | ||
.map(StringUtils::capitalize) | ||
.collect(Collectors.joining(" ")); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/com/progwml6/ironchest/common/ai/CatsSitOnChestsHandler.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,32 @@ | ||
package com.progwml6.ironchest.common.ai; | ||
|
||
import net.minecraft.entity.ai.goal.CatSitOnBlockGoal; | ||
import net.minecraft.entity.ai.goal.PrioritizedGoal; | ||
import net.minecraft.entity.passive.CatEntity; | ||
import net.minecraftforge.event.entity.living.LivingEvent; | ||
import net.minecraftforge.eventbus.api.SubscribeEvent; | ||
|
||
import java.util.HashSet; | ||
|
||
public class CatsSitOnChestsHandler { | ||
|
||
@SubscribeEvent | ||
public void changeSittingTaskForOcelots(final LivingEvent.LivingUpdateEvent evt) { | ||
if (evt.getEntityLiving().ticksExisted < 5 && evt.getEntityLiving() instanceof CatEntity) { | ||
HashSet<PrioritizedGoal> goals = new HashSet<>(); | ||
|
||
CatEntity catEntity = (CatEntity) evt.getEntityLiving(); | ||
|
||
for (PrioritizedGoal goal : catEntity.goalSelector.goals) { | ||
if (goal.getGoal().getClass() == CatSitOnBlockGoal.class) { | ||
goals.add(goal); | ||
} | ||
} | ||
|
||
for (PrioritizedGoal goal : goals) { | ||
catEntity.goalSelector.removeGoal(goal.getGoal()); | ||
catEntity.goalSelector.addGoal(goal.getPriority(), new IronChestCatSitOnBlockGoal(catEntity, 0.4F)); | ||
} | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/com/progwml6/ironchest/common/ai/IronChestCatSitOnBlockGoal.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,34 @@ | ||
package com.progwml6.ironchest.common.ai; | ||
|
||
import com.progwml6.ironchest.common.block.GenericIronChestBlock; | ||
import com.progwml6.ironchest.common.block.tileentity.GenericIronChestTileEntity; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.entity.ai.goal.CatSitOnBlockGoal; | ||
import net.minecraft.entity.passive.CatEntity; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.IWorldReader; | ||
|
||
public class IronChestCatSitOnBlockGoal extends CatSitOnBlockGoal { | ||
|
||
public IronChestCatSitOnBlockGoal(CatEntity catEntity, double p_i50330_2_) { | ||
super(catEntity, p_i50330_2_); | ||
} | ||
|
||
@Override | ||
protected boolean shouldMoveTo(IWorldReader worldIn, BlockPos pos) { | ||
if (!worldIn.isAirBlock(pos.up())) { | ||
return false; | ||
} | ||
else { | ||
BlockState blockstate = worldIn.getBlockState(pos); | ||
Block block = blockstate.getBlock(); | ||
|
||
if (block instanceof GenericIronChestBlock) { | ||
return GenericIronChestTileEntity.getPlayersUsing(worldIn, pos) < 1; | ||
} | ||
|
||
return super.shouldMoveTo(worldIn, pos); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.