crwdns126005:0crwdne126005:0
Note
crwdns126007:0crwdne126007:0
crwdns126009:0crwdne126009:0
crwdns126011:0crwdne126011:0
crwdns126013:0crwdne126013:0
crwdns126015:0crwdne126015:0
Note
crwdns126017:0crwdne126017:0
crwdns126019:0crwdne126019:0
crwdns126021:0crwdne126021:0
crwdns126023:0crwdne126023:0
return new Collection<ItemStack>() {
@Override
public Iterator<ItemStack> iterator() {
return new Iterator<ItemStack>() {
// THIS WILL NOT WORK!
@Override
public boolean hasNext() {
// Code skipped
}
@Override
public ItemStack next() {
// Code skipped
}
};
}
// Other methods skipped
};
crwdns126025:0crwdne126025:0
crwdns126027:0crwdne126027:0
public class SampleCollection implements Collection<ItemStack> {
private final TargetClass target;
public SampleCollection(TargetClass target) {
this.target = target;
}
@Override
public Iterator<ItemStack> iterator() {
return new Iterator<ItemStack>() {
@Override
public boolean hasNext() {
// Code skipped
}
@Override
public ItemStack next() {
// Code skipped
}
};
}
// Other methods skipped
}
@Mixin(TargetClass.class)
public abstract class SomeMixin {
public Collection<ItemStack> someFunction() {
return new SampleCollection((TargetClass) (Object) this);
}
}
crwdns126029:0crwdne126029:0
@Mixin(TargetClass.class)
public abstract class SomeMixin {
private final class SampleIterator implements Iterator<ItemStack> {
@Override
public boolean hasNext() {
// Code skipped
}
@Override
public ItemStack next() {
// Code skipped
}
}
public Collection<ItemStack> someFunction() {
return new Collection<ItemStack>() {
@Override
public Iterator<ItemStack> iterator() {
return new SampleIterator();
}
// Other methods skipped
};
}
}