mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
chore: ported hairy ball handler :wtf:
This commit is contained in:
parent
86ff9fb641
commit
996bf66a65
11 changed files with 40 additions and 47 deletions
|
@ -18,7 +18,7 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
|
@ -47,9 +47,9 @@ public class ItemFoods extends ItemFoodBase {
|
|||
if (StackUtil.isValid(returnItem) && player instanceof PlayerEntity) {
|
||||
if (!((PlayerEntity) player).inventory.addItemStackToInventory(returnItem.copy())) {
|
||||
if (!world.isRemote) {
|
||||
EntityItem entityItem = new EntityItem(player.world, player.posX, player.posY, player.posZ, returnItem.copy());
|
||||
ItemEntity entityItem = new ItemEntity(player.world, player.posX, player.posY, player.posZ, returnItem.copy());
|
||||
entityItem.setPickupDelay(0);
|
||||
player.world.spawnEntity(entityItem);
|
||||
player.world.addEntity(entityItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,10 +14,9 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
|||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.passive.EntityOcelot;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -33,8 +32,7 @@ public class ItemHairyBall extends ItemBase {
|
|||
private final UUID KittyVanCatUUID = UUID.fromString("681d4e20-10ef-40c9-a0a5-ba2f1995ef44");
|
||||
|
||||
public ItemHairyBall() {
|
||||
super(name);
|
||||
|
||||
super();
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
|
@ -44,8 +42,8 @@ public class ItemHairyBall extends ItemBase {
|
|||
if (ConfigBoolValues.DO_CAT_DROPS.isEnabled() && event.getEntityLiving() != null && event.getEntityLiving().world != null && !event.getEntityLiving().world.isRemote) {
|
||||
if (event.getEntityLiving() instanceof EntityOcelot && ((EntityOcelot) event.getEntityLiving()).isTamed() || event.getEntityLiving() instanceof PlayerEntity && event.getEntityLiving().getUniqueID().equals(this.KittyVanCatUUID)) {
|
||||
if (event.getEntityLiving().world.rand.nextInt(ConfigIntValues.FUR_CHANCE.getValue()) == 0) {
|
||||
EntityItem item = new EntityItem(event.getEntityLiving().world, event.getEntityLiving().posX + 0.5, event.getEntityLiving().posY + 0.5, event.getEntityLiving().posZ + 0.5, new ItemStack(ActuallyItems.itemHairyBall));
|
||||
event.getEntityLiving().world.spawnEntity(item);
|
||||
ItemEntity item = new ItemEntity(event.getEntityLiving().world, event.getEntityLiving().posX + 0.5, event.getEntityLiving().posY + 0.5, event.getEntityLiving().posZ + 0.5, new ItemStack(ActuallyItems.itemHairyBall));
|
||||
event.getEntityLiving().world.addEntity(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,9 +55,9 @@ public class ItemHairyBall extends ItemBase {
|
|||
if (!world.isRemote) {
|
||||
ItemStack returnItem = this.getRandomReturnItem(world.rand);
|
||||
if (!player.inventory.addItemStackToInventory(returnItem)) {
|
||||
EntityItem entityItem = new EntityItem(player.world, player.posX, player.posY, player.posZ, returnItem);
|
||||
ItemEntity entityItem = new ItemEntity(player.world, player.posX, player.posY, player.posZ, returnItem);
|
||||
entityItem.setPickupDelay(0);
|
||||
player.world.spawnEntity(entityItem);
|
||||
player.world.addEntity(entityItem);
|
||||
}
|
||||
stack.shrink(1);
|
||||
|
||||
|
@ -71,9 +69,4 @@ public class ItemHairyBall extends ItemBase {
|
|||
public ItemStack getRandomReturnItem(Random rand) {
|
||||
return WeightedRandom.getRandomItem(rand, ActuallyAdditionsAPI.BALL_OF_FUR_RETURN_ITEMS).returnItem.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
|
@ -82,9 +82,9 @@ public class ItemJams extends ItemFoodBase implements IColorProvidingItem {
|
|||
|
||||
ItemStack returnItem = new ItemStack(Items.GLASS_BOTTLE);
|
||||
if (!((PlayerEntity) player).inventory.addItemStackToInventory(returnItem.copy())) {
|
||||
EntityItem entityItem = new EntityItem(player.world, player.posX, player.posY, player.posZ, returnItem.copy());
|
||||
ItemEntity entityItem = new ItemEntity(player.world, player.posX, player.posY, player.posZ, returnItem.copy());
|
||||
entityItem.setPickupDelay(0);
|
||||
player.world.spawnEntity(entityItem);
|
||||
player.world.addEntity(entityItem);
|
||||
}
|
||||
}
|
||||
return stackToReturn;
|
||||
|
|
|
@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.mod.items;
|
|||
import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -46,9 +46,9 @@ public class ItemMagnetRing extends ItemEnergy {
|
|||
if (!entity.isSneaking()) {
|
||||
//Get all the Items in the area
|
||||
int range = 5;
|
||||
List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(entity.posX - range, entity.posY - range, entity.posZ - range, entity.posX + range, entity.posY + range, entity.posZ + range));
|
||||
List<ItemEntity> items = world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(entity.posX - range, entity.posY - range, entity.posZ - range, entity.posX + range, entity.posY + range, entity.posZ + range));
|
||||
if (!items.isEmpty()) {
|
||||
for (EntityItem item : items) {
|
||||
for (ItemEntity item : items) {
|
||||
if (item.getEntityData().getBoolean("PreventRemoteMovement")) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class ItemMisc extends ItemBase {
|
|||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean onEntityItemUpdate(EntityItem entity) {
|
||||
// public boolean onEntityItemUpdate(ItemEntity entity) {
|
||||
// if (!entity.world.isRemote) {
|
||||
// ItemStack stack = entity.getItem();
|
||||
// if (stack != null) {
|
||||
|
|
|
@ -14,8 +14,8 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.EntityXPOrb;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -45,7 +45,7 @@ public class ItemSolidifiedExperience extends ItemBase {
|
|||
//Drop Solidified XP
|
||||
if (event.getEntityLiving() instanceof EntityCreature) {
|
||||
if (event.getEntityLiving().world.rand.nextInt(10) <= event.getLootingLevel() * 2) {
|
||||
event.getDrops().add(new EntityItem(event.getEntityLiving().world, event.getEntityLiving().posX, event.getEntityLiving().posY, event.getEntityLiving().posZ, new ItemStack(ActuallyItems.itemSolidifiedExperience, event.getEntityLiving().world.rand.nextInt(2 + event.getLootingLevel()) + 1)));
|
||||
event.getDrops().add(new ItemEntity(event.getEntityLiving().world, event.getEntityLiving().posX, event.getEntityLiving().posY, event.getEntityLiving().posZ, new ItemStack(ActuallyItems.itemSolidifiedExperience, event.getEntityLiving().world.rand.nextInt(2 + event.getLootingLevel()) + 1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class ItemSolidifiedExperience extends ItemBase {
|
|||
if (ConfigBoolValues.SOLID_XP_ALWAYS_ORBS.currentValue || player instanceof FakePlayer) {
|
||||
EntityXPOrb orb = new EntityXPOrb(world, player.posX + 0.5, player.posY + 0.5, player.posZ + 0.5, amount);
|
||||
orb.getEntityData().putBoolean(ActuallyAdditions.MODID + "FromSolidified", true);
|
||||
world.spawnEntity(orb);
|
||||
world.addEntity(orb);
|
||||
} else {
|
||||
player.addExperience(amount);
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public class ItemWaterBowl extends ItemBase {
|
|||
if (!StackUtil.isValid(reduced)) {
|
||||
event.getPlayer().setHeldItem(event.getHand(), bowl);
|
||||
} else if (!event.getPlayer().inventory.addItemStackToInventory(bowl.copy())) {
|
||||
EntityItem entityItem = new EntityItem(event.getWorld(), event.getPlayer().posX, event.getPlayer().posY, event.getPlayer().posZ, bowl.copy());
|
||||
ItemEntity entityItem = new ItemEntity(event.getWorld(), event.getPlayer().posX, event.getPlayer().posY, event.getPlayer().posZ, bowl.copy());
|
||||
entityItem.setPickupDelay(0);
|
||||
event.getWorld().spawnEntity(entityItem);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
|||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.passive.EntityBat;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
|
@ -109,7 +109,7 @@ public class ItemWingsOfTheBats extends ItemBase {
|
|||
}
|
||||
|
||||
if (event.getEntityLiving().world.rand.nextInt(15) <= looting * 2) {
|
||||
event.getDrops().add(new EntityItem(event.getEntityLiving().world, event.getEntityLiving().posX, event.getEntityLiving().posY, event.getEntityLiving().posZ, new ItemStack(ActuallyItems.itemBatWing.get(), event.getEntityLiving().world.rand.nextInt(2 + looting) + 1)));
|
||||
event.getDrops().add(new ItemEntity(event.getEntityLiving().world, event.getEntityLiving().posX, event.getEntityLiving().posY, event.getEntityLiving().posZ, new ItemStack(ActuallyItems.itemBatWing.get(), event.getEntityLiving().world.rand.nextInt(2 + looting) + 1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
package de.ellpeck.actuallyadditions.mod.misc;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.RegistryHandler;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
|
||||
// TODO: [port] port over to deferred register
|
||||
public final class SoundHandler {
|
||||
|
||||
public static SoundEvent duhDuhDuhDuuuh;
|
||||
|
@ -34,7 +34,7 @@ public final class SoundHandler {
|
|||
|
||||
SoundEvent event = new SoundEvent(resLoc);
|
||||
event.setRegistryName(resLoc);
|
||||
RegistryHandler.SOUNDS_TO_REGISTER.add(event);
|
||||
// RegistryHandler.SOUNDS_TO_REGISTER.add(event);
|
||||
return event;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@ package de.ellpeck.actuallyadditions.mod.recipe;
|
|||
|
||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.IColorLensChanger;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.DyeColor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -13,12 +13,12 @@ import java.util.Map;
|
|||
|
||||
public class ColorLensRotator implements IColorLensChanger {
|
||||
|
||||
public static final Map<String, EnumDyeColor> STRING_TO_ENUM = new HashMap<>();
|
||||
public static final Map<String, DyeColor> STRING_TO_ENUM = new HashMap<>();
|
||||
|
||||
static {
|
||||
String[] dyes = {"White", "Orange", "Magenta", "LightBlue", "Yellow", "Lime", "Pink", "Gray", "LightGray", "Cyan", "Purple", "Blue", "Brown", "Green", "Red", "Black"};
|
||||
for (int i = 0; i < dyes.length; i++) {
|
||||
STRING_TO_ENUM.put("dye" + dyes[i], EnumDyeColor.byMetadata(i));
|
||||
STRING_TO_ENUM.put("dye" + dyes[i], DyeColor.byMetadata(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class ColorLensRotator implements IColorLensChanger {
|
|||
for (int i : OreDictionary.getOreIDs(stack)) {
|
||||
String s = OreDictionary.getOreName(i);
|
||||
if (s.startsWith("dye")) {
|
||||
EnumDyeColor color = STRING_TO_ENUM.get(s);
|
||||
DyeColor color = STRING_TO_ENUM.get(s);
|
||||
if (color != null) {
|
||||
idx = color.getMetadata();
|
||||
break;
|
||||
|
|
|
@ -12,9 +12,9 @@ package de.ellpeck.actuallyadditions.mod.recipe;
|
|||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
|
||||
public final class HairyBallHandler {
|
||||
|
||||
|
@ -22,27 +22,27 @@ public final class HairyBallHandler {
|
|||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Items.STRING), 100);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Items.DIAMOND), 2);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Items.NAME_TAG), 1);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Items.FISH), 80);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Items.FISH, 1, 1), 60);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Items.FISH, 1, 2), 10);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Items.FISH, 1, 3), 40);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Items.COD), 80);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Items.SALMON), 60);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Items.TROPICAL_FISH), 10);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Items.PUFFERFISH), 40);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Items.FEATHER), 60);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Items.LEATHER), 30);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Items.DYE), 70);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Items.BLACK_DYE), 70); // todo: expand to more dyes
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Items.CLAY_BALL), 40);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Items.STICK), 40);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Items.IRON_INGOT), 10);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Items.GOLD_INGOT), 6);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Items.BEEF), 30);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Items.ENDER_PEARL), 2);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Blocks.PLANKS), 20);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Blocks.WATERLILY), 10);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Blocks.OAK_PLANKS), 20); // todo: expand to more planks
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Blocks.LILY_PAD), 10);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Items.EXPERIENCE_BOTTLE), 3);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Blocks.GRAVEL), 40);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Blocks.SAND), 50);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Blocks.VINE), 30);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Blocks.WEB), 4);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(ActuallyItems.itemSolidifiedExperience), 20);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(Blocks.COBWEB), 4);
|
||||
ActuallyAdditionsAPI.addBallOfFurReturnItem(new ItemStack(ActuallyItems.itemSolidifiedExperience.get()), 20);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue