Skip to content

Commit

Permalink
Update to 1.1.35 for Fabric
Browse files Browse the repository at this point in the history
  • Loading branch information
ZestyBlaze committed Jun 22, 2023
1 parent b15a888 commit 7f873ac
Show file tree
Hide file tree
Showing 19 changed files with 63 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.minecraft.world.phys.AABB;

import java.util.ArrayList;
import java.util.List;

public class HealerStandingStone extends BEBase {
private static final int RADIUS = 10;
Expand Down Expand Up @@ -40,7 +41,7 @@ public void saveAdditional(CompoundTag tag) {
public static void serverTick(Level level, BlockPos pos, BlockState state, HealerStandingStone tile) {
tile.ticker++;
if (tile.ticker % 20 == 0) {
ArrayList<LivingEntity> nearbyCreatures = (ArrayList<LivingEntity>) level.getEntitiesOfClass(LivingEntity.class,
List<LivingEntity> nearbyCreatures = level.getEntitiesOfClass(LivingEntity.class,
new AABB(pos.getX() - RADIUS, pos.getY() - RADIUS, pos.getZ() - RADIUS,
pos.getX() + RADIUS, pos.getY() + RADIUS, pos.getZ() + RADIUS));
for (LivingEntity nearbyCreature : nearbyCreatures) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.minecraft.world.phys.AABB;

import java.util.ArrayList;
import java.util.List;

public class ComponentAllium extends ComponentBase {

Expand All @@ -25,7 +26,7 @@ public ComponentAllium() {
public void doEffect(Level level, Entity casterEntity, EnumCastType type, double x, double y, double z, double potency, double duration, double size) {
if (type == EnumCastType.SPELL && casterEntity instanceof LivingEntity caster) {
// int damageDealt = 0;
ArrayList<LivingEntity> targets = (ArrayList<LivingEntity>) level.getEntitiesOfClass(LivingEntity.class, new AABB(x - size, y - size, z - size, x + size, y + size, z + size));
List<LivingEntity> targets = level.getEntitiesOfClass(LivingEntity.class, new AABB(x - size, y - size, z - size, x + size, y + size, z + size));
targets.removeIf(target -> target.getUUID() == casterEntity.getUUID());
for (LivingEntity target : targets) {
if (target instanceof Player && RootsConfig.COMMON.disablePVP.get()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.minecraft.world.level.Level;

import java.util.ArrayList;
import java.util.List;

public class ComponentApple extends ComponentBase {

Expand All @@ -20,7 +21,7 @@ public ComponentApple() {
@Override
public void doEffect(Level level, Entity caster, EnumCastType type, double x, double y, double z, double potency, double duration, double size) {
if (type == EnumCastType.SPELL && caster instanceof Player player) {
ArrayList<MobEffectInstance> effects = new ArrayList<>(player.getActiveEffects());
List<MobEffectInstance> effects = new ArrayList<>(player.getActiveEffects());
player.removeAllEffects();
for (MobEffectInstance effect : effects) {
/* //TODO: Fabric doesn't have Blood Magic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import net.minecraft.world.phys.Vec3;

import java.util.ArrayList;
import java.util.List;

public class ComponentBlueOrchid extends ComponentBase {

Expand All @@ -33,7 +34,7 @@ public void doEffect(Level level, Entity casterEntity, EnumCastType type, double
level.setBlockAndUpdate(pos, state);
}
level.setBlockAndUpdate(pos.above(), state);
ArrayList<LivingEntity> targets = (ArrayList<LivingEntity>) level.getEntitiesOfClass(LivingEntity.class, new AABB(pos.getX() - size, pos.getY() - size, pos.getZ() - size, pos.getX() + size, pos.getY() + size, pos.getZ() + size));
List<LivingEntity> targets = level.getEntitiesOfClass(LivingEntity.class, new AABB(pos.getX() - size, pos.getY() - size, pos.getZ() - size, pos.getX() + size, pos.getY() + size, pos.getZ() + size));
targets.removeIf(target -> target.getUUID() == casterEntity.getUUID());

for (LivingEntity target : targets) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import net.minecraft.world.phys.Vec3;

import java.util.ArrayList;
import java.util.List;

public class ComponentDandelion extends ComponentBase {

Expand All @@ -21,7 +22,7 @@ public ComponentDandelion() {
@Override
public void doEffect(Level level, Entity caster, EnumCastType type, double x, double y, double z, double potency, double duration, double size) {
if (type == EnumCastType.SPELL) {
ArrayList<LivingEntity> targets = (ArrayList<LivingEntity>) level.getEntitiesOfClass(LivingEntity.class, new AABB(x - size, y - size, z - size, x + size, y + size, z + size));
List<LivingEntity> targets = level.getEntitiesOfClass(LivingEntity.class, new AABB(x - size, y - size, z - size, x + size, y + size, z + size));
targets.removeIf(target -> target.getUUID() == caster.getUUID());
for (LivingEntity target : targets) {
target.setDeltaMovement(new Vec3(caster.getLookAngle().x, (float) (potency == 0 ? 1.0 : 1.0 + 0.5 * potency), caster.getLookAngle().z));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import net.minecraft.world.phys.AABB;

import java.util.ArrayList;
import java.util.List;

public class ComponentMidnightBloom extends ComponentBase {

Expand All @@ -21,7 +22,7 @@ public ComponentMidnightBloom() {
@Override
public void doEffect(Level level, Entity caster, EnumCastType type, double x, double y, double z, double potency, double duration, double size) {
if (type == EnumCastType.SPELL) {
ArrayList<LivingEntity> targets = (ArrayList<LivingEntity>) level.getEntitiesOfClass(LivingEntity.class,
List<LivingEntity> targets = level.getEntitiesOfClass(LivingEntity.class,
new AABB(x - size * 6.0, y - size * 6.0, z - size * 6.0, x + size * 6.0, y + size * 6.0, z + size * 6.0));
targets.removeIf(target -> target.getUUID() == caster.getUUID());
for (LivingEntity target : targets) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.minecraft.world.phys.AABB;

import java.util.ArrayList;
import java.util.List;

public class ComponentNetherWart extends ComponentBase {

Expand All @@ -25,7 +26,7 @@ public ComponentNetherWart() {
public void doEffect(Level level, Entity casterEntity, EnumCastType type, double x, double y, double z, double potency, double duration, double size) {
if (type == EnumCastType.SPELL) {
// int damageDealt = 0;
ArrayList<LivingEntity> targets = (ArrayList<LivingEntity>) level.getEntitiesOfClass(LivingEntity.class, new AABB(x - size, y - size, z - size, x + size, y + size, z + size));
List<LivingEntity> targets = level.getEntitiesOfClass(LivingEntity.class, new AABB(x - size, y - size, z - size, x + size, y + size, z + size));
for (LivingEntity target : targets) {
if (target.getUUID() != casterEntity.getUUID() && casterEntity instanceof LivingEntity caster) {
if (target instanceof Player && RootsConfig.COMMON.disablePVP.get()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.minecraft.world.phys.AABB;

import java.util.ArrayList;
import java.util.List;

public class ComponentPinkTulip extends ComponentBase {

Expand All @@ -24,7 +25,7 @@ public ComponentPinkTulip() {
@Override
public void doEffect(Level level, Entity casterEntity, EnumCastType type, double x, double y, double z, double potency, double duration, double size) {
if (type == EnumCastType.SPELL && casterEntity instanceof LivingEntity caster) {
ArrayList<LivingEntity> targets = (ArrayList<LivingEntity>) level.getEntitiesOfClass(LivingEntity.class, new AABB(x - size, y - size, z - size, x + size, y + size, z + size));
List<LivingEntity> targets = level.getEntitiesOfClass(LivingEntity.class, new AABB(x - size, y - size, z - size, x + size, y + size, z + size));
targets.removeIf(target -> target.getUUID() == casterEntity.getUUID());
for (LivingEntity target : targets) {
if (target instanceof Player && RootsConfig.COMMON.disablePVP.get()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import net.minecraft.world.phys.AABB;

import java.util.ArrayList;
import java.util.List;

public class ComponentRose extends ComponentBase {

Expand All @@ -25,7 +26,7 @@ public ComponentRose() {
@Override
public void doEffect(Level level, Entity casterEntity, EnumCastType type, double x, double y, double z, double potency, double duration, double size) {
if (type == EnumCastType.SPELL && casterEntity instanceof LivingEntity caster) {
ArrayList<LivingEntity> targets = (ArrayList<LivingEntity>) level.getEntitiesOfClass(LivingEntity.class, new AABB(x - size, y - size, z - size, x + size, y + size, z + size));
List<LivingEntity> targets = level.getEntitiesOfClass(LivingEntity.class, new AABB(x - size, y - size, z - size, x + size, y + size, z + size));
// int damageDealt = 0;
targets.removeIf(target -> target.getUUID() == casterEntity.getUUID());
for (LivingEntity target : targets) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import net.minecraft.world.phys.AABB;

import java.util.ArrayList;
import java.util.List;

public class ComponentWhiteTulip extends ComponentBase {

Expand All @@ -27,7 +28,7 @@ public ComponentWhiteTulip() {
public void doEffect(Level level, Entity casterEntity, EnumCastType type, double x, double y, double z, double potency, double duration, double size) {
if (type == EnumCastType.SPELL && casterEntity instanceof LivingEntity caster) {
// int damageDealt = 0;
ArrayList<LivingEntity> targets = (ArrayList<LivingEntity>) level.getEntitiesOfClass(LivingEntity.class, new AABB(x - size, y - size, z - size, x + size, y + size, z + size));
List<LivingEntity> targets = level.getEntitiesOfClass(LivingEntity.class, new AABB(x - size, y - size, z - size, x + size, y + size, z + size));
targets.removeIf(target -> target.getUUID() == casterEntity.getUUID());
for (LivingEntity target : targets) {
if (target instanceof Player && RootsConfig.COMMON.disablePVP.get()) {
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/elucent/rootsclassic/entity/EntityAccelerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ public void tick() {
}
}
}
lifetime--;
if (lifetime <= 0) {
this.level.broadcastEntityEvent(this, (byte) 3);
this.discard();
if (!level.isClientSide) {
lifetime--;
if (lifetime <= 0) {
this.level.broadcastEntityEvent(this, (byte) 3);
this.discard();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,12 @@ public void tick() {
getX() + random.nextDouble(), getY() + random.nextDouble(), getZ() + 1.0, 0, 0, 0);
}
}
} else {
if (this.tickCount >= lifetime) {
this.level.broadcastEntityEvent(this, (byte) 3);
this.discard();
if (!level.isClientSide) {
lifetime--;
if (lifetime <= 0) {
this.level.broadcastEntityEvent(this, (byte) 3);
this.discard();
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

public class MutagenManager {

public static final ArrayList<MutagenRecipe> recipes = new ArrayList<>();
public static final List<MutagenRecipe> recipes = new ArrayList<>();

public static void reload() {
recipes.add(new MutagenMidnightBloomRecipe());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

public class MutagenRecipe {

final ArrayList<ItemStack> inputs = new ArrayList<>();
final List<ItemStack> inputs = new ArrayList<>();
final ResourceLocation name;
final BlockState plantBlock;
public final BlockState result;
Expand All @@ -33,7 +33,7 @@ public void addIngredient(ItemStack stack) {

public boolean matches(List<ItemStack> items, Level levelAccessor, BlockPos pos, Player player) {
if (levelAccessor.getBlockState(pos).getBlock() == plantBlock.getBlock()) {
ArrayList<ItemStack> tempItems = new ArrayList<>(items);
List<ItemStack> tempItems = new ArrayList<>(items);
for (ItemStack input : inputs) {
boolean endIteration = false;
for (int j = 0; j < tempItems.size() && !endIteration; j++) {
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/elucent/rootsclassic/research/ResearchBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
import net.minecraft.world.item.ItemStack;

import java.util.ArrayList;
import java.util.List;

public class ResearchBase {
public double posX = 0;
public double posY = 0;
private String name = "";
private final ItemStack icon;
private final ResearchBase req = null;
private final ArrayList<ResearchPage> info = new ArrayList<>();
private final List<ResearchPage> info = new ArrayList<>();

public ResearchBase(String name, ItemStack icon) {
this.name = name;
Expand All @@ -34,7 +35,7 @@ public ResearchBase getReq() {
return req;
}

public ArrayList<ResearchPage> getInfo() {
public List<ResearchPage> getInfo() {
return info;
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package elucent.rootsclassic.research;

import java.util.ArrayList;
import java.util.List;

public class ResearchGroup {
private String name = "";
private String properName = "";
public ArrayList<ResearchBase> researches = new ArrayList<>();
public List<ResearchBase> researches = new ArrayList<>();

public ResearchGroup(String name, String properName) {
this.name = name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
import net.minecraft.world.level.block.Blocks;

import java.util.ArrayList;
import java.util.List;

public class ResearchManager {
public static ArrayList<ResearchGroup> globalResearches = new ArrayList<>();
public static List<ResearchGroup> globalResearches = new ArrayList<>();

public static void onRecipesUpdated() {
RecipesUpdatedCallback.EVENT.register(ResearchManager::reload);
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/elucent/rootsclassic/research/ResearchPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,24 @@
import net.minecraft.world.item.ItemStack;

import java.util.ArrayList;
import java.util.List;

public class ResearchPage {
public ArrayList<ItemStack> craftingRecipe = new ArrayList<>();
public List<ItemStack> craftingRecipe = new ArrayList<>();
public ComponentRecipe mortarRecipe = null;
public RitualBase altarRecipe = null;
public ArrayList<ItemStack> smeltingRecipe = new ArrayList<>();
public List<ItemStack> smeltingRecipe = new ArrayList<>();
public EnumPageType recipe = EnumPageType.TYPE_NULL;
public ItemStack displayItem = null;
public ArrayList<String> info = new ArrayList<>();
public List<String> info = new ArrayList<>();
public String title = "";

public ResearchPage() {
}

public ArrayList<String> makeLines(String s) {
ArrayList<String> list = new ArrayList<>();
ArrayList<String> words = new ArrayList<>();
public List<String> makeLines(String s) {
List<String> list = new ArrayList<>();
List<String> words = new ArrayList<>();
StringBuilder temp = new StringBuilder();
int counter = 0;
for (int i = 0; i < s.length(); i++) {
Expand Down
28 changes: 14 additions & 14 deletions src/main/java/elucent/rootsclassic/util/RootsUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ public static int intColor(int r, int g, int b) {
}

public static boolean itemListMatchInventoryWithSize(Container i1, List<ItemStack> i2) {
ArrayList<ItemStack> recipe = new ArrayList<>();
List<ItemStack> recipe = new ArrayList<>();
for (int i = 0; i < i1.getContainerSize(); i++) {
recipe.add(i1.getItem(i));
}
ArrayList<ItemStack> available = new ArrayList<>(i2);
List<ItemStack> available = new ArrayList<>(i2);
for (int i = 0; i < recipe.size(); i++) {
if (recipe.get(i).isEmpty()) {
recipe.remove(i);
Expand Down Expand Up @@ -112,11 +112,11 @@ public static boolean itemListMatchInventoryWithSize(Container i1, List<ItemStac
}

public static boolean itemListMatchInventory(Container i1, List<ItemStack> i2) {
ArrayList<ItemStack> recipe = new ArrayList<>();
List<ItemStack> recipe = new ArrayList<>();
for (int i = 0; i < i1.getContainerSize(); i++) {
recipe.add(i1.getItem(i));
}
ArrayList<ItemStack> available = new ArrayList<>(i2);
List<ItemStack> available = new ArrayList<>(i2);
for (int i = 0; i < recipe.size(); i++) {
if (recipe.get(i).isEmpty()) {
recipe.remove(i);
Expand Down Expand Up @@ -144,8 +144,8 @@ public static boolean itemListMatchInventory(Container i1, List<ItemStack> i2) {
}

public static boolean itemListMatchesIngredients(List<Ingredient> i1, List<ItemStack> i2) {
ArrayList<Ingredient> recipe = new ArrayList<>(i1);
ArrayList<ItemStack> available = new ArrayList<>(i2);
List<Ingredient> recipe = new ArrayList<>(i1);
List<ItemStack> available = new ArrayList<>(i2);
for (int i = 0; i < recipe.size(); i++) {
if (recipe.get(i).isEmpty()) {
recipe.remove(i);
Expand Down Expand Up @@ -173,8 +173,8 @@ public static boolean itemListMatchesIngredients(List<Ingredient> i1, List<ItemS
}

public static boolean itemListMatchesIngredientsWithSize(List<Ingredient> i1, List<ItemStack> i2) {
ArrayList<Ingredient> recipe = new ArrayList<>(i1);
ArrayList<ItemStack> available = new ArrayList<>(i2);
List<Ingredient> recipe = new ArrayList<>(i1);
List<ItemStack> available = new ArrayList<>(i2);
for (int i = 0; i < recipe.size(); i++) {
if (recipe.get(i).isEmpty()) {
recipe.remove(i);
Expand Down Expand Up @@ -202,8 +202,8 @@ public static boolean itemListMatchesIngredientsWithSize(List<Ingredient> i1, Li
}

public static boolean itemListsMatchWithSize(List<ItemStack> i1, List<ItemStack> i2) {
ArrayList<ItemStack> recipe = new ArrayList<>(i1);
ArrayList<ItemStack> available = new ArrayList<>(i2);
List<ItemStack> recipe = new ArrayList<>(i1);
List<ItemStack> available = new ArrayList<>(i2);
for (int i = 0; i < recipe.size(); i++) {
if (recipe.get(i).isEmpty()) {
recipe.remove(i);
Expand Down Expand Up @@ -231,8 +231,8 @@ public static boolean itemListsMatchWithSize(List<ItemStack> i1, List<ItemStack>
}

public static boolean itemListsMatch(List<ItemStack> i1, List<ItemStack> i2) {
ArrayList<ItemStack> recipe = new ArrayList<>(i1);
ArrayList<ItemStack> available = new ArrayList<>(i2);
List<ItemStack> recipe = new ArrayList<>(i1);
List<ItemStack> available = new ArrayList<>(i2);
for (int i = 0; i < recipe.size(); i++) {
if (recipe.get(i).isEmpty()) {
recipe.remove(i);
Expand Down Expand Up @@ -260,8 +260,8 @@ public static boolean itemListsMatch(List<ItemStack> i1, List<ItemStack> i2) {
}

public static boolean ingredientListMatch(List<Ingredient> i1, List<Ingredient> i2) {
ArrayList<Ingredient> recipe = new ArrayList<>(i1);
ArrayList<Ingredient> available = new ArrayList<>(i2);
List<Ingredient> recipe = new ArrayList<>(i1);
List<Ingredient> available = new ArrayList<>(i2);
for (int i = 0; i < recipe.size(); i++) {
if (recipe.get(i).isEmpty()) {
recipe.remove(i);
Expand Down

0 comments on commit 7f873ac

Please sign in to comment.