use of minetweaker.mc1112.item.MCItemStack in project BetterStorage by copygirl.
the class RecipeInputIngredient method craft.
@Override
public void craft(ItemStack input, ContainerInfo containerInfo) {
super.craft(input, containerInfo);
ItemStack transformed = MTHelper.toStack(ingredient.applyTransform(new MCItemStack(input), ((player != null) ? new MCPlayer(player) : null)));
if (transformed != input) {
input.stackSize = 0;
if (transformed.stackSize > 0)
containerInfo.set(transformed, false);
}
}
use of minetweaker.mc1112.item.MCItemStack in project CraftTweaker by CraftTweaker.
the class ForgeEventHandler method mobDrop.
@SubscribeEvent
public void mobDrop(LivingDropsEvent ev) {
Entity entity = ev.getEntity();
IEntityDefinition entityDefinition = MineTweakerAPI.game.getEntity(EntityList.getEntityString(ev.getEntity()));
if (entityDefinition != null) {
if (!entityDefinition.getDropsToAdd().isEmpty()) {
entityDefinition.getDropsToAdd().forEach((key, val) -> {
EntityItem item = null;
if (val.getMin() == 0 && val.getMax() == 0) {
item = new EntityItem(entity.world, entity.posX + 0.5, entity.posY + 0.5, entity.posZ + 0.5, ((ItemStack) key.getInternal()).copy());
} else {
item = new EntityItem(entity.world, entity.posX + 0.5, entity.posY + 0.5, entity.posZ + 0.5, ((ItemStack) key.withAmount(val.getRandom()).getInternal()).copy());
}
ev.getDrops().add(item);
});
}
if (ev.getSource().getEntity() instanceof EntityPlayer) {
if (!entityDefinition.getDropsToAddPlayerOnly().isEmpty()) {
entityDefinition.getDropsToAddPlayerOnly().forEach((key, val) -> {
EntityItem item = null;
if (val.getMin() == 0 && val.getMax() == 0) {
item = new EntityItem(entity.world, entity.posX + 0.5, entity.posY + 0.5, entity.posZ + 0.5, ((ItemStack) key.getInternal()).copy());
} else {
item = new EntityItem(entity.world, entity.posX + 0.5, entity.posY + 0.5, entity.posZ + 0.5, ((ItemStack) key.withAmount(val.getRandom()).getInternal()).copy());
}
ev.getDrops().add(item);
});
}
}
if (!entityDefinition.getDropsToRemove().isEmpty()) {
List<EntityItem> removedDrops = new ArrayList<>();
entityDefinition.getDropsToRemove().forEach(drop -> {
// if(drop.matches(new MCItemStack()))
ev.getDrops().forEach(drops -> {
if (drop.matches(new MCItemStack(drops.getEntityItem()))) {
removedDrops.add(drops);
}
});
});
ev.getDrops().removeAll(removedDrops);
}
}
}
use of minetweaker.mc1112.item.MCItemStack in project CraftTweaker by CraftTweaker.
the class MCBrewingManager method getAll.
@Override
public List<IBrewingRecipe> getAll() {
List<IBrewingRecipe> ret = new ArrayList<>();
for (net.minecraftforge.common.brewing.IBrewingRecipe rec : BrewingRecipeRegistry.getRecipes()) {
if (rec instanceof net.minecraftforge.common.brewing.AbstractBrewingRecipe) {
AbstractBrewingRecipe abs = (AbstractBrewingRecipe) rec;
if (abs instanceof BrewingOreRecipe) {
BrewingOreRecipe brew = (BrewingOreRecipe) abs;
ret.add(new BrewingRecipe(new MCItemStack(brew.getOutput()), new MCItemStack(brew.getInput()), convert(brew.getIngredient())));
}
}
}
return ret;
}
Aggregations